View: Enable the buttons of action view to be clicked 27/46427/1
authorHyojung Jo <hj903.jo@samsung.com>
Thu, 20 Aug 2015 07:14:26 +0000 (16:14 +0900)
committerHyojung Jo <hj903.jo@samsung.com>
Thu, 20 Aug 2015 07:14:26 +0000 (16:14 +0900)
Change-Id: Ia5084f92e3bbd0d292de59ec4cd44596fb4a7036
Signed-off-by: Hyojung Jo <hj903.jo@samsung.com>
include/define.h
res/widget/button.edc
src/view/view_action_menu.c
src/view/view_base.c

index 5749b64..8694cde 100644 (file)
@@ -68,8 +68,7 @@
 #define SIG_FAVORITE "favorite"
 #define SIG_VISIBLE "visible"
 #define SIG_INVISIBLE "invisible"
-#define SIG_DISABLE "disable"
-#define SIG_BTN_DISABLE "elm,state,disabled";
+#define SIG_DISABLE "elm,state,disabled"
 
 /* Signal Source */
 #define SRC_MYAPPS "source.myapps"
 #define TRANSITION_FOCUS DECELERATE 0.20
 #define TRANSITION_CLICK DECELERATE 0
 
+/* Color */
+#define COLOR_ITEM_FOCUS 0 119 246 255
+
 #endif /* __AIR_APPS_DEFINE_H__ */
index 24ec972..0b64902 100644 (file)
@@ -40,7 +40,7 @@ group {
                        description {
                                state, "focused" 0.0;
                                inherit, "default" 0.0;
-                               color, 0 119 246 255;
+                               color, COLOR_ITEM_FOCUS;
                        }
                }
 
@@ -66,7 +66,7 @@ group {
                        description {
                                state, "focused" 0.0;
                                inherit, "default" 0.0;
-                               color, 0 119 246 255;
+                               color, COLOR_ITEM_FOCUS;
                        }
                }
 
@@ -95,7 +95,7 @@ group {
                        description {
                                state, "focused" 0.0;
                                inherit, "default" 0.0;
-                               color, 0 119 246 255;
+                               color, COLOR_ITEM_FOCUS;
                        }
                }
 
@@ -300,7 +300,7 @@ group {
                        description {
                                state, "focused" 0.0;
                                inherit, "default" 0.0;
-                               color, 0 119 246 255;
+                               color, COLOR_ITEM_FOCUS;
                        }
                        description {
                                state, "selected" 0.0;
@@ -608,7 +608,7 @@ group {
                program {
                        name, SIG_DISABLE;
                        signal, SIG_DISABLE;
-                       source, SRC_SORT_BTN;
+                       source, "elm";
                        script {
                                set_state(PART:"elm.text", "disable", 0.0);
                                set_state(PART:"part.arrow", "disable", 0.0);
@@ -636,7 +636,7 @@ group {
                        description {
                                state, "focused" 0.0;
                                inherit, "default" 0.0;
-                               color, 0 119 246 255;
+                               color, COLOR_ITEM_FOCUS;
                        }
                        description {
                                state, "selected" 0.0;
@@ -781,7 +781,7 @@ group {
                        description {
                                state, "focused" 0.0;
                                inherit, "default" 0.0;
-                               color, 0 119 246 255;
+                               color, COLOR_ITEM_FOCUS;
                        }
                        description {
                                state, "disable" 0.0;
@@ -953,6 +953,20 @@ group {
                                color, 194 194 194 127;
                        }
                }
+
+               part {
+                       name, "event";
+                       type, RECT;
+                       description {
+                               state, "default" 0.0;
+                               color, 0 0 0 0;
+                       }
+                       description {
+                               state, "disable" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+               }
        }
 
        programs {
@@ -979,15 +993,23 @@ group {
                program {
                        name, SIG_DISABLE;
                        signal, SIG_DISABLE;
-                       source, SRC_LIVETV_BTN;
+                       source, "elm";
                        script {
                                set_state(PART:"elm.text", "disable", 0.0);
                                set_state(PART:"part.inside.line.up", "disable", 0.0);
                                set_state(PART:"part.inside.line.down", "disable", 0.0);
                                set_state(PART:"part.inside.line.left", "disable", 0.0);
                                set_state(PART:"part.inside.line.right", "disable", 0.0);
+                               set_state(PART:"event", "disable", 0.0);
                        }
                }
+
+               program {
+                       name, "mouse_unclick_after";
+                       signal, "mouse,clicked,1";
+                       source, "event";
+                       action, SIGNAL_EMIT "elm,action,click" "";
+               }
        }
 }
 
@@ -1017,7 +1039,7 @@ group {
                        description {
                                state, "focused" 0.0;
                                inherit, "default" 0.0;
-                               color, 0 119 246 255;
+                               color, COLOR_ITEM_FOCUS;
                        }
                        description {
                                state, "selected" 0.0;
@@ -1189,6 +1211,20 @@ group {
                                color, 104 104 104 127;
                        }
                }
+
+               part {
+                       name, "event";
+                       type, RECT;
+                       description {
+                               state, "default" 0.0;
+                               color, 0 0 0 0;
+                       }
+                       description {
+                               state, "disable" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+               }
        }
 
        programs{
@@ -1258,16 +1294,24 @@ group {
                }
 
                program {
-                       name, SIG_BTN_DISABLE;
-                       signal, SIG_BTN_DISABLE;
+                       name, SIG_DISABLE;
+                       signal, SIG_DISABLE;
                        source, "elm";
                        script {
                                set_int(cur_state, STATE_DISABLE);
                                set_state(PART:"part.bg", "disable", 0.0);
                                set_state(PART:"elm.text", "disable", 0.0);
                                set_state(PART:"part.icon", "disable", 0.0);
+                               set_state(PART:"event", "disable", 0.0);
                        }
                }
+
+               program {
+                       name, "mouse_unclick_after";
+                       signal, "mouse,clicked,1";
+                       source, "event";
+                       action, SIGNAL_EMIT "elm,action,click" "";
+               }
        }
 }
 
index fb218a3..c339b2d 100644 (file)
 #include "grid.h"
 
 enum action_type {
-       ACTION_FAVORITE = 0,
-       ACTION_LOCK,
-       ACTION_UNINSTALL,
+       BTN_LIVETV = 0,
+       BTN_FAVORITE,
+       BTN_LOCK,
+       BTN_UNINSTALL,
 };
 
 struct _priv {
@@ -42,6 +43,7 @@ struct _priv {
 };
 
 struct _action_info {
+       int id;
        const char *title;
        const char *style;
        Eina_Bool disable;
@@ -49,16 +51,19 @@ struct _action_info {
 
 static struct _action_info action_info[] = {
        {
+               .id = BTN_FAVORITE,
                .title = STR_FAVORITE,
                .style = STYLE_ACTION_MENU_FAV_BTN,
                .disable = EINA_FALSE
        },
        {
+               .id = BTN_LOCK,
                .title = STR_LOCK,
                .style = STYLE_ACTION_MENU_LOCK_BTN,
                .disable = EINA_TRUE
        },
        {
+               .id = BTN_UNINSTALL,
                .title = STR_UNINSTALL,
                .style = STYLE_ACTION_MENU_UNINSTALL_BTN,
                .disable = EINA_TRUE
@@ -77,20 +82,41 @@ static void _mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj,
                elm_object_focus_set(obj, EINA_TRUE);
 }
 
-static void _livetv_key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
-               Evas_Event_Key_Down *ev)
+static void _favorite_selected(void *data, Evas_Object *obj)
 {
-       if (!ev) {
-               _ERR("Invalid argument.");
-               return;
-       }
+       /* It will be implemented later */
+}
 
-       if (!strcmp(ev->keyname, KEY_BACK)
-                       || !strcmp(ev->keyname, KEY_BACK_REMOTE))
-               viewmgr_hide_view(VIEW_ACTION_MENU);
+static void _livetv_selected(void *data, Evas_Object *obj)
+{
+       /* It will be implemented later */
+}
+
+static void _clicked_cb(int id, void *data, Evas_Object *obj)
+{
+       switch (id) {
+       case BTN_LIVETV:
+               _livetv_selected(data, obj);
+               break;
+
+       case BTN_FAVORITE:
+               _favorite_selected(data, obj);
+               break;
+
+       case BTN_LOCK:
+               /* It is not supported yet. */
+               break;
+
+       case BTN_UNINSTALL:
+               /* It is not supported yet. */
+               break;
+
+       default:
+               _ERR("Unhandled button type.");
+       }
 }
 
-static void _action_key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
+static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
                Evas_Event_Key_Down *ev)
 {
        if (!ev) {
@@ -99,27 +125,8 @@ static void _action_key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
        }
 
        if (!strcmp(ev->keyname, KEY_BACK)
-                       || !strcmp(ev->keyname, KEY_BACK_REMOTE)) {
+                       || !strcmp(ev->keyname, KEY_BACK_REMOTE))
                viewmgr_hide_view(VIEW_ACTION_MENU);
-       } else if (!strcmp(ev->keyname, KEY_ENTER)
-                       || !strcmp(ev->keyname, KEY_ENTER_REMOTE)) {
-               switch (id) {
-               case ACTION_FAVORITE:
-                       /* It will be implemented later. */
-                       break;
-
-               case ACTION_LOCK:
-                       /* It is not supported yet. */
-                       break;
-
-               case ACTION_UNINSTALL:
-                       /* It is not supported yet. */
-                       break;
-
-               default:
-                       _ERR("Unhandled action type.");
-               }
-       }
 }
 
 static void _grid_mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj,
@@ -195,14 +202,10 @@ static void _grid_key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
                viewmgr_hide_view(VIEW_ACTION_MENU);
 }
 
-static input_handler _livetv_input_handler = {
-       .mouse_move = _mouse_move_cb,
-       .key_down = _livetv_key_down_cb
-};
-
-static input_handler _action_input_handler = {
+static input_handler _btn_input_handler = {
        .mouse_move = _mouse_move_cb,
-       .key_down = _action_key_down_cb
+       .clicked = _clicked_cb,
+       .key_down = _key_down_cb
 };
 
 static input_handler _grid_input_handler = {
@@ -228,7 +231,7 @@ static bool _draw_livetv_area(struct _priv *priv)
                return false;
        }
 
-       inputmgr_add_callback(btn, 0, &_livetv_input_handler, priv);
+       inputmgr_add_callback(btn, BTN_LIVETV, &_btn_input_handler, priv);
 
        elm_object_focus_next_object_set(btn, btn, ELM_FOCUS_UP);
        elm_object_focus_next_object_set(btn, btn, ELM_FOCUS_LEFT);
@@ -265,7 +268,8 @@ static bool _draw_menu_area(struct _priv *priv)
                        return false;
                }
 
-               inputmgr_add_callback(btn, i, &_action_input_handler, priv);
+               inputmgr_add_callback(btn, action_info[i].id,
+                               &_btn_input_handler, priv);
 
                if (action_info[i].disable)
                        elm_object_disabled_set(btn, EINA_TRUE);
index 2db127b..4dde697 100644 (file)
@@ -606,7 +606,6 @@ static void _grid_key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
        if (!strcmp(ev->keyname, KEY_BACK)
                        || !strcmp(ev->keyname, KEY_BACK_REMOTE))
                elm_object_focus_set(priv->focused_menu, EINA_TRUE);
-
        /* FIXME: The action menu is blocked temporarily. */
        /*
        else if (!strcmp(ev->keyname, KEY_MENU)
@@ -713,7 +712,7 @@ static bool _draw_bottom_area(struct _priv *priv)
        priv->sort_btn = btn;
 
        if (!priv->app_list)
-               elm_object_signal_emit(btn, SIG_DISABLE, SRC_SORT_BTN);
+               elm_object_disabled_set(btn, EINA_TRUE);
 
        c = eina_list_count(priv->app_list);
        snprintf(str, sizeof(str), " %d "STR_APPS, c);