diff options
-rw-r--r-- | data/view/square_view.edc | 137 | ||||
-rw-r--r-- | include/define.h | 6 | ||||
-rw-r--r-- | src/main.c | 1 | ||||
-rw-r--r-- | src/square_view.c | 76 |
4 files changed, 154 insertions, 66 deletions
diff --git a/data/view/square_view.edc b/data/view/square_view.edc index a290cb5..f0243f7 100644 --- a/data/view/square_view.edc +++ b/data/view/square_view.edc @@ -68,39 +68,18 @@ group { visible, 0; } part { - name, PART_NOTIFICATION_TITLE_BG; - type, RECT; + name, PART_NOTIFICATION_LAUNCH; + type, SWALLOW; scale, 1; description { state, "default" 0.0; rel1.relative, 0.0 0.0; rel2.relative, 0.0 0.0; - color, 48 48 48 255; align, 0.0 0.0; min, 376 66; fixed, 1 1; visible, 1; } - part { - name, PART_NOTIFICATION_TITLE; - type, TEXT; - scale, 1; - description { - state, "default" 0.0; - text { - font, FONT_LIGHT; - text, STR_SQUARE_TITLE; - size, 36; - align, 0.5 0.5; - min, 1 1; - ellipsis, -1; - } - color, 255 255 255 179; - align, 0.0 0.0; - fixed, 1 1; - visible, 1; - } - } } part { name, PART_NOTIFICATION_CLEAR; @@ -122,11 +101,11 @@ group { description { state, "default" 0.0; rel1 { - to_y, PART_NOTIFICATION_TITLE; + to_y, PART_NOTIFICATION_LAUNCH; relative, 0.0 1.0; } rel2 { - to_y, PART_NOTIFICATION_TITLE; + to_y, PART_NOTIFICATION_LAUNCH; relative, 1.0 1.0; } min, 0 62; @@ -687,6 +666,98 @@ group { } group { + name: GRP_NOTIFICATION_LAUNCH; + parts { + part { + name, "border_bg"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + color, 48 48 48 255; + align, 0.5 0.5; + min, 376 66; + fixed, 1 1; + } + description { + state, "focused" 0.0; + inherit, "default" 0.0; + color, 64 171 233 255; + } + } + part { + name, "bg"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + rel1 { + to, "border_bg"; + relative, 0.5 0.5; + } + rel2 { + to, "border_bg"; + relative, 0.5 0.5; + } + color, 48 48 48 255; + align, 0.5 0.5; + min, 368 58; + fixed, 1 1; + } + } + part { + name, PART_TITLE; + type, TEXT; + scale, 1; + description { + state, "default" 0.0; + text { + font, FONT_LIGHT; + text, STR_SQUARE_TITLE; + size, 36; + align, 0.5 0.5; + min, 1 1; + ellipsis, -1; + } + color, 255 255 255 179; + align, 0.0 0.0; + fixed, 1 1; + visible, 1; + } + } + } + programs { + program { + name, "disabled"; + signal, SIGNAL_DISABLED; + source, SOURCE_ELM; + action, STATE_SET "disabled" 0.0; + target, "border_bg"; + target, "bg"; + target, PART_TITLE; + } + program { + name, "focused"; + signal, SIGNAL_FOCUSED; + source, SOURCE_ELM; + action, STATE_SET "focused" 0.0; + target, "border_bg"; + target, "bg"; + target, PART_TITLE; + } + program { + name, "unfocused"; + signal, SIGNAL_UNFOCUSED; + source, SOURCE_ELM; + action, STATE_SET "default" 0.0; + target, "border_bg"; + target, "bg"; + target, PART_TITLE; + } + } +} + +group { name: GRP_NOTIFICATION_CLEAR; images { image, "btn_noti_list_clearall_dis.png" COMP; @@ -712,7 +783,7 @@ group { } } part { - name, PART_NOTIFICATION_CLEAR_BG; + name, "bg"; type, RECT; scale, 1; description { @@ -732,7 +803,7 @@ group { } } part { - name, PART_NOTIFICATION_CLEAR_ICON; + name, PART_ICON; type, IMAGE; scale, 1; description { @@ -761,8 +832,8 @@ group { source, SOURCE_ELM; action, STATE_SET "disabled" 0.0; target, "border_bg"; - target, PART_NOTIFICATION_CLEAR_BG; - target, PART_NOTIFICATION_CLEAR_ICON; + target, "bg"; + target, PART_ICON; } program { name, "focused"; @@ -770,8 +841,8 @@ group { source, SOURCE_ELM; action, STATE_SET "focused" 0.0; target, "border_bg"; - target, PART_NOTIFICATION_CLEAR_BG; - target, PART_NOTIFICATION_CLEAR_ICON; + target, "bg"; + target, PART_ICON; } program { name, "unfocused"; @@ -779,8 +850,8 @@ group { source, SOURCE_ELM; action, STATE_SET "default" 0.0; target, "border_bg"; - target, PART_NOTIFICATION_CLEAR_BG; - target, PART_NOTIFICATION_CLEAR_ICON; + target, "bg"; + target, PART_ICON; } } } diff --git a/include/define.h b/include/define.h index 691571e..fc67269 100644 --- a/include/define.h +++ b/include/define.h @@ -45,8 +45,7 @@ #define SQUARE_VIEW "SQUARE_VIEW" #define GRP_SQUARE_VIEW "grp.square.view" #define PART_NOTIFICATION "part.notification" -#define PART_NOTIFICATION_TITLE "part.notification.title" -#define PART_NOTIFICATION_TITLE_BG "part.notification.title.bg" +#define PART_NOTIFICATION_LAUNCH "part.notification.launch" #define PART_NOTIFICATION_CLEAR "part.notification.clear" #define PART_NOTIFICATION_LIST_TITLE "part.notification.list_title" #define PART_NOTIFICATION_LIST "part.notification.list" @@ -62,8 +61,7 @@ #define GRP_NOTIFICATION_ITEM "grp.notification.item" #define PART_NOTIFICATION_ITEM_TITLE "part.notification.item.title" +#define GRP_NOTIFICATION_LAUNCH "grp.notification.launch" #define GRP_NOTIFICATION_CLEAR "grp.notification.clear" -#define PART_NOTIFICATION_CLEAR_BG "part.notification.clear.bg" -#define PART_NOTIFICATION_CLEAR_ICON "part.notification.clear.icon" #endif /* __AIR_INFOSQUARE_DEFINE_H__*/ @@ -82,6 +82,7 @@ static bool _create(void *data) return false; } + elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_IN); viewmgr_add_view(notification_view_get_vclass(), NULL); viewmgr_add_view(square_view_get_vclass(), NULL); diff --git a/src/square_view.c b/src/square_view.c index b898884..4fda86b 100644 --- a/src/square_view.c +++ b/src/square_view.c @@ -31,27 +31,28 @@ #define NOTIFICATION_ITEM_PADDING_Y 20 #define SIG_CHILD_REMOVED "child,removed" -static void _clear_key_up_cb(int id, void *data, +static void _button_key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, Evas_Event_Key_Up *ev); -static void _clear_clicked_cb(int id, void *data, Evas_Object *obj); +static void _button_clicked_cb(int id, void *data, Evas_Object *obj); static void _child_removed_cb(void *data, Evas_Object *obj, void *ei); -static void _mouse_move_cb(int id, void *data, Evas *e, - Evas_Object *obj, Evas_Event_Mouse_Move *ev); struct _priv { Evas_Object *base; Evas_Object *list; Evas_Object *clear_btn; + Evas_Object *launch_btn; Ecore_Timer *clock_timer; }; -static input_handler clear_handler = { - .key_up = _clear_key_up_cb, - .clicked = _clear_clicked_cb +enum _button_id { + BUTTON_LAUNCH, + BUTTON_CLEAR, + BUTTON_NOTIFICATION }; -static input_handler focus_handler = { - .mouse_move = _mouse_move_cb +static input_handler button_handler = { + .key_up = _button_key_up_cb, + .clicked = _button_clicked_cb }; static void _print_user_message(struct _priv *priv) @@ -156,8 +157,6 @@ static void _update_list(struct _priv *priv) evas_object_show(item); - inputmgr_add_callback(item, 0, &focus_handler, NULL); - noti_list = notification_list_remove(noti_list, noti); } } else { @@ -273,9 +272,18 @@ static Evas_Object *_create(Evas_Object *win, void *data) elm_object_part_content_set(priv->base, PART_NOTIFICATION_CLEAR, priv->clear_btn); evas_object_show(priv->clear_btn); + inputmgr_add_callback(priv->clear_btn, + BUTTON_CLEAR, &button_handler, NULL); - inputmgr_add_callback(priv->clear_btn, 0, &focus_handler, NULL); - inputmgr_add_callback(priv->clear_btn, 0, &clear_handler, NULL); + priv->launch_btn = elm_layout_add(priv->base); + elm_layout_file_set(priv->launch_btn, + EDJEFILE, GRP_NOTIFICATION_LAUNCH); + elm_object_focus_allow_set(priv->launch_btn, EINA_TRUE); + elm_object_part_content_set(priv->base, + PART_NOTIFICATION_LAUNCH, priv->launch_btn); + evas_object_show(priv->launch_btn); + inputmgr_add_callback(priv->launch_btn, + BUTTON_LAUNCH, &button_handler, NULL); viewmgr_set_view_data(SQUARE_VIEW, priv); @@ -339,31 +347,43 @@ static void _destroy(void *view_data) priv = (struct _priv *) view_data; stop_clock_timer(priv); - inputmgr_remove_callback(priv->clear_btn, &clear_handler); - inputmgr_remove_callback(priv->clear_btn, &focus_handler); + inputmgr_remove_callback(priv->clear_btn, &button_handler); + inputmgr_remove_callback(priv->launch_btn, &button_handler); evas_object_del(priv->base); free(priv); } -static void _clear_key_up_cb(int id, void *data, Evas *e, +static void _button_key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, Evas_Event_Key_Up *ev) { - if (!strcmp(ev->keyname, KEY_ENTER)) - notification_delete_all(NOTIFICATION_TYPE_NOTI); -} - -static void _clear_clicked_cb(int id, void *data, Evas_Object *obj) -{ - notification_delete_all(NOTIFICATION_TYPE_NOTI); + switch (id) { + case BUTTON_CLEAR: + if (!strcmp(ev->keyname, KEY_ENTER)) + notification_delete_all(NOTIFICATION_TYPE_NOTI); + break; + case BUTTON_LAUNCH: + if (!strcmp(ev->keyname, KEY_ENTER)) + viewmgr_push_view(NOTIFICATION_VIEW); + break; + case BUTTON_NOTIFICATION: + break; + } } -static void _mouse_move_cb(int id, void *data, Evas *e, - Evas_Object *obj, Evas_Event_Mouse_Move *ev) +static void _button_clicked_cb(int id, void *data, Evas_Object *obj) { - if (!elm_object_focus_get(obj)) - elm_object_focus_set(obj, EINA_TRUE); + switch (id) { + case BUTTON_CLEAR: + notification_delete_all(NOTIFICATION_TYPE_NOTI); + break; + case BUTTON_LAUNCH: + viewmgr_push_view(NOTIFICATION_VIEW); + break; + case BUTTON_NOTIFICATION: + break; + } } static void _child_removed_cb(void *data, Evas_Object *obj, void *ei) @@ -377,8 +397,6 @@ static void _child_removed_cb(void *data, Evas_Object *obj, void *ei) noti = evas_object_data_del(item, KEY_NOTI); if (noti) notification_free(noti); - - inputmgr_remove_callback(item, &focus_handler); } static view_class vclass = { |