/* 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"
#define STATE_NORMAL 0
#define STATE_SELECTED 1
+#define STATE_DISABLE 2
group {
name, "elm/button/base/style.menu.button";
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 {
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 {
align, 0.5 0.0;
fixed, 0 1;
}
+ description {
+ state, "disable" 0.0;
+ inherit, "default" 0.0;
+ color, 194 194 194 127;
+ }
}
part {
align, 0.0 0.5;
fixed, 1 0;
}
+ description {
+ state, "disable" 0.0;
+ inherit, "default" 0.0;
+ color, 194 194 194 127;
+ }
}
part {
align, 0.5 1.0;
fixed, 0 1;
}
+ description {
+ state, "disable" 0.0;
+ inherit, "default" 0.0;
+ color, 194 194 194 127;
+ }
}
part {
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);
+ }
}
}
}
group {
name, "elm/button/base/style.action.menu.button";
data.item, "focus_highlight" "on";
+ script {
+ public cur_state;
+ }
+
parts {
part {
name, "part.bg";
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 {
}
part {
- name, "elm.swallow.content";
- type, SWALLOW;
+ name, "part.icon";
+ type, IMAGE;
scale, 1;
description {
state, "default" 0.0;
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 {
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;
+ }
}
}
}
#include <Elementary.h>
#include <viewmgr.h>
+#include <inputmgr.h>
#include <app_debug.h>
#include "define.h"
struct _priv {
Evas_Object *win;
Evas_Object *base;
- Evas_Object *box;
+ Evas_Object *live_btn;
Evas_Object *menu_btn[COUNT_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;
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) {
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;
}
if (priv->base)
evas_object_show(priv->base);
+
+ elm_object_focus_set(priv->live_btn, EINA_TRUE);
}
static void _hide(void *data)