support mouse handling to enter user edit view from user list 16/44916/1 accepted/tizen/tv/20150730.014448 submit/tizen/20150729.122235
authorSoohye Shin <soohye.shin@samsung.com>
Wed, 29 Jul 2015 10:13:00 +0000 (19:13 +0900)
committerSoohye Shin <soohye.shin@samsung.com>
Wed, 29 Jul 2015 10:13:00 +0000 (19:13 +0900)
Change-Id: I1a79ee5f841cb0e76af35be3f7ee19f647d8c01c
Signed-off-by: Soohye Shin <soohye.shin@samsung.com>
edje/view/baritem.edc
edje/view/user.edc
include/defs.h
src/view/view_user.c

index 5cf3693..805ec34 100644 (file)
@@ -158,6 +158,18 @@ group {
                                visible, 1;
                        }
                }
+               part {
+                       name, "click_item";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               rel1.to, "pad";
+                               rel2.to, "pad";
+                               fixed, 1 1;
+                               color, 0 0 0 0;
+                       }
+               }
        }
        programs {
                program {
@@ -256,5 +268,11 @@ group {
                                        set_state(PART:"mask_focus", "show", 0.0);
                        }
                }
+               program {
+                       name, "item,clicked";
+                       source, "click_item";
+                       signal, "mouse,clicked,1";
+                       action, SIGNAL_EMIT SIG_CLICK_ITEM SRC_EDJE;
+               }
        }
 }
index 0566560..b7a8c1e 100644 (file)
@@ -363,5 +363,11 @@ group {
                        target, "text";
                        target, "arrow";
                }
+               program {
+                       name, "arrow,clicked";
+                       source, "arrow";
+                       signal, "mouse,clicked,1";
+                       action, SIGNAL_EMIT SIG_CLICK_ARROW SRC_EDJE;
+               }
        }
 }
index bc98de7..73d131a 100644 (file)
 #define SIG_SHOW "sig.show"
 #define SIG_HIDE "sig.hide"
 #define SIG_HIDE_DONE "sig.hide.done"
+#define SIG_CLICK_ITEM "sig.click.item"
+#define SIG_CLICK_ARROW "sig.click.arrow"
 
 #define TITLE_WIDTH "title.width"
 
index 22ad054..2557852 100644 (file)
@@ -170,33 +170,12 @@ static void _key_down(int id, void *data, Evas *e, Evas_Object *obj,
 static void _mouse_down(int id, void *data, Evas *e, Evas_Object *obj,
                Evas_Event_Mouse_Down *ev)
 {
-       struct _priv *priv;
-
        if (!data) {
                _ERR("Invalid argument");
                return;
        }
 
        switch (id) {
-       case INPUT_HANDLER_TYPE_BASE:
-               priv = data;
-               if (priv->foc->di->action == ITEM_SELECT_ACTION_POP) {
-                       elm_object_signal_emit(priv->base, SIG_HIDE,
-                                       SRC_PROG);
-                               return;
-               }
-
-               if ((priv->foc->di->action == ITEM_SELECT_ACTION_PUSH)
-                               && (eina_list_count(priv->list)
-                               >= MAX_USER_COUNT)) {
-                       _add_popup(priv);
-                       return;
-               }
-
-               viewmgr_update_view(VIEW_USER_EDIT, UPDATE_TYPE_EDIT,
-                               NULL);
-               datamgr_select_item(priv->dm, priv->foc->di);
-               break;
        case INPUT_HANDLER_TYPE_BUTTON:
                inputmgr_remove_callback(obj, &handler);
                evas_object_del(data);
@@ -260,6 +239,38 @@ static Evas_Object *_create(Evas_Object *win, void *data)
        return base;
 }
 
+static void _arrow_clicked(void *data, Evas_Object *obj, const char *emission,
+               const char *source)
+{
+       struct _priv *priv = data;
+
+       if (priv->foc->di->action == ITEM_SELECT_ACTION_PUSH)
+               return;
+
+       viewmgr_update_view(VIEW_USER_EDIT, UPDATE_TYPE_EDIT, priv->foc->di);
+       viewmgr_push_view(VIEW_USER_EDIT);
+}
+
+static void _item_clicked(void *data, Evas_Object *obj, const char *emission,
+               const char *source)
+{
+       struct _priv *priv = data;
+
+       if (priv->foc->di->action == ITEM_SELECT_ACTION_POP) {
+               elm_object_signal_emit(priv->base, SIG_HIDE, SRC_PROG);
+                       return;
+       }
+
+       if ((priv->foc->di->action == ITEM_SELECT_ACTION_PUSH)
+                       && (eina_list_count(priv->list) >= MAX_USER_COUNT)) {
+               _add_popup(priv);
+               return;
+       }
+
+       viewmgr_update_view(VIEW_USER_EDIT, UPDATE_TYPE_EDIT, NULL);
+       datamgr_select_item(priv->dm, priv->foc->di);
+}
+
 static struct _bar_item *_pack_bar_item(struct _priv *priv, Evas_Object *box,
                struct datamgr_item *di)
 {
@@ -289,6 +300,8 @@ static struct _bar_item *_pack_bar_item(struct _priv *priv, Evas_Object *box,
                                PART_BAR_ITEM_TITLE_FOCUS);
                if (!focus_lbl)
                        goto err;
+
+               elm_object_signal_callback_add(eo, SIG_CLICK_ARROW, SRC_EDJE, _arrow_clicked, priv);
        } else {
                eo = utils_add_layout(box, GRP_BAR_ITEM, true, NULL);
                if (!eo) {
@@ -317,6 +330,7 @@ static struct _bar_item *_pack_bar_item(struct _priv *priv, Evas_Object *box,
 
        evas_object_size_hint_align_set(eo, 0.5, 0.0);
        inputmgr_add_callback(eo, INPUT_HANDLER_TYPE_EO, &handler, bi);
+       elm_object_signal_callback_add(eo, SIG_CLICK_ITEM, SRC_EDJE, _item_clicked, priv);
        elm_box_pack_end(box, eo);
        evas_object_show(eo);