#define COLOR_ITEM_SELECTED 64 136 211 255
#define COLOR_ITEM_BAR 190 190 190 255
#define COLOR_ITEM_BORDER 194 194 194 255
+#define COLOR_ITEM_DIVIDER 224 224 224 255
#define COLOR_LIST_BG 244 244 244 255
/* part */
#define SIG_ITEM_FOCUSED "item,focused"
#define SIG_ITEM_SELECTED "item,selected"
#define SIG_ITEM_UNSELECTED "item,unselected"
+#define SIG_ITEM_DISABLED "item,disabled"
#define SIG_ELM_UNFOCUSED "elm,state,unfocused"
#define SIG_SOURCE_EDC "edc"
#define SIG_SOURCE_ELM "elm"
/* style */
#define STYLE_BTN_LIVETV "action_btn_livetv"
+#define STYLE_BTN_FAVORITE "action_btn_favorite"
+#define STYLE_BTN_DELETE "action_btn_delete"
+#define STYLE_BTN_EMPTY "action_btn_empty"
+
+/* image */
+#define IMAGE_ACTION_FAVORITE_NOR "/btn_menu_favorite_nor.png"
+#define IMAGE_ACTION_FAVORITE_FOC "/btn_menu_favorite_foc.png"
+#define IMAGE_ACTION_FAVORITE_SEL "/btn_menu_favorite_sel.png"
+#define IMAGE_ACTION_FAVORITE_DIS "/btn_menu_favorite_dis.png"
+
+#define IMAGE_ACTION_DELETE_NOR "/btn_menu_del_nor.png"
+#define IMAGE_ACTION_DELETE_FOC "/btn_menu_del_foc.png"
+#define IMAGE_ACTION_DELETE_SEL "/btn_menu_del_sel.png"
+#define IMAGE_ACTION_DELETE_DIS "/btn_menu_del_dis.png"
+
#endif /* __AIR_MEDIAHUB_VIEW_ACTION_MENU_H__ */
}
}
part {
+ name: "menu_divider_top";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "tv_btn_area";
+ relative: 0.0 1.0;
+ }
+ rel2.to: "tv_btn_area";
+ min: 0 1;
+ align: 0.5 0.0;
+ color: COLOR_ITEM_DIVIDER;
+ fixed: 0 1;
+ }
+ }
+ part {
name: PART_ACTION_MENU_AREA;
type: SWALLOW;
scale: 1;
relative: 0.0 1.0;
}
rel2.to: "tv_btn_area";
- min: 0 251;
+ min: 0 126;
align: 0.5 0.0;
fixed: 0 1;
}
}
part {
- name: "padding_favorite_title";
- type: SPACER;
+ name: "menu_divider_bottom";
+ type: RECT;
scale: 1;
description {
state: "default" 0.0;
relative: 0.0 1.0;
}
rel2.to: PART_ACTION_MENU_AREA;
- min: 0 40;
- align: 0.5 0.0;
+ min: 0 1;
+ align: 0.5 1.0;
+ color: COLOR_ITEM_DIVIDER;
fixed: 0 1;
}
}
part {
+ name: "padding_favorite_title_left";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: PART_ACTION_MENU_AREA;
+ relative: 0.0 1.0;
+ }
+ rel2 {
+ to: PART_ACTION_MENU_AREA;
+ relative: 0.0 1.0;
+ }
+ min: 30 40;
+ align: 0.0 0.0;
+ fixed: 1 1;
+ }
+ }
+ part {
+ name: "padding_favorite_title_right";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: PART_ACTION_MENU_AREA;
+ relative: 1.0 1.0;
+ }
+ rel2.to: PART_ACTION_MENU_AREA;
+ min: 30 40;
+ align: 1.0 0.0;
+ fixed: 1 1;
+ }
+ }
+ part {
name: PART_ACTION_FAVORITE_TITLE;
type: TEXT;
scale: 1;
description {
state: "default" 0.0;
rel1 {
- to: "padding_favorite_title";
+ to: "padding_favorite_title_left";
+ relative: 1.0 1.0;
+ }
+ rel2 {
+ to: "padding_favorite_title_right";
relative: 0.0 1.0;
}
- rel2.to: "padding_favorite_title";
+ text {
+ font: FONT_LIGHT;
+ size: 32;
+ align: 0.0 0.5;
+ }
min: 0 32;
align: 0.5 0.0;
+ color: COLOR_TEXT_INDEX;
fixed: 0 1;
}
}
to: "padding_favorite_area";
relative: 0.0 1.0;
}
- rel2.to: "bg";
+ rel2 {
+ to_x: "padding_favorite_area";
+ to_y: "bg";
+ }
}
}
}
#define STATE_NORMAL 0
#define STATE_FOCUSED 1
#define STATE_SELECTED 2
+#define STATE_DISABLED 3
#define STATE_SHOW 0
#define STATE_HIDE 1
}
}
}
+
+group {
+ name: "elm/button/base/action_btn_favorite";
+ data.item: "focus_highlight" "on";
+ images {
+ image: IMAGE_ACTION_FAVORITE_NOR COMP;
+ image: IMAGE_ACTION_FAVORITE_FOC COMP;
+ image: IMAGE_ACTION_FAVORITE_SEL COMP;
+ image: IMAGE_ACTION_FAVORITE_DIS COMP;
+ }
+ script {
+ public cur_state;
+ }
+ parts {
+ part {
+ name: "bg";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 125 124;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: COLOR_ITEM_FOCUS;
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ }
+ }
+ part {
+ name: "divider_right";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "bg";
+ relative: 1.0 0.0;
+ }
+ rel2.to: "bg";
+ min: 1 0;
+ align: 1.0 0.5;
+ color: COLOR_ITEM_DIVIDER;
+ fixed: 1 0;
+ }
+ }
+ part {
+ name: "padding_icon_top";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.to: "bg";
+ rel2 {
+ to: "bg";
+ relative: 1.0 0.0;
+ }
+ min: 0 14;
+ align: 0.5 0.0;
+ fixed: 0 1;
+ }
+ }
+ part {
+ name: "padding_icon_bottom";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "bg";
+ relative: 0.0 1.0;
+ }
+ rel2.to: "bg";
+ min: 0 50;
+ align: 0.5 1.0;
+ fixed: 0 1;
+ }
+ }
+ part {
+ name: "bg_menu_icon";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "padding_icon_top";
+ relative: 0.0 1.0;
+ }
+ rel2 {
+ to: "padding_icon_bottom";
+ relative: 1.0 0.0;
+ }
+ }
+ }
+ part {
+ name: "menu_icon";
+ type: IMAGE;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "bg_menu_icon";
+ relative: 0.5 0.5;
+ }
+ rel2 {
+ to: "bg_menu_icon";
+ relative: 0.5 0.5;
+ }
+ image.normal: IMAGE_ACTION_FAVORITE_NOR;
+ min: 60 60;
+ align: 0.5 0.5;
+ fixed: 1 1;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ image.normal: IMAGE_ACTION_FAVORITE_FOC;
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ image.normal: IMAGE_ACTION_FAVORITE_SEL;
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ image.normal: IMAGE_ACTION_FAVORITE_DIS;
+ }
+ }
+ part {
+ name: "padding_text";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.to: "padding_icon_bottom";
+ rel2 {
+ to: "padding_icon_bottom";
+ relative: 1.0 0.0;
+ }
+ min: 0 6;
+ align: 0.5 0.5;
+ fixed: 0 1;
+ }
+ }
+ part {
+ name: "elm.text";
+ type: TEXT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "padding_text";
+ relative: 0.0 1.0;
+ }
+ rel2.to: "padding_text";
+ text {
+ font: FONT_LIGHT;
+ size: 20;
+ align: 0.5 0.5;
+ }
+ min: 0 20;
+ align: 0.5 0.0;
+ color: COLOR_TEXT_MENU;
+ fixed: 0 1;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ color: COLOR_TEXT_FOCUS;
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: COLOR_ITEM_SELECTED;
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ color: COLOR_TEXT_DISABLED;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "load";
+ signal: "load";
+ source: "";
+ script {
+ set_int(cur_state, STATE_NORMAL);
+ }
+ }
+ program {
+ name: "go_active";
+ signal: "elm,action,focus";
+ source: "elm";
+ action: STATE_SET "focused" 0.0;
+ target: "bg";
+ target: "menu_icon";
+ target: "elm.text";
+ transition: TRANSITION_FOCUS;
+ }
+ program {
+ name: "go_passive";
+ signal: "elm,action,unfocus";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "bg";
+ target: "menu_icon";
+ target: "elm.text";
+ transition: TRANSITION_FOCUS;
+ }
+ program {
+ name: SIG_ITEM_SELECTED;
+ signal: SIG_ITEM_SELECTED;
+ source: SIG_SOURCE_SRC;
+ action: STATE_SET "selected" 0.0;
+ target: "bg";
+ target: "menu_icon";
+ target: "elm.text";
+ }
+ program {
+ name: SIG_ITEM_DISABLED;
+ signal: SIG_ITEM_DISABLED;
+ source: SIG_SOURCE_SRC;
+ action: STATE_SET "disabled" 0.0;
+ target: "bg";
+ target: "menu_icon";
+ target: "elm.text";
+ }
+ }
+}
+
+group {
+ name: "elm/button/base/action_btn_delete";
+ inherit: "elm/button/base/action_btn_favorite";
+ images {
+ image: IMAGE_ACTION_DELETE_NOR COMP;
+ image: IMAGE_ACTION_DELETE_FOC COMP;
+ image: IMAGE_ACTION_DELETE_SEL COMP;
+ image: IMAGE_ACTION_DELETE_DIS COMP;
+ }
+ parts {
+ part {
+ name: "menu_icon";
+ description {
+ state: "default" 0.0;
+ image.normal: IMAGE_ACTION_DELETE_NOR;
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ image.normal: IMAGE_ACTION_DELETE_FOC;
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ image.normal: IMAGE_ACTION_DELETE_SEL;
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ image.normal: IMAGE_ACTION_DELETE_DIS;
+ }
+ }
+ }
+}
+
+group {
+ name: "elm/button/base/action_btn_empty";
+ inherit: "elm/button/base/action_btn_favorite";
+ parts {
+ part {
+ name: "menu_icon";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ }
+ }
+}
#include <viewmgr.h>
#include "define.h"
+#include "util/util.h"
#define TEXT_LIVETV "Live TV"
+#define MAX_NUM_MENU 4
+
+enum _object_type {
+ ACTION_LIVETV_BTN = 0,
+ ACTION_MENU_BTN
+};
+
struct _priv {
Evas_Object *win;
Evas_Object *base;
Evas_Object *tv_btn;
+ Evas_Object *menu_btn[MAX_NUM_MENU];
+};
+
+struct _menu_info {
+ const char *title;
+ const char *style;
+ Eina_Bool disabled;
+};
+
+static struct _menu_info menu_info[] = {
+ {
+ .title = "Favorite",
+ .style = STYLE_BTN_FAVORITE,
+ .disabled = EINA_FALSE
+ },
+ {
+ .title = "Delete",
+ .style = STYLE_BTN_DELETE,
+ .disabled = EINA_TRUE
+ },
+ {
+ .title = NULL,
+ .style = STYLE_BTN_EMPTY,
+ .disabled = EINA_TRUE
+ },
+ {
+ .title = NULL,
+ .style = STYLE_BTN_EMPTY,
+ .disabled = EINA_TRUE
+ }
};
static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
elm_object_style_set(btn, STYLE_BTN_LIVETV);
elm_object_text_set(btn, TEXT_LIVETV);
- inputmgr_add_callback(btn, 0, &_handler, priv);
+ inputmgr_add_callback(btn, ACTION_LIVETV_BTN, &_handler, priv);
elm_object_part_content_set(priv->base, PART_ACTION_TV_BTN, btn);
evas_object_show(btn);
- elm_object_focus_next_object_set(btn, btn, ELM_FOCUS_UP);
- elm_object_focus_next_object_set(btn, btn, ELM_FOCUS_DOWN);
elm_object_focus_next_object_set(btn, btn, ELM_FOCUS_LEFT);
elm_object_focus_next_object_set(btn, btn, ELM_FOCUS_RIGHT);
return true;
}
+static bool _draw_menu_area(struct _priv *priv)
+{
+ Evas_Object *box, *btn;
+ int i;
+
+ box = util_add_box(priv->base);
+ if (!box) {
+ _ERR("failed to create box object");
+ return false;
+ }
+
+ for (i = 0; i < MAX_NUM_MENU; i++) {
+ btn = elm_button_add(box);
+ if (!btn) {
+ _ERR("failed to create button object");
+ evas_object_del(box);
+ return false;
+ }
+
+ elm_object_style_set(btn, menu_info[i].style);
+ elm_object_text_set(btn, menu_info[i].title);
+
+ if (menu_info[i].disabled) {
+ elm_object_signal_emit(btn, SIG_ITEM_DISABLED,
+ SIG_SOURCE_SRC);
+ elm_object_focus_allow_set(btn, EINA_FALSE);
+ }
+
+ elm_box_pack_end(box, btn);
+
+ evas_object_show(btn);
+
+ inputmgr_add_callback(btn, ACTION_MENU_BTN, &_handler, priv);
+
+ elm_object_focus_next_object_set(btn, btn, ELM_FOCUS_DOWN);
+
+ priv->menu_btn[i] = btn;
+ }
+
+ evas_object_show(box);
+
+ 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[MAX_NUM_MENU - 1],
+ priv->menu_btn[MAX_NUM_MENU - 1],
+ ELM_FOCUS_RIGHT);
+
+ elm_object_part_content_set(priv->base, PART_ACTION_MENU_AREA, box);
+
+ return true;
+}
+
+static bool _draw_items(struct _priv *priv)
+{
+ if (!_draw_livetv_btn(priv)) {
+ _ERR("failed to draw livetv button");
+ return false;
+ }
+
+ if (!_draw_menu_area(priv)) {
+ _ERR("failed to draw menu button");
+ return false;
+ }
+
+ return true;
+}
+
static Evas_Object *_create(Evas_Object *win, void *data)
{
struct _priv *priv;
viewmgr_set_view_data(VIEW_ACTION_MENU, priv);
- if (!_draw_livetv_btn(priv)) {
- _ERR("failed to draw livetv button");
+ if (!_draw_items(priv)) {
+ _ERR("failed to draw items");
free(priv);
return NULL;
}
static void _destroy(void *view_data)
{
struct _priv *priv;
+ int i;
if (!view_data) {
_ERR("failed to get view data");
inputmgr_remove_callback(priv->tv_btn, &_handler);
+ for (i = 0; i < MAX_NUM_MENU; i++)
+ inputmgr_remove_callback(priv->menu_btn[i], &_handler);
+
evas_object_del(priv->base);
free(priv);