View: Enabled the action menu buttons focused 63/46063/1
authorHyojung Jo <hj903.jo@samsung.com>
Thu, 13 Aug 2015 12:05:09 +0000 (21:05 +0900)
committerHyojung Jo <hj903.jo@samsung.com>
Thu, 13 Aug 2015 12:05:09 +0000 (21:05 +0900)
Change-Id: I340d4572f82fc084b54054fffa72552e73a6b452
Signed-off-by: Hyojung Jo <hj903.jo@samsung.com>
12 files changed:
include/define.h
res/images/btn_menu_favorite_dis.png [new file with mode: 0644]
res/images/btn_menu_favorite_foc.png [new file with mode: 0644]
res/images/btn_menu_favorite_sel.png [new file with mode: 0644]
res/images/btn_menu_lock_foc.png [new file with mode: 0644]
res/images/btn_menu_lock_nor.png [new file with mode: 0644]
res/images/btn_menu_lock_sel.png [new file with mode: 0644]
res/images/btn_menu_share_foc.png [new file with mode: 0644]
res/images/btn_menu_share_nor.png [new file with mode: 0644]
res/images/btn_menu_share_sel.png [new file with mode: 0644]
res/widgets/button.edc
src/view/view_action_menu.c

index 26e4c0b..f328d2b 100644 (file)
@@ -47,7 +47,9 @@
 /* Style */
 #define STYLE_MENU_BTN "style.menu.button"
 #define STYLE_LIVETV_BTN "style.livetv.button"
-#define STYLE_ACTION_MENU_BTN "style.action.menu.button"
+#define STYLE_ACTION_MENU_FAV_BTN "style.action.menu.favorite.button"
+#define STYLE_ACTION_MENU_LOCK_BTN "style.action.menu.lock.button"
+#define STYLE_ACTION_MENU_SHARE_BTN "style.action.menu.share.button"
 
 /* Signal */
 #define SIG_FOCUSED "focused"
 #define SIG_ITEM_SELECTED "item.selected"
 #define SIG_VISIBLE "visible"
 #define SIG_INVISIBLE "invisible"
+#define SIG_DISABLE "disable"
 
 /* Source */
 #define SRC_EDC "edc"
 #define SRC_MENU_BTN "menubtn"
+#define SRC_LIVETV_BTN "source.livetv.btn"
+#define SRC_ACTION_BTN "source.action.btn"
 
 /* Transition */
 #define TRANSITION_FOCUS DECELERATE 0.20
 #define DEFAULT_TV_PNG IMGDIR"/ic_default_tv.png"
 #define BROWSER_ICON_PNG IMGDIR"/ic_apps_web.png"
 #define GULLIVER_PNG IMGDIR"/gulliver.png"
-#define ACTION_FAV_NOR_PNG IMGDIR"/btn_menu_favorite_nor.png"
-#define ACTION_LOCK_DIS_PNG IMGDIR"/btn_menu_lock_dis.png"
-#define ACTION_SHARE_DIS_PNG IMGDIR"/btn_menu_share_dis.png"
+#define ACTION_FAV_NOR_PNG "btn_menu_favorite_nor.png"
+#define ACTION_FAV_FOC_PNG "btn_menu_favorite_foc.png"
+#define ACTION_FAV_SEL_PNG "btn_menu_favorite_sel.png"
+#define ACTION_FAV_DIS_PNG "btn_menu_favorite_dis.png"
+#define ACTION_LOCK_NOR_PNG "btn_menu_lock_nor.png"
+#define ACTION_LOCK_FOC_PNG "btn_menu_lock_foc.png"
+#define ACTION_LOCK_SEL_PNG "btn_menu_lock_sel.png"
+#define ACTION_LOCK_DIS_PNG "btn_menu_lock_dis.png"
+#define ACTION_SHARE_NOR_PNG "btn_menu_share_nor.png"
+#define ACTION_SHARE_FOC_PNG "btn_menu_share_foc.png"
+#define ACTION_SHARE_SEL_PNG "btn_menu_share_sel.png"
+#define ACTION_SHARE_DIS_PNG "btn_menu_share_dis.png"
 
 /* Path */
 #define PATH_PLAY_ICON_PNG IMGDIR"/ic_thumbnail_play.png"
diff --git a/res/images/btn_menu_favorite_dis.png b/res/images/btn_menu_favorite_dis.png
new file mode 100644 (file)
index 0000000..bd9bdd8
Binary files /dev/null and b/res/images/btn_menu_favorite_dis.png differ
diff --git a/res/images/btn_menu_favorite_foc.png b/res/images/btn_menu_favorite_foc.png
new file mode 100644 (file)
index 0000000..e4915d5
Binary files /dev/null and b/res/images/btn_menu_favorite_foc.png differ
diff --git a/res/images/btn_menu_favorite_sel.png b/res/images/btn_menu_favorite_sel.png
new file mode 100644 (file)
index 0000000..bd2eeee
Binary files /dev/null and b/res/images/btn_menu_favorite_sel.png differ
diff --git a/res/images/btn_menu_lock_foc.png b/res/images/btn_menu_lock_foc.png
new file mode 100644 (file)
index 0000000..5671cfc
Binary files /dev/null and b/res/images/btn_menu_lock_foc.png differ
diff --git a/res/images/btn_menu_lock_nor.png b/res/images/btn_menu_lock_nor.png
new file mode 100644 (file)
index 0000000..5f38494
Binary files /dev/null and b/res/images/btn_menu_lock_nor.png differ
diff --git a/res/images/btn_menu_lock_sel.png b/res/images/btn_menu_lock_sel.png
new file mode 100644 (file)
index 0000000..1baa790
Binary files /dev/null and b/res/images/btn_menu_lock_sel.png differ
diff --git a/res/images/btn_menu_share_foc.png b/res/images/btn_menu_share_foc.png
new file mode 100644 (file)
index 0000000..0bfcd19
Binary files /dev/null and b/res/images/btn_menu_share_foc.png differ
diff --git a/res/images/btn_menu_share_nor.png b/res/images/btn_menu_share_nor.png
new file mode 100644 (file)
index 0000000..bdea318
Binary files /dev/null and b/res/images/btn_menu_share_nor.png differ
diff --git a/res/images/btn_menu_share_sel.png b/res/images/btn_menu_share_sel.png
new file mode 100644 (file)
index 0000000..05e8f16
Binary files /dev/null and b/res/images/btn_menu_share_sel.png differ
index 61e552b..c746e5a 100644 (file)
@@ -16,6 +16,7 @@
 
 #define STATE_NORMAL 0
 #define STATE_SELECTED 1
+#define STATE_DISABLE 2
 
 group {
        name, "elm/button/base/style.menu.button";
@@ -284,6 +285,15 @@ group {
                                state, "default" 0.0;
                                min, 0 64;
                        }
+                       description {
+                               state, "focused" 0.0;
+                               inherit, "default" 0.0;
+                               color, 0 119 246 255;
+                       }
+                       description {
+                               state, "disable" 0.0;
+                               inherit, "default" 0.0;
+                       }
                }
 
                part {
@@ -341,6 +351,16 @@ group {
                                        align, 0.5 0.5;
                                }
                        }
+                       description {
+                               state, "focused" 0.0;
+                               inherit, "default" 0.0;
+                               color, 255 255 255 255;
+                       }
+                       description {
+                               state, "disable" 0.0;
+                               inherit, "default" 0.0;
+                               color, 87 87 87 127;
+                       }
                }
 
                part {
@@ -359,6 +379,11 @@ group {
                                align, 0.5 0.0;
                                fixed, 0 1;
                        }
+                       description {
+                               state, "disable" 0.0;
+                               inherit, "default" 0.0;
+                               color, 194 194 194 127;
+                       }
                }
 
                part {
@@ -380,6 +405,11 @@ group {
                                align, 0.0 0.5;
                                fixed, 1 0;
                        }
+                       description {
+                               state, "disable" 0.0;
+                               inherit, "default" 0.0;
+                               color, 194 194 194 127;
+                       }
                }
 
                part {
@@ -398,6 +428,11 @@ group {
                                align, 0.5 1.0;
                                fixed, 0 1;
                        }
+                       description {
+                               state, "disable" 0.0;
+                               inherit, "default" 0.0;
+                               color, 194 194 194 127;
+                       }
                }
 
                part {
@@ -419,6 +454,46 @@ group {
                                align, 1.0 0.5;
                                fixed, 1 0;
                        }
+                       description {
+                               state, "disable" 0.0;
+                               inherit, "default" 0.0;
+                               color, 194 194 194 127;
+                       }
+               }
+       }
+
+       programs {
+               program {
+                       name, SIG_FOCUSED;
+                       signal, "elm,action,focus";
+                       source, "elm";
+                       action, STATE_SET "focused" 0.0;
+                       target, "part.bg";
+                       target, "elm.text";
+                       transition, TRANSITION_FOCUS;
+               }
+
+               program {
+                       name, SIG_UNFOCUSED;
+                       signal, "elm,action,unfocus";
+                       source, "elm";
+                       action, STATE_SET "default" 0.0;
+                       target, "part.bg";
+                       target, "elm.text";
+                       transition, TRANSITION_FOCUS;
+               }
+
+               program {
+                       name, SIG_DISABLE;
+                       signal, SIG_DISABLE;
+                       source, SRC_LIVETV_BTN;
+                       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);
+                       }
                }
        }
 }
@@ -426,6 +501,10 @@ group {
 group {
        name, "elm/button/base/style.action.menu.button";
        data.item, "focus_highlight" "on";
+       script {
+               public cur_state;
+       }
+
        parts {
                part {
                        name, "part.bg";
@@ -435,6 +514,19 @@ group {
                                state, "default" 0.0;
                                min, 125 124;
                        }
+                       description {
+                               state, "focused" 0.0;
+                               inherit, "default" 0.0;
+                               color, 0 119 246 255;
+                       }
+                       description {
+                               state, "selected" 0.0;
+                               inherit, "default" 0.0;
+                       }
+                       description {
+                               state, "disable" 0.0;
+                               inherit, "default" 0.0;
+                       }
                }
 
                part {
@@ -508,8 +600,8 @@ group {
                }
 
                part {
-                       name, "elm.swallow.content";
-                       type, SWALLOW;
+                       name, "part.icon";
+                       type, IMAGE;
                        scale, 1;
                        description {
                                state, "default" 0.0;
@@ -525,6 +617,18 @@ group {
                                fixed, 1 1;
                                min, 60 60;
                        }
+                       description {
+                               state, "focused" 0.0;
+                               inherit, "default" 0.0;
+                       }
+                       description {
+                               state, "focused" 0.0;
+                               inherit, "default" 0.0;
+                       }
+                       description {
+                               state, "focused" 0.0;
+                               inherit, "default" 0.0;
+                       }
                }
 
                part {
@@ -565,6 +669,247 @@ group {
                                        align, 0.5 0.5;
                                }
                        }
+                       description {
+                               state, "focused" 0.0;
+                               inherit, "default" 0.0;
+                               color, 255 255 255 255;
+                       }
+                       description {
+                               state, "selected" 0.0;
+                               inherit, "default" 0.0;
+                               color, 64 136 211 255;
+                       }
+                       description {
+                               state, "disable" 0.0;
+                               inherit, "default" 0.0;
+                               color, 104 104 104 127;
+                       }
+               }
+       }
+
+       programs{
+               program {
+                       name, SIG_FOCUSED;
+                       signal, "elm,action,focus";
+                       source, "elm";
+                       script {
+                               new state;
+                               state = get_int(cur_state);
+                               if (state != STATE_DISABLE) {
+                                       set_int(cur_state, STATE_NORMAL);
+                                       run_program(PROGRAM:"focused,anim");
+                               }
+                       }
+               }
+
+               program {
+                       name, SIG_UNFOCUSED;
+                       signal, "elm,action,unfocus";
+                       source, "elm";
+                       script {
+                               new state;
+                               state = get_int(cur_state);
+                               if (state == STATE_SELECTED) {
+                                       set_state(PART:"part.bg", "selected", 0.0);
+                                       set_state(PART:"elm.text", "selected", 0.0);
+                                       set_state(PART:"part.icon", "selected", 0.0);
+                               } else if (state != STATE_DISABLE) {
+                                       run_program(PROGRAM:"unfocused,anim");
+                               }
+                       }
+               }
+
+               program {
+                       name, "focused,anim";
+                       action, STATE_SET "focused" 0.0;
+                       target, "part.bg";
+                       target, "elm.text";
+                       target, "part.icon";
+                       transition, TRANSITION_FOCUS;
+               }
+
+               program {
+                       name, "unfocused,anim";
+                       action, STATE_SET "default" 0.0;
+                       target, "part.bg";
+                       target, "elm.text";
+                       target, "part.icon";
+                       transition, TRANSITION_FOCUS;
+               }
+
+               program {
+                       name, SIG_SELECTED;
+                       signal, SIG_SELECTED;
+                       source, SRC_ACTION_BTN;
+                       script {
+                               new state;
+                               state = get_int(cur_state);
+                               if (state != STATE_DISABLE) {
+                                       set_int(cur_state, STATE_SELECTED);
+                                       set_state(PART:"part.bg", "selected", 0.0);
+                                       set_state(PART:"elm.text", "selected", 0.0);
+                                       set_state(PART:"part.icon", "selected", 0.0);
+                               }
+                       }
+               }
+
+               program {
+                       name, SIG_DISABLE;
+                       signal, SIG_DISABLE;
+                       source, SRC_ACTION_BTN;
+                       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);
+                       }
+               }
+       }
+}
+
+group {
+       name, "elm/button/base/style.action.menu.favorite.button";
+       inherit, "elm/button/base/style.action.menu.button";
+       data.item, "focus_highlight" "on";
+       images {
+               image, ACTION_FAV_NOR_PNG COMP;
+               image, ACTION_FAV_FOC_PNG COMP;
+               image, ACTION_FAV_SEL_PNG COMP;
+               image, ACTION_FAV_DIS_PNG COMP;
+       }
+       parts {
+               part {
+                       name, "part.icon";
+                       type, IMAGE;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               rel1 {
+                                       to, "part.icon.bg";
+                                       relative, 0.5 0.5;
+                               }
+                               rel2 {
+                                       to, "part.icon.bg";
+                                       relative, 0.5 0.5;
+                               }
+                               align, 0.5 0.5;
+                               fixed, 1 1;
+                               min, 60 60;
+                               image.normal, ACTION_FAV_NOR_PNG;
+                       }
+                       description {
+                               state, "focused" 0.0;
+                               inherit, "default" 0.0;
+                               image.normal, ACTION_FAV_FOC_PNG;
+                       }
+                       description {
+                               state, "selected" 0.0;
+                               inherit, "default" 0.0;
+                               image.normal, ACTION_FAV_SEL_PNG;
+                       }
+                       description {
+                               state, "disable" 0.0;
+                               inherit, "default" 0.0;
+                               image.normal, ACTION_FAV_DIS_PNG;
+                       }
+               }
+       }
+}
+
+group {
+       name, "elm/button/base/style.action.menu.lock.button";
+       inherit, "elm/button/base/style.action.menu.button";
+       data.item, "focus_highlight" "on";
+       images {
+               image, ACTION_LOCK_NOR_PNG COMP;
+               image, ACTION_LOCK_FOC_PNG COMP;
+               image, ACTION_LOCK_SEL_PNG COMP;
+               image, ACTION_LOCK_DIS_PNG COMP;
+       }
+       parts {
+               part {
+                       name, "part.icon";
+                       type, IMAGE;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               rel1 {
+                                       to, "part.icon.bg";
+                                       relative, 0.5 0.5;
+                               }
+                               rel2 {
+                                       to, "part.icon.bg";
+                                       relative, 0.5 0.5;
+                               }
+                               align, 0.5 0.5;
+                               fixed, 1 1;
+                               min, 60 60;
+                               image.normal, ACTION_LOCK_NOR_PNG;
+                       }
+                       description {
+                               state, "focused" 0.0;
+                               inherit, "default" 0.0;
+                               image.normal, ACTION_LOCK_FOC_PNG;
+                       }
+                       description {
+                               state, "selected" 0.0;
+                               inherit, "default" 0.0;
+                               image.normal, ACTION_LOCK_SEL_PNG;
+                       }
+                       description {
+                               state, "disable" 0.0;
+                               inherit, "default" 0.0;
+                               image.normal, ACTION_LOCK_DIS_PNG;
+                       }
+               }
+       }
+}
+
+group {
+       name, "elm/button/base/style.action.menu.share.button";
+       inherit, "elm/button/base/style.action.menu.button";
+       data.item, "focus_highlight" "on";
+       images {
+               image, ACTION_SHARE_NOR_PNG COMP;
+               image, ACTION_SHARE_FOC_PNG COMP;
+               image, ACTION_SHARE_SEL_PNG COMP;
+               image, ACTION_SHARE_DIS_PNG COMP;
+       }
+       parts {
+               part {
+                       name, "part.icon";
+                       type, IMAGE;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               rel1 {
+                                       to, "part.icon.bg";
+                                       relative, 0.5 0.5;
+                               }
+                               rel2 {
+                                       to, "part.icon.bg";
+                                       relative, 0.5 0.5;
+                               }
+                               align, 0.5 0.5;
+                               fixed, 1 1;
+                               min, 60 60;
+                               image.normal, ACTION_SHARE_NOR_PNG;
+                       }
+                       description {
+                               state, "focused" 0.0;
+                               inherit, "default" 0.0;
+                               image.normal, ACTION_SHARE_FOC_PNG;
+                       }
+                       description {
+                               state, "selected" 0.0;
+                               inherit, "default" 0.0;
+                               image.normal, ACTION_SHARE_SEL_PNG;
+                       }
+                       description {
+                               state, "disable" 0.0;
+                               inherit, "default" 0.0;
+                               image.normal, ACTION_SHARE_DIS_PNG;
+                       }
                }
        }
 }
index f260b05..4176a0c 100644 (file)
@@ -15,6 +15,7 @@
 
 #include <Elementary.h>
 #include <viewmgr.h>
+#include <inputmgr.h>
 #include <app_debug.h>
 
 #include "define.h"
@@ -23,7 +24,7 @@
 struct _priv {
        Evas_Object *win;
        Evas_Object *base;
-       Evas_Object *box;
+       Evas_Object *live_btn;
        Evas_Object *menu_btn[COUNT_ACTION];
 };
 
@@ -34,14 +35,35 @@ const char *str_action[] = {
        NULL
 };
 
-/* 'Lock' and 'Share' is not supported now, so the disable image is used. */
-const char *str_action_icon_png[] = {
-       ACTION_FAV_NOR_PNG,
-       ACTION_LOCK_DIS_PNG,
-       ACTION_SHARE_DIS_PNG,
+const char *style_action[] = {
+       STYLE_ACTION_MENU_FAV_BTN,
+       STYLE_ACTION_MENU_LOCK_BTN,
+       STYLE_ACTION_MENU_SHARE_BTN,
        NULL
 };
 
+static void _mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj,
+               Evas_Event_Mouse_Move *ev)
+{
+       if (!obj) {
+               _ERR("Invalid argument.");
+               return;
+       }
+
+       if (!elm_object_focus_get(obj))
+               elm_object_focus_set(obj, EINA_TRUE);
+}
+
+static input_handler _livetv_input_handler = {
+       .mouse_move = _mouse_move_cb
+       /* It will be implemented later. */
+};
+
+static input_handler _action_input_handler = {
+       .mouse_move = _mouse_move_cb
+       /* It will be implemented later. */
+};
+
 static bool _draw_top_area(struct _priv *priv)
 {
        Evas_Object *btn;
@@ -58,12 +80,16 @@ static bool _draw_top_area(struct _priv *priv)
                return false;
        }
 
+       inputmgr_add_callback(btn, 0, &_livetv_input_handler, priv);
+
+       priv->live_btn = btn;
+
        return true;
 }
 
 static bool _draw_menu_area(struct _priv *priv)
 {
-       Evas_Object *box, *btn, *img;
+       Evas_Object *box, *btn;
        int i;
 
        if (!priv || !priv->base) {
@@ -79,34 +105,32 @@ static bool _draw_menu_area(struct _priv *priv)
 
        for (i = 0; i < COUNT_ACTION; i++) {
                btn = utils_add_button(priv->base, NULL, str_action[i],
-                               STYLE_ACTION_MENU_BTN);
+                               style_action[i]);
                if (!btn) {
                        _ERR("Add button failed.");
                        evas_object_del(box);
                        return false;
                }
 
-               img = elm_image_add(btn);
-               if (!img) {
-                       _ERR("elm_image_add failed.");
-                       evas_object_del(box);
-                       return false;
-               }
-
-               elm_image_file_set(img, str_action_icon_png[i], NULL);
-               evas_object_show(img);
+               inputmgr_add_callback(btn, i, &_action_input_handler, priv);
 
-               elm_object_part_content_set(btn, NULL, img);
+               /* 'Lock' and 'Share' is not supported, so emit disable. */
+               if (i != 0)
+                       elm_object_signal_emit(btn,
+                                       SIG_DISABLE, SRC_ACTION_BTN);
 
                elm_box_pack_end(box, btn);
 
                priv->menu_btn[i] = btn;
        }
 
+       /* 'Favorite' can only be focused now. */
+       elm_object_focus_next_object_set(priv->menu_btn[0],
+                       priv->menu_btn[0], ELM_FOCUS_LEFT);
        elm_object_focus_next_object_set(priv->menu_btn[0],
-                       priv->menu_btn[COUNT_ACTION - 1], ELM_FOCUS_LEFT);
-       elm_object_focus_next_object_set(priv->menu_btn[COUNT_ACTION - 1],
                        priv->menu_btn[0], ELM_FOCUS_RIGHT);
+       elm_object_focus_next_object_set(priv->live_btn, priv->menu_btn[0],
+                       ELM_FOCUS_DOWN);
 
        return true;
 }
@@ -194,6 +218,8 @@ static void _show(void *data)
 
        if (priv->base)
                evas_object_show(priv->base);
+
+       elm_object_focus_set(priv->live_btn, EINA_TRUE);
 }
 
 static void _hide(void *data)