if (!btn)
return NULL;
- evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND,
- EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(btn, EVAS_HINT_FILL,
- EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
if (style)
elm_object_style_set(btn, style);
elm_object_text_set(btn, utils_get_translation_str(text));
if (event == EINA_TRUE) {
- evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_IN,
- _btn_mouse_in_cb, NULL);
- evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_OUT,
- _btn_mouse_out_cb, NULL);
+ evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_IN, _btn_mouse_in_cb, NULL);
+ evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_OUT, _btn_mouse_out_cb, NULL);
}
evas_object_show(btn);
if (!scroller)
return NULL;
- evas_object_size_hint_weight_set(scroller,
- EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(scroller,
- EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(scroller, EVAS_HINT_FILL, EVAS_HINT_FILL);
+#if 0
elm_scroller_bounce_set(scroller, EINA_FALSE, EINA_FALSE);
- elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF,
- ELM_SCROLLER_POLICY_OFF);
+ elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
elm_object_focus_allow_set(scroller, EINA_FALSE);
evas_object_show(scroller);
+#endif
return scroller;
}
if (!box)
return NULL;
- evas_object_size_hint_weight_set(box,
- EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(box,
- EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_focus_allow_set(box, EINA_FALSE);
evas_object_show(box);
* limitations under the License.
*/
+#include "AppCommon.h"
#include "dbg.h"
#include "def.h"
#include "stdbool.h"
*/
void CSublistView::m_ExitView(void)
{
+ _DBG();
+
Hide();
m->mgr->ViewPop();
*/
void CSublistView::sm_CbCtxpopupDismissed(void *data, Evas_Object *obj, void *ev)
{
+ _DBG();
CSublistView *root = (CSublistView*)data;
if (root)
root->m_OnCtxpopupDismissed(obj, ev);
void CSublistView::m_OnCtxpopupDismissed(Evas_Object *obj, void *ev)
{
+ _DBG();
m_ExitView();
}
* @param data [in] The _sublist_data data pointer.
* @return 0 if success, -1 if fail.
*/
-static int _draw_ctxpopup_layout(SSublistView *data)
+bool CSublistView::m_DrawCtxpopupLayout()
{
- Evas_Object *box, *ctxpopup, *scroller;
-
- if (!data || !data->ctxpopup) {
+ _DBG();
+ if (!m->ctxpopup) {
_ERR("Invalid argument");
- return -1;
+ return false;
}
- ctxpopup = data->ctxpopup;
- scroller = NULL;
-
- if (data->sub_items_count > MAX_ITEMS) {
- scroller = utils_add_scroller(ctxpopup);
- if (!scroller) {
- _ERR("elm_scroller_add failed\n");
- return -1;
+ if (m->sub_items_count > MAX_ITEMS) {
+ m->scroller = utils_add_scroller(m->ctxpopup);
+ if (!m->scroller) {
+ _ERR("elm_scroller_add failed");
+ return false;
}
- elm_object_style_set(scroller, SUBLIST_SCROLLER_STYLE);
- elm_object_content_set(ctxpopup, scroller);
+ //elm_object_style_set(m->scroller, SUBLIST_SCROLLER_STYLE);
+ elm_object_content_set(m->ctxpopup, m->scroller);
- box = utils_add_box(ctxpopup);
- if (!box) {
- _ERR("elm_box_add failed\n");
- evas_object_del(scroller);
- return -1;
+ m->popup_box = utils_add_box(m->ctxpopup);
+ if (!m->popup_box) {
+ _ERR("elm_box_add failed");
+ evas_object_del(m->scroller);
+ return false;
}
- elm_object_content_set(scroller, box);
+ elm_object_content_set(m->scroller, m->popup_box);
- evas_object_smart_callback_add(scroller, SIG_SCROLL_BOTTOM,
- _scroller_bottom_cb, data);
- evas_object_smart_callback_add(scroller, SIG_SCROLL_TOP,
- _scroller_top_cb, data);
- evas_object_smart_callback_add(scroller, SIG_SCROLL,
- _scroll_event_cb, data);
+ evas_object_smart_callback_add(m->scroller, SIG_SCROLL_BOTTOM, _scroller_bottom_cb, m);
+ evas_object_smart_callback_add(m->scroller, SIG_SCROLL_TOP, _scroller_top_cb, m);
+ evas_object_smart_callback_add(m->scroller, SIG_SCROLL, _scroll_event_cb, m);
- elm_object_signal_emit(ctxpopup, SUBLIST_SHOW_DOWN_ARROW, "");
+ elm_object_signal_emit(m->ctxpopup, SUBLIST_SHOW_DOWN_ARROW, "");
} else {
- box = utils_add_box(ctxpopup);
- if (!box) {
- _ERR("elm_box_add failed\n");
- return -1;
+ m->popup_box = utils_add_box(m->ctxpopup);
+ if (!m->popup_box) {
+ _ERR("elm_box_add failed");
+ return false;
}
- elm_object_content_set(ctxpopup, box);
+ elm_object_content_set(m->ctxpopup, m->popup_box);
- elm_object_signal_emit(ctxpopup, SUBLIST_HIDE_BOTH_ARROW, "");
+ elm_object_signal_emit(m->ctxpopup, SUBLIST_HIDE_BOTH_ARROW, "");
}
- data->popup_box = box;
- data->scroller = scroller;
-
- return 0;
+ return true;
}
/**
* @param list [in] The eina list data pointer.
* @return 0 if success, -1 if fail.
*/
-int CSublistView::m_DrawListItems(Eina_List *list)
+bool CSublistView::m_DrawListItems(Eina_List *list)
{
+ _DBG();
struct listitem *ldata;
void* obj;
Eina_List *l;
if (!list || !m->popup_box) {
_ERR("Invalid argument");
- return -1;
+ return false;
}
sel = _get_selected_value(m);
if (!sel) {
_ERR("Get selected value failed");
- return -1;
+ return false;
}
btns = eina_array_new(1);
if (!btns) {
- _ERR("Allocate array failed\n");
+ _ERR("Allocate array failed");
provider_release_list_value(sel);
- return -1;
+ return false;
}
i = 0;
ldata = (struct listitem *) obj;
name = listitem_get_display_name(ldata);
- btn = utils_add_btn(m->popup_box, (char *) CTXPOPUPBTN_STYLE,
- name, EINA_TRUE);
+ btn = utils_add_btn(m->popup_box, (char *) CTXPOPUPBTN_STYLE, name, EINA_TRUE);
if (!btn) {
- _ERR("Add button failed\n");
+ _ERR("Add button failed");
EINA_ARRAY_ITER_NEXT(btns, j, obj, a)
{
tmp = (Evas_Object *) obj;
}
eina_array_free(btns);
provider_release_list_value(sel);
- return -1;
+ return false;
}
val = listitem_get_value(ldata);
provider_release_list_value(sel);
- return 0;
+ return true;
}
/**
*/
bool CSublistView::m_DrawSublist(void)
{
- struct settingview_data *view;
+ _DBG();
Eina_List *list;
double ratio, w;
int cnt, x, y, height, screen_h;
return false;
}
- view = m->sublist_view;
-
cnt = 0;
- list = _get_list_data(view, &cnt);
+ list = _get_list_data(m->sublist_view, &cnt);
if (!list) {
_ERR("Get item list failed");
return false;
m->sub_items_count = cnt;
- if (_draw_ctxpopup_layout(m) == -1) {
+ if (!m_DrawCtxpopupLayout()) {
_ERR("Fail to draw ctxpopup layout");
return false;
}
- if (m_DrawListItems(list) == -1) {
+ if (!m_DrawListItems(list)) {
_ERR("Fail to draw list items");
return false;
}
- screen_h = WIN_HEIGHT;
-
- param = m->geometry_data;
-
- w = param->width;
- if (w <= 0) {
- _ERR("Fail to get clicked button width");
- return false;
- }
-
- ratio = (w - SUBLIST_WIDTH - SUBLIST_OFFSET) / w;
-
- x = param->x + param->width * ratio;
- y = param->y;
-
- if (m->sub_items_count < MAX_ITEMS)
- height = m->sub_items_count * ITEM_HEIGHT;
- else
- height = MAX_ITEMS * ITEM_HEIGHT + ITEM_OFFSET;
-
- if (y > screen_h)
- {
- y = y - height;
- _DBG("y > screen_h !!!!!! y = %d", y);
- }
-
- _DBG("x : %d , y : %d, ELM_SCALE = %f, height = %d", x , y , ELM_SCALE, height);
- evas_object_move(m->ctxpopup, x * ELM_SCALE, (y * ELM_SCALE) + height);
+ evas_object_move(m->ctxpopup, m->geometry_data->x + m->geometry_data->width , m->geometry_data->y);
utils_set_focus_directions(m->sub_btn_array, m->sub_items_count);
ASSERT(!m);
ASSERT(view);
ASSERT(prev);
-
- Evas_Object *base, *ctxpopup, *win;
- CSettingMgr *mgr = CSettingMgr::GetInstance();
-
- win = mgr->Window();
- ASSERT(win);
-
- m = new SSublistView;
- if (!m) {
- _ERR("Unable to allocate memory\n");
- return false;
- }
-
- base = elm_layout_add(win);
- if (!base) {
- delete m;
- m = NULL;
- return false;
- }
-
- elm_layout_file_set(base, EDJ_FILE, SUBLIST_VIEW_PAGE);
-
- ctxpopup = utils_add_ctxpopup(win, (char *) SUBLIST_CTXPOPUP_STYLE1);
- if (!ctxpopup) {
- _ERR("Fail to add ctxpopup");
- evas_object_del(base);
- delete m;
- m = NULL;
- return false;
- }
-
- evas_object_smart_callback_add(ctxpopup, SIG_CTXPOPUP_DISMISSED,
- sm_CbCtxpopupDismissed, m);
-
- m->geometry_data = (struct obj_geometry_data *) prev;
-
- m->mgr = mgr;
- m->win = win;
- m->base = base;
- m->ctxpopup = ctxpopup;
- m->sublist_view = view;
-
- if (!m_DrawSublist()) {
- _ERR("Error in drawing items function\n");
- evas_object_del(base);
- evas_object_del(ctxpopup);
- if (m->sub_btn_array)
- eina_array_free(m->sub_btn_array);
-
- delete m;
- m = NULL;
- return false;
- }
+ _DBG();
+
+ _CREATE_BEGIN {
+ _CHECK(m = new SSublistView)
+ _CHECK(m->mgr = CSettingMgr::GetInstance())
+ _CHECK(m->win = m->mgr->Window())
+ _CHECK(m->base = elm_layout_add(m->win))
+ _COMMAND {
+ elm_layout_file_set(m->base, EDJ_FILE, SUBLIST_VIEW_PAGE);
+ }
+ _CHECK(m->ctxpopup = utils_add_ctxpopup(m->win, (char *) SUBLIST_CTXPOPUP_STYLE1))
+ _COMMAND {
+ evas_object_smart_callback_add(m->ctxpopup, SIG_CTXPOPUP_DISMISSED, sm_CbCtxpopupDismissed, this);
+ m->geometry_data = (struct obj_geometry_data *) prev;
+ _DBG("m-geometry_data w:%d, h:%d, x:%d, y:%d",
+ m->geometry_data->width,
+ m->geometry_data->height,
+ m->geometry_data->x,
+ m->geometry_data->y
+ );
+
+ m->sublist_view = view;
+ }
+ _CHECK(m_DrawSublist())
+ _WHEN_SUCCESS { }
+ _CHECK_FAIL{ if (m->sub_btn_array) eina_array_free(m->sub_btn_array); }
+ _CHECK_FAIL{ if(m->ctxpopup) evas_object_del(m->ctxpopup); }
+ _CHECK_FAIL{ if(m->base) evas_object_del(m->base); }
+ _CHECK_FAIL{/* m->win = m->mgr->Window() */}
+ _CHECK_FAIL{/* m->mgr = CSettingMgr::GetInstance() */}
+ _CHECK_FAIL{ delete m; m = NULL; }
+ } _CREATE_END_AND_CATCH{ return false; }
return true;
}
void CSublistView::Show(void)
{
ASSERT(m);
+ _DBG();
evas_object_show(m->ctxpopup);
evas_object_show(m->base);
void CSublistView::Destroy(void)
{
ASSERT(m);
+ _DBG();
if (m->sub_btn_array)
eina_array_free(m->sub_btn_array);
void CSublistView::Hide(void)
{
ASSERT(m);
+ _DBG();
evas_object_hide(m->base);
evas_object_hide(m->ctxpopup);
void CSublistView::OnMouseClicked(int id, Evas_Object *obj)
{
+ _DBG();
if (id != ID_BTNS)
return;
void CSublistView::OnFocused(int id, Evas_Object *obj, Elm_Object_Item *item)
{
+ _DBG();
if (id != ID_BTNS)
return;
void CSublistView::OnUnfocused(int id, Evas_Object *obj, Elm_Object_Item *item)
{
+ _DBG();
if (id != ID_BTNS)
return;
void CSublistView::OnKeyDown(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev)
{
+ _DBG();
if (id != ID_BTNS)
return;