summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJehun Lim <jehun.lim@samsung.com>2015-12-04 05:27:35 (GMT)
committerJehun Lim <jehun.lim@samsung.com>2015-12-07 04:20:12 (GMT)
commit1369e843cb53187d125ff530e5f6540028c96cbc (patch)
treeb50bfb747b59dbdf6095498f4e101b18db496904
parent73f71371d7592c0aa5885b8929cb32d203a7dc4f (diff)
downloadair_mediahub-1369e843cb53187d125ff530e5f6540028c96cbc.zip
air_mediahub-1369e843cb53187d125ff530e5f6540028c96cbc.tar.gz
air_mediahub-1369e843cb53187d125ff530e5f6540028c96cbc.tar.bz2
base: add source buttonrefs/changes/51/53451/1
Change-Id: I68b4d7a97ae94bfded5189a2d0effcd895e16baf Signed-off-by: Jehun Lim <jehun.lim@samsung.com>
-rw-r--r--include/view/base.h1
-rw-r--r--res/edc/view/base.edc32
-rw-r--r--src/view/base.c71
3 files changed, 101 insertions, 3 deletions
diff --git a/include/view/base.h b/include/view/base.h
index 22d7073..06b5959 100644
--- a/include/view/base.h
+++ b/include/view/base.h
@@ -29,6 +29,7 @@
#define PART_BASE_MENU_AREA "part.base_menu_area"
#define PART_BASE_THUMBNAIL_AREA "part.base_thumbnail_area"
#define PART_BASE_VIEW_MODE "part.base_view_mode"
+#define PART_BASE_SOURCE "part.base_source"
#define PART_BASE_CONTENT_INFO "part.base_content_info"
#define PART_ITEM_TITLE "part.item_title"
diff --git a/res/edc/view/base.edc b/res/edc/view/base.edc
index 9b4f346..e0290e3 100644
--- a/res/edc/view/base.edc
+++ b/res/edc/view/base.edc
@@ -221,6 +221,38 @@ group {
color: COLOR_TEXT_INDEX;
}
}
+ part {
+ name: "padding_source";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "bottom_area";
+ relative: 1.0 0.0;
+ }
+ rel2.to: "bottom_area";
+ min: 62 0;
+ align: 1.0 0.5;
+ fixed: 1 0;
+ }
+ }
+ part {
+ name: PART_BASE_SOURCE;
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.to: "padding_source";
+ rel2 {
+ to: "padding_source";
+ relative: 0.0 1.0;
+ }
+ min: 218 0;
+ align: 1.0 0.5;
+ fixed: 1 0;
+ }
+ }
/* CURTAIN */
part {
diff --git a/src/view/base.c b/src/view/base.c
index 4aa3680..111b3ef 100644
--- a/src/view/base.c
+++ b/src/view/base.c
@@ -44,7 +44,8 @@
enum _object_type {
BASE_MENU_BTN = 0,
- BASE_VIEW_BTN
+ BASE_VIEW_BTN,
+ BASE_SOURCE_BTN
};
enum _layout_type {
@@ -59,6 +60,7 @@ struct _priv {
Evas_Object *base;
Evas_Object *menu_btn[E_LAYOUT_MAX];
Evas_Object *view_btn;
+ Evas_Object *source_btn;
Evas_Object *focused_btn;
@@ -73,6 +75,7 @@ struct _priv {
int current_layout;
int view_mode[E_LAYOUT_MAX];
+ int source_type;
};
const char *view_mode_movie[] = {
@@ -97,6 +100,11 @@ const char *view_mode_music[] = {
"Folder"
};
+const char *source[] = {
+ "TV",
+ "USB",
+};
+
struct _menu_item {
const char *name;
const char *layout_id;
@@ -142,6 +150,8 @@ static void _set_current_layout(struct _priv *priv, int layout)
elm_object_text_set(priv->view_btn,
g_menu_item[layout].text_view_mode[mode]);
+ elm_object_text_set(priv->source_btn, source[priv->source_type]);
+
if (priv->focused_btn)
elm_object_signal_emit(priv->focused_btn,
SIG_BTN_UNSELECTED, SIG_SOURCE_SRC);
@@ -197,6 +207,11 @@ static void _view_selected_cb(void *data, int mode)
priv->view_mode[cur] = mode;
}
+static void _source_selected_cb(void *data, int mode)
+{
+ /* It will be implemented later */
+}
+
static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
Evas_Event_Key_Down *ev)
{
@@ -274,6 +289,30 @@ static void _view_btn_clicked(struct _priv *priv)
priv->cpopup = cpopup;
}
+static void _source_btn_clicked(struct _priv *priv)
+{
+ struct ctxpopup *cpopup;
+ int x, y, w, h;
+
+ elm_object_signal_emit(priv->source_btn, SIG_BTN_SELECTED,
+ SIG_SOURCE_SRC);
+
+ cpopup = ctxpopup_create(priv->base, STYLE_CTXPOPUP_VIEW_MODE,
+ STYLE_BTN_VIEW_OPTION, source, ARRAY_SIZE(source),
+ priv->source_type);
+ if (!cpopup) {
+ _ERR("failed to create ctxpopup");
+ return;
+ }
+
+ ctxpopup_set_callback(cpopup, _source_selected_cb, priv);
+
+ evas_object_geometry_get(priv->source_btn, &x, &y, &w, &h);
+ ctxpopup_show(cpopup, x + (w / 2), y);
+
+ priv->cpopup = cpopup;
+}
+
static void _clicked_cb(int id, void *data, Evas_Object *obj)
{
struct _priv *priv;
@@ -289,6 +328,9 @@ static void _clicked_cb(int id, void *data, Evas_Object *obj)
case BASE_VIEW_BTN:
_view_btn_clicked(priv);
break;
+ case BASE_SOURCE_BTN:
+ _source_btn_clicked(priv);
+ break;
default:
break;
}
@@ -634,13 +676,33 @@ static bool _draw_view_mode_btn(struct _priv *priv)
elm_object_part_content_set(priv->base, PART_BASE_VIEW_MODE, btn);
- elm_object_focus_next_object_set(btn, btn, ELM_FOCUS_RIGHT);
-
priv->view_btn = btn;
return true;
}
+static bool _draw_source_btn(struct _priv *priv)
+{
+ Evas_Object *btn;
+
+ btn = util_add_button(priv->base, STYLE_BTN_VIEW_MODE, NULL);
+ if (!btn) {
+ _ERR("failed to add button object");
+ return false;
+ }
+
+ inputmgr_add_callback(btn, BASE_SOURCE_BTN, &handler, priv);
+
+ elm_object_part_content_set(priv->base, PART_BASE_SOURCE, btn);
+
+ priv->source_btn = btn;
+
+ elm_object_focus_next_object_set(btn, priv->view_btn, ELM_FOCUS_LEFT);
+ elm_object_focus_next_object_set(priv->view_btn, btn, ELM_FOCUS_RIGHT);
+
+ return true;
+}
+
static bool _draw_items(struct _priv *priv)
{
if (!priv)
@@ -655,6 +717,9 @@ static bool _draw_items(struct _priv *priv)
if (!_draw_view_mode_btn(priv))
return false;
+ if (!_draw_source_btn(priv))
+ return false;
+
return true;
}