From e7634c943a4511f1def2ff09fca79a82cd763952 Mon Sep 17 00:00:00 2001 From: Soohye Shin Date: Fri, 21 Aug 2015 18:58:58 +0900 Subject: [PATCH] change to use a table instead of box in action menu Change-Id: I7ce97b5f0dfc8fec592551b473165da576409069 Signed-off-by: Soohye Shin --- src/view/view_action_menu.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/src/view/view_action_menu.c b/src/view/view_action_menu.c index 03fe39d..9209bda 100644 --- a/src/view/view_action_menu.c +++ b/src/view/view_action_menu.c @@ -39,7 +39,7 @@ struct _priv { Evas_Object *base; Evas_Object *btn; Evas_Object *popup; - Evas_Object *box; + Evas_Object *tbl; Eina_List *list; bool edited; @@ -222,7 +222,7 @@ static void _mouse_down(int id, void *data, Evas *e, Evas_Object *obj, static bool _add_base(struct _priv *priv) { - Evas_Object *btn, *box; + Evas_Object *btn, *tbl; btn = utils_add_layout(priv->base, GRP_ACTION_MENU_LIVETV, true, PART_ACTION_MENU_LIVETV); @@ -233,15 +233,13 @@ static bool _add_base(struct _priv *priv) inputmgr_add_callback(btn, INPUT_HANDLER_TYPE_BTN, &handler, priv); priv->btn = btn; - box = utils_add_box(priv->base, true); - if (!box) { - _ERR("failed to add box"); + tbl = utils_add_table(priv->base, true, PART_ACTION_MENU_TABLE); + if (!tbl) { + _ERR("failed to add table"); return false; } - elm_object_part_content_set(priv->base, PART_ACTION_MENU_TABLE, box); - elm_box_padding_set(box, 1, 0); - elm_box_align_set(box, 0.0, 0.5); - priv->box = box; + elm_table_padding_set(tbl, elm_config_scale_get() * 1, 0); + priv->tbl = tbl; return true; } @@ -282,13 +280,13 @@ static Evas_Object *_create(Evas_Object *win, void *data) return base; } -static void _add_empty_item(struct _priv *priv, int len) +static void _add_empty_item(struct _priv *priv, int index) { int i; Evas_Object *item; - for (i = 0; i < len; i++) { - item = utils_add_layout(priv->box, GRP_ACTION_MENU_TABLE_ITEM, + for (i = index; i < COUNT_MENU_ITEM; i++) { + item = utils_add_layout(priv->tbl, GRP_ACTION_MENU_TABLE_ITEM, false, NULL); if (!item) { _ERR("failed to add item"); @@ -296,7 +294,7 @@ static void _add_empty_item(struct _priv *priv, int len) } evas_object_show(item); - elm_box_pack_end(priv->box, item); + elm_table_pack(priv->tbl, item, i, 0, 1, 1); priv->list = eina_list_append(priv->list, item); } } @@ -315,10 +313,8 @@ static bool _add_item(struct _priv *priv) }; int i; - elm_box_clear(priv->box); - for (i = 0; i < sizeof(btn_info) / sizeof(*btn_info); i++) { - item = utils_add_layout(priv->box, GRP_ACTION_MENU_TABLE_ITEM, + item = utils_add_layout(priv->tbl, GRP_ACTION_MENU_TABLE_ITEM, priv->edited, NULL); if (!item) { _ERR("failed to add item"); @@ -361,12 +357,11 @@ static bool _add_item(struct _priv *priv) &handler, priv); } evas_object_show(item); - elm_box_pack_end(priv->box, item); + elm_table_pack(priv->tbl, item, i, 0, 1, 1); priv->list = eina_list_append(priv->list, item); } - _add_empty_item(priv, COUNT_MENU_ITEM - - sizeof(btn_info) / sizeof(*btn_info)); + _add_empty_item(priv, i); return true; err: @@ -413,6 +408,7 @@ static void _hide(void *data) inputmgr_remove_callback(eo, &handler); } + elm_table_clear(priv->tbl, EINA_TRUE); evas_object_hide(priv->base); priv->list = NULL; priv->edited = false; -- 2.7.4