Add action menu 94/46994/2
authorjinwoo.shin <jw0227.shin@samsung.com>
Fri, 28 Aug 2015 04:51:20 +0000 (13:51 +0900)
committerjinwoo.shin <jw0227.shin@samsung.com>
Fri, 28 Aug 2015 05:16:14 +0000 (14:16 +0900)
Change-Id: Ide6971531fa7a0d4009be3ba226c33c9dbf0c3b8
Signed-off-by: jinwoo.shin <jw0227.shin@samsung.com>
17 files changed:
CMakeLists.txt
data/infosquare.edc
data/view/action_menu_view.edc [new file with mode: 0644]
data/widget/button.edc
images/btn_menu_clear_dis.png [new file with mode: 0644]
images/btn_menu_clear_foc.png [new file with mode: 0644]
images/btn_menu_clear_nor.png [new file with mode: 0644]
images/btn_menu_clear_sel.png [new file with mode: 0644]
include/action_menu_view.h [new file with mode: 0644]
include/define.h
include/strings.h
include/util.h
src/action_menu_view.c [new file with mode: 0644]
src/main.c
src/notification_view.c
src/square_view.c
src/util.c

index a6785e6..399f7f3 100644 (file)
@@ -40,6 +40,7 @@ ENDIF(NOT DEFINED MANIFESTDIR)
 SET(SRCS src/main.c
                src/notification_view.c
                src/square_view.c
+               src/action_menu_view.c
                src/util.c)
 
 SET(TARGET_EDJ "${PROJECT_NAME}.edj")
index d8587fa..b400846 100644 (file)
@@ -19,4 +19,5 @@
 collections {
        #include "view/notification_view.edc"
        #include "view/square_view.edc"
+       #include "view/action_menu_view.edc"
 }
diff --git a/data/view/action_menu_view.edc b/data/view/action_menu_view.edc
new file mode 100644 (file)
index 0000000..03867a3
--- /dev/null
@@ -0,0 +1,177 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+group {
+       name, GRP_VIEW_ACTION_MENU;
+       parts {
+               part {
+                       name, "bg";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 0 0 0 150;
+                       }
+               }
+               part {
+                       name, "menu_area";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 255 255 255 255;
+                               rel1.relative, 1.0 0.0;
+                               min, 500 0;
+                               align, 1.0 0.0;
+                               fixed, 1 1;
+                       }
+               }
+
+               part {
+                       name, "view.divider";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 0 0 0 25;
+                               rel1.to, "menu_area";
+                               rel2 {
+                                       to, "menu_area";
+                                       relative, 0.0 1.0;
+                               }
+                               min, 1 0;
+                               align, 1.0 0.5;
+                               fixed, 1 0;
+                       }
+               }
+
+               part {
+                       name, "padding.livetv.btn";
+                       type, SPACER;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               rel1.to, "menu_area";
+                               rel2 {
+                                       to, "menu_area";
+                                       relative, 1.0 0.0;
+                               }
+                               min, 0 118;
+                               align, 0.5 0.0;
+                               fixed, 0 1;
+                       }
+               }
+
+               part {
+                       name, PART_TOP_BUTTON;
+                       type, SWALLOW;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               rel1 {
+                                       to, "padding.livetv.btn";
+                                       relative, 0.5 0.5;
+                               }
+                               rel2 {
+                                       to, "padding.livetv.btn";
+                                       relative, 0.5 0.5;
+                               }
+                               min, 327 64;
+                               align, 0.5 0.5;
+                               fixed, 1 1;
+                       }
+               }
+
+               part {
+                       name, "padding.menu.divider.up";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 224 224 224 255;
+                               rel1 {
+                                       to, "padding.livetv.btn";
+                                       relative, 0.0 1.0;
+                               }
+                               rel2.to, "padding.livetv.btn";
+                               min, 0 1;
+                               align, 0.5 1.0;
+                               fixed, 0 1;
+                       }
+               }
+
+               part {
+                       name, "part.menu.bg";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               rel1 {
+                                       to, PART_MENU;
+                                       relative, 0.0 0.0;
+                               }
+                               rel2 {
+                                       to, PART_MENU;
+                                       relative, 1.0 1.0;
+                               }
+                               align, 0.0 0.0;
+                               fixed, 1 1;
+                               color, 224 224 224 255;
+                       }
+               }
+
+               part {
+                       name, PART_MENU;
+                       type, SWALLOW;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               rel1 {
+                                       to, "padding.menu.divider.up";
+                                       relative, 0.0 1.0;
+                               }
+                               rel2 {
+                                       to, "padding.menu.divider.up";
+                                       relative, 0.0 1.0;
+                               }
+                               min, 500 0;
+                               align, 0.0 0.0;
+                               fixed, 1 1;
+                       }
+               }
+
+               part {
+                       name, "padding.menu.divider.down";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 224 224 224 255;
+                               rel1 {
+                                       to, PART_MENU;
+                                       relative, 0.0 1.0;
+                               }
+                               rel2 {
+                                       to, PART_MENU;
+                                       relative, 0.0 1.0;
+                               }
+                               min, 500 1;
+                               align, 0.0 0.0;
+                               fixed, 1 1;
+                       }
+               }
+       }
+}
index 51baf19..e81b05e 100644 (file)
@@ -528,3 +528,998 @@ group {
                }
        }
 }
+
+group {
+       name, "elm/button/base/style.livetv.button";
+       data.item, "focus_highlight" "on";
+       parts {
+               part {
+                       name, "part.bg";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               min, 0 64;
+                       }
+                       description {
+                               state: "focused" 0.0;
+                               inherit: "default" 0.0;
+                               color: 0 119 246 255;
+                       }
+               }
+
+               part {
+                       name, "padding.text.left";
+                       type, SPACER;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               min, 20 0;
+                               rel1.to, "part.bg";
+                               rel2 {
+                                       to, "part.bg";
+                                       relative, 0.0 1.0;
+                               }
+                               align, 0.0 0.5;
+                               fixed, 1 0;
+                       }
+               }
+
+               part {
+                       name, "padding.text.right";
+                       type, SPACER;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               min, 20 0;
+                               rel1 {
+                                       to, "part.bg";
+                                       relative, 1.0 0.0;
+                               }
+                               rel2.to, "part.bg";
+                               align, 1.0 0.5;
+                               fixed, 1 0;
+                       }
+               }
+
+               part {
+                       name, "elm.text";
+                       type, TEXT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 87 87 87 255;
+                               rel1 {
+                                       to, "padding.text.left";
+                                       relative, 1.0 0.0;
+                               }
+                               rel2 {
+                                       to, "padding.text.right";
+                                       relative, 0.0 1.0;
+                               }
+                               text {
+                                       font, FONT_LIGHT;
+                                       size, 28;
+                                       align, 0.5 0.5;
+                               }
+                       }
+                       description {
+                               state: "focused" 0.0;
+                               inherit: "default" 0.0;
+                               color: 255 255 255 255;
+                       }
+                       description {
+                               state: "disabled" 0.0;
+                               inherit: "default" 0.0;
+                               color: 87 87 87 128;
+                       }
+               }
+
+               part {
+                       name, "part.inside.line.up";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 194 194 194 255;
+                               rel1.to, "part.bg";
+                               rel2 {
+                                       to, "part.bg";
+                                       relative, 1.0 0.0;
+                               }
+                               min, 0 1;
+                               align, 0.5 0.0;
+                               fixed, 0 1;
+                       }
+               }
+
+               part {
+                       name, "part.inside.line.left";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 194 194 194 255;
+                               rel1 {
+                                       to, "part.inside.line.up";
+                                       relative, 0.0 1.0;
+                               }
+                               rel2 {
+                                       to, "part.bg";
+                                       relative, 0.0 1.0;
+                               }
+                               min, 1 0;
+                               align, 0.0 0.5;
+                               fixed, 1 0;
+                       }
+               }
+
+               part {
+                       name, "part.inside.line.down";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 194 194 194 255;
+                               rel1 {
+                                       to, "part.inside.line.left";
+                                       relative, 1.0 1.0;
+                               }
+                               rel2.to, "part.bg";
+                               min, 0 1;
+                               align, 0.5 1.0;
+                               fixed, 0 1;
+                       }
+               }
+
+               part {
+                       name, "part.inside.line.right";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 194 194 194 255;
+                               rel1 {
+                                       to, "part.inside.line.up";
+                                       relative, 1.0 1.0;
+                               }
+                               rel2 {
+                                       to, "part.inside.line.down";
+                                       relative, 1.0 0.0;
+                               }
+                               min, 1 0;
+                               align, 1.0 0.5;
+                               fixed, 1 0;
+                       }
+               }
+       }
+       programs {
+               program {
+                       name: "disabled";
+                       signal: "elm,state,disabled";
+                       source: "elm";
+                       action: STATE_SET "disabled" 0.0;
+                       target: "part.bg";
+                       target: "elm.text";
+               }
+               program {
+                       name: "focused";
+                       signal: "elm,action,focus";
+                       source: "elm";
+                       action: STATE_SET "focused" 0.0;
+                       target: "part.bg";
+                       target: "elm.text";
+               }
+               program {
+                       name: "unfocused";
+                       signal: "elm,action,unfocus";
+                       source: "elm";
+                       action: STATE_SET "default" 0.0;
+                       target: "part.bg";
+                       target: "elm.text";
+               }
+       }
+}
+
+#define DEFAULT 1
+#define SELECTED 2
+#define FOCUSED 3
+#define DISABLED 4
+
+group {
+       name, "elm/button/base/style.action.menu.button";
+       data.item, "focus_highlight" "on";
+       script {
+               public is_toggle, is_selected, is_enabled, is_focused, is_init, cur_state;
+
+               public init_values() {
+                       if(get_int(is_init)==0)
+                       {
+                               set_int(is_toggle, 0);
+                               set_int(is_enabled, 1);
+                               set_int(is_focused, 0);
+                               set_int(is_init, 1);
+                               set_int(cur_state, -1);
+                       }
+               }
+               public set_states() {
+                       new togg;
+                       new enab;
+                       new foc;
+                       new sel;
+                       new c_state;
+                       togg = get_int(is_toggle);
+                       enab = get_int(is_enabled);
+                       foc = get_int(is_focused);
+                       sel = get_int(is_selected);
+                       c_state = get_int(cur_state);
+
+                       if(enab == 0)
+                       {
+                               if(c_state != DISABLED)
+                               {
+                                       if (togg == 0)
+                                       {
+                                               run_program(PROGRAM:"do_disable");
+                                               run_program(PROGRAM:"do_hide.1");
+                                       }
+                                       else {
+                                               run_program(PROGRAM:"do_disable.1");
+                                               run_program(PROGRAM:"do_hide");
+                                       }
+                               }
+                       }
+                       else
+                       {
+                               if(foc == 1)
+                               {
+                                       if(c_state != FOCUSED)
+                                       {
+                                               if (togg == 0)
+                                               {
+                                                       run_program(PROGRAM:"do_focus");
+                                                       run_program(PROGRAM:"do_hide.1");
+                                               }
+                                               else {
+                                                       run_program(PROGRAM:"do_focus.1");
+                                                       run_program(PROGRAM:"do_hide");
+                                               }
+                                       }
+                               }
+                               else if(sel == 1)
+                               {
+                                       if(c_state != SELECTED)
+                                       {
+                                               if (togg == 0)
+                                               {
+                                                       run_program(PROGRAM:"do_select");
+                                                       run_program(PROGRAM:"do_hide.1");
+                                               }
+                                               else {
+                                                       run_program(PROGRAM:"do_select.1");
+                                                       run_program(PROGRAM:"do_hide");
+                                               }
+                                       }
+                               }
+                               else
+                               {
+                                       if(c_state != DEFAULT)
+                                       {
+                                               if (togg == 0)
+                                               {
+                                                       run_program(PROGRAM:"do_default");
+                                                       run_program(PROGRAM:"do_hide.1");
+                                               }
+                                               else {
+                                                       run_program(PROGRAM:"do_default.1");
+                                                       run_program(PROGRAM:"do_hide");
+                                               }
+                                       }
+                               }
+                       }
+               }
+       }
+       parts {
+               part {
+                       name, "part.bg";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               min, 124 124;
+                               color, 255 255 255 255;
+                       }
+                       description {
+                               state, "focused" 0.0;
+                               inherit, "default" 0.0;
+                               color, 0 119 246 255;
+                       }
+               }
+
+               part {
+                       name, "padding.icon1";
+                       type, SPACER;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               rel1.to, "part.bg";
+                               rel2 {
+                                       to, "part.bg";
+                                       relative, 1.0 0.0;
+                               }
+                               min, 0 14;
+                               align, 0.5 0.0;
+                               fixed, 0 1;
+                       }
+               }
+
+               part {
+                       name, "padding.icon2";
+                       type, SPACER;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               rel1 {
+                                       to, "part.bg";
+                                       relative, 0.0 1.0;
+                               }
+                               rel2.to, "part.bg";
+                               min, 0 50;
+                               align, 0.5 1.0;
+                               fixed, 0 1;
+                       }
+               }
+
+               part {
+                       name, "part.icon.bg";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               rel1 {
+                                       to, "padding.icon1";
+                                       relative, 0.0 1.0;
+                               }
+                               rel2 {
+                                       to, "padding.icon2";
+                                       relative, 1.0 0.0;
+                               }
+                               align, 0.5 0.5;
+                               min, 60 60;
+                       }
+               }
+
+               part {
+                       name, "elm.swallow.icon";
+                       type, SWALLOW;
+                       scale, 1;
+                       clip_to: "part.icon.bg";
+                       description {
+                               state, "default" 0.0;
+                               aspect, 1.0 1.0;
+                               aspect_preference, BOTH;
+                               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;
+                       }
+                       description {
+                               state, "focused" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+                       description {
+                               state, "selected" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+                       description {
+                               state, "disabled" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+                       description {
+                               state, "invisible" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+               }
+               part {
+                       name, "elm.swallow.icon.focus";
+                       type, SWALLOW;
+                       scale, 1;
+                       clip_to: "part.icon.bg";
+                       description {
+                               state, "default" 0.0;
+                               aspect: 1.0 1.0;
+                               aspect_preference: BOTH;
+                               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;
+                               visible, 0;
+                       }
+                       description {
+                               state, "focused" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 1;
+                       }
+                       description {
+                               state, "selected" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+                       description {
+                               state, "disabled" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+                       description {
+                               state, "invisible" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+               }
+               part {
+                       name, "elm.swallow.icon.select";
+                       type, SWALLOW;
+                       scale, 1;
+                       clip_to: "part.icon.bg";
+                       description {
+                               state, "default" 0.0;
+                               aspect: 1.0 1.0;
+                               aspect_preference: BOTH;
+                               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;
+                               visible, 0;
+                       }
+                       description {
+                               state, "focused" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+                       description {
+                               state, "selected" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 1;
+                       }
+                       description {
+                               state, "disabled" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+                       description {
+                               state, "invisible" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+               }
+               part {
+                       name, "elm.swallow.icon.disable";
+                       type, SWALLOW;
+                       scale, 1;
+                       clip_to: "part.icon.bg";
+                       description {
+                               state, "default" 0.0;
+                               aspect: 1.0 1.0;
+                               aspect_preference: BOTH;
+                               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;
+                               visible, 0;
+                       }
+                       description {
+                               state, "focused" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+                       description {
+                               state, "selected" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+                       description {
+                               state, "disabled" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 1;
+                       }
+                       description {
+                               state, "invisible" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+               }
+
+               part {
+                       name, "elm.swallow.icon.1";
+                       type, SWALLOW;
+                       scale, 1;
+                       clip_to: "part.icon.bg";
+                       description {
+                               state, "default" 0.0;
+                               aspect, 1.0 1.0;
+                               aspect_preference, BOTH;
+                               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;
+                       }
+                       description {
+                               state, "focused" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+                       description {
+                               state, "selected" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+                       description {
+                               state, "disabled" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+                       description {
+                               state, "invisible" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+               }
+               part {
+                       name, "elm.swallow.icon.1.focus";
+                       type, SWALLOW;
+                       scale, 1;
+                       clip_to: "part.icon.bg";
+                       description {
+                               state, "default" 0.0;
+                               aspect: 1.0 1.0;
+                               aspect_preference: BOTH;
+                               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;
+                               visible, 0;
+                       }
+                       description {
+                               state, "focused" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 1;
+                       }
+                       description {
+                               state, "selected" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+                       description {
+                               state, "disabled" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+                       description {
+                               state, "invisible" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+               }
+               part {
+                       name, "elm.swallow.icon.1.select";
+                       type, SWALLOW;
+                       scale, 1;
+                       clip_to: "part.icon.bg";
+                       description {
+                               state, "default" 0.0;
+                               aspect: 1.0 1.0;
+                               aspect_preference: BOTH;
+                               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;
+                               visible, 0;
+                       }
+                       description {
+                               state, "focused" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+                       description {
+                               state, "selected" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 1;
+                       }
+                       description {
+                               state, "disabled" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+                       description {
+                               state, "invisible" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+               }
+               part {
+                       name, "elm.swallow.icon.1.disable";
+                       type, SWALLOW;
+                       scale, 1;
+                       clip_to: "part.icon.bg";
+                       description {
+                               state, "default" 0.0;
+                               aspect: 1.0 1.0;
+                               aspect_preference: BOTH;
+                               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;
+                               visible, 0;
+                       }
+                       description {
+                               state, "focused" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+                       description {
+                               state, "selected" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+                       description {
+                               state, "disabled" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 1;
+                       }
+                       description {
+                               state, "invisible" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+               }
+
+               part {
+                       name, "padding.text";
+                       type, SPACER;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               rel1 {
+                                       to, "part.bg";
+                                       relative, 0.0 1.0;
+                               }
+                               rel2.to, "part.bg";
+                               min, 0 24;
+                               align, 0.5 1.0;
+                               fixed, 0 1;
+                       }
+               }
+
+               part {
+                       name, "elm.text";
+                       type, TEXT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 104 104 104 255;
+                               rel1.to, "padding.text";
+                               rel2 {
+                                       to, "padding.text";
+                                       relative, 1.0 0.0;
+                               }
+                               min, 0 20;
+                               align, 0.5 1.0;
+                               fixed, 0 1;
+                               text {
+                                       font, FONT_LIGHT;
+                                       size, 20;
+                                       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: "disabled" 0.0;
+                               inherit: "default" 0.0;
+                               color: 104 104 104 128;
+                       }
+                       description {
+                               state, "invisible" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+               }
+
+               part {
+                       name, "elm.text.1";
+                       type, TEXT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 104 104 104 255;
+                               rel1.to, "padding.text";
+                               rel2 {
+                                       to, "padding.text";
+                                       relative, 1.0 0.0;
+                               }
+                               min, 0 20;
+                               align, 0.5 1.0;
+                               fixed, 0 1;
+                               text {
+                                       font, FONT_LIGHT;
+                                       size, 20;
+                                       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: "disabled" 0.0;
+                               inherit: "default" 0.0;
+                               color: 104 104 104 128;
+                       }
+                       description {
+                               state, "invisible" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+               }
+       }
+       programs {
+               program {
+                       name: "go_toggle";
+                       signal: "elm,state,toggle";
+                       source: "elm";
+                       script {
+                               init_values();
+                               set_int(is_toggle, 1);
+                               set_states();
+                       }
+               }
+               program {
+                       name: "go_untoggle";
+                       signal: "elm,state,untoggle";
+                       source: "elm";
+                       script {
+                               init_values();
+                               set_int(is_toggle, 0);
+                               set_states();
+                       }
+               }
+               program {
+                       name: "go_focused";
+                       signal: "elm,action,focus";
+                       source: "elm";
+                       script {
+                               init_values();
+                               set_int(is_focused, 1);
+                               set_states();
+                       }
+               }
+               program {
+                       name: "go_unfocused";
+                       signal: "elm,action,unfocus";
+                       source: "elm";
+                       script {
+                               init_values();
+                               set_int(is_focused, 0);
+                               set_states();
+                       }
+               }
+               program {
+                       name: "go_active";
+                       signal: "elm,state,selected";
+                       source: "elm";
+                       script {
+                               init_values();
+                               set_int(is_selected, 1);
+                               set_states();
+                       }
+               }
+               program {
+                       name: "go_passive";
+                       signal: "elm,state,unselected";
+                       source: "elm";
+                       script {
+                               init_values();
+                               set_int(is_selected, 0);
+                               set_states();
+                       }
+               }
+               program {
+                       name: "go_disabled";
+                       signal: "elm,state,disabled";
+                       source: "elm";
+                       script {
+                               init_values();
+                               set_int(is_enabled, 0);
+                               set_states();
+                       }
+               }
+               program {
+                       name: "go_enabled";
+                       signal: "elm,state,enabled";
+                       source: "elm";
+                       script {
+                               init_values();
+                               set_int(is_enabled, 1);
+                               set_states();
+                       }
+               }
+               program {
+                       name: "do_hide";
+                       action: STATE_SET "invisible" 0.0;
+                       target: "elm.text";
+                       target: "elm.swallow.icon";
+                       target: "elm.swallow.icon.focus";
+                       target: "elm.swallow.icon.select";
+                       target: "elm.swallow.icon.disable";
+               }
+               program {
+                       name: "do_default";
+                       action: STATE_SET "default" 0.0;
+                       target: "part.bg";
+                       target: "elm.text";
+                       target: "elm.swallow.icon";
+                       target: "elm.swallow.icon.focus";
+                       target: "elm.swallow.icon.select";
+                       target: "elm.swallow.icon.disable";
+               }
+               program {
+                       name: "do_focus";
+                       action: STATE_SET "focused" 0.0;
+                       target: "part.bg";
+                       target: "elm.text";
+                       target: "elm.swallow.icon";
+                       target: "elm.swallow.icon.focus";
+                       target: "elm.swallow.icon.select";
+                       target: "elm.swallow.icon.disable";
+               }
+
+               program {
+                       name: "do_select";
+                       action: STATE_SET "selected" 0.0;
+                       target: "part.bg";
+                       target: "elm.text";
+                       target: "elm.swallow.icon";
+                       target: "elm.swallow.icon.focus";
+                       target: "elm.swallow.icon.select";
+                       target: "elm.swallow.icon.disable";
+               }
+
+               program {
+                       name: "do_disable";
+                       action: STATE_SET "disabled" 0.0;
+                       target: "part.bg";
+                       target: "elm.text";
+                       target: "elm.swallow.icon";
+                       target: "elm.swallow.icon.focus";
+                       target: "elm.swallow.icon.select";
+                       target: "elm.swallow.icon.disable";
+               }
+
+               program {
+                       name: "do_hide.1";
+                       action: STATE_SET "invisible" 0.0;
+                       target: "elm.text.1";
+                       target: "elm.swallow.icon.1";
+                       target: "elm.swallow.icon.1.focus";
+                       target: "elm.swallow.icon.1.select";
+                       target: "elm.swallow.icon.1.disable";
+               }
+
+               program {
+                       name: "do_default.1";
+                       action: STATE_SET "default" 0.0;
+                       target: "part.bg";
+                       target: "elm.text.1";
+                       target: "elm.swallow.icon.1";
+                       target: "elm.swallow.icon.1.focus";
+                       target: "elm.swallow.icon.1.select";
+                       target: "elm.swallow.icon.1.disable";
+               }
+               program {
+                       name: "do_focus.1";
+                       action: STATE_SET "focused" 0.0;
+                       target: "part.bg";
+                       target: "elm.text.1";
+                       target: "elm.swallow.icon.1";
+                       target: "elm.swallow.icon.1.focus";
+                       target: "elm.swallow.icon.1.select";
+                       target: "elm.swallow.icon.1.disable";
+               }
+
+               program {
+                       name: "do_select.1";
+                       action: STATE_SET "selected" 0.0;
+                       target: "part.bg";
+                       target: "elm.text.1";
+                       target: "elm.swallow.icon.1";
+                       target: "elm.swallow.icon.1.focus";
+                       target: "elm.swallow.icon.1.select";
+                       target: "elm.swallow.icon.1.disable";
+               }
+
+               program {
+                       name: "do_disable.1";
+                       action: STATE_SET "disabled" 0.0;
+                       target: "part.bg";
+                       target: "elm.text.1";
+                       target: "elm.swallow.icon.1";
+                       target: "elm.swallow.icon.1.focus";
+                       target: "elm.swallow.icon.1.select";
+                       target: "elm.swallow.icon.1.disable";
+               }
+       }
+}
diff --git a/images/btn_menu_clear_dis.png b/images/btn_menu_clear_dis.png
new file mode 100644 (file)
index 0000000..c8b4c46
Binary files /dev/null and b/images/btn_menu_clear_dis.png differ
diff --git a/images/btn_menu_clear_foc.png b/images/btn_menu_clear_foc.png
new file mode 100644 (file)
index 0000000..9963d3c
Binary files /dev/null and b/images/btn_menu_clear_foc.png differ
diff --git a/images/btn_menu_clear_nor.png b/images/btn_menu_clear_nor.png
new file mode 100644 (file)
index 0000000..f59189d
Binary files /dev/null and b/images/btn_menu_clear_nor.png differ
diff --git a/images/btn_menu_clear_sel.png b/images/btn_menu_clear_sel.png
new file mode 100644 (file)
index 0000000..b2cf37f
Binary files /dev/null and b/images/btn_menu_clear_sel.png differ
diff --git a/include/action_menu_view.h b/include/action_menu_view.h
new file mode 100644 (file)
index 0000000..29e97bb
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __AIR_ACTION_MENU_VIEW_H__
+#define __AIR_ACTION_MENU_VIEW_H__
+
+view_class *action_menu_view_get_vclass(void);
+
+#endif /* __AIR_ACTION_MENU_VIEW_H__*/
index 365faa6..434c6f1 100644 (file)
 
 #define PART_CONTENT "elm.swallow.content"
 #define PART_ICON "elm.swallow.icon"
+#define PART_ICON_FOCUSED "elm.swallow.icon.focus"
+#define PART_ICON_SELECTED "elm.swallow.icon.select"
+#define PART_ICON_DISABLED "elm.swallow.icon.disable"
+#define PART_TEXT_1 "elm.text.1"
+#define PART_ICON_1 "elm.swallow.icon.1"
+#define PART_ICON_1_FOCUSED "elm.swallow.icon.1.focus"
+#define PART_ICON_1_SELECTED "elm.swallow.icon.1.select"
+#define PART_ICON_1_DISABLED "elm.swallow.icon.1.disable"
 #define PART_TITLE "elm.text"
 #define PART_TEXT1 "elm.text1"
 #define PART_TEXT2 "elm.text2"
 #define SIGNAL_ITEM_SELECTED "item,selected"
 #define SIGNAL_NO_NOTIFICATION "signal.no_notification"
 #define SIGNAL_NOTIFICATION "signal.notification"
+#define SIGNAL_TOGGLE "elm,state,toggle"
+#define SIGNAL_UNTOGGLE "elm,state,untoggle"
+#define SIGNAL_CHILD_REMOVED "child,removed"
 
 #define FONT_REGULAR "TizenSans"
 #define FONT_LIGHT "TizenSans:style=Light"
 #define FONT_BOLD "TizenSans:style=Bold"
 
 #define KEY_NOTI "KEY_NOTI"
+#define KEY_BUTTON "KEY_BUTTON"
+#define UPDATE_TYPE_SET_NOTIFICATION 0
+#define UPDATE_TYPE_SHOW_POPUP 1
 
 /* Definitions for notification view */
 #define NOTIFICATION_VIEW "NOTIFICATION_VIEW"
 #define GRP_NOTIFICATION_LAUNCH "grp.notification.launch"
 #define GRP_SQUARE_NOTIFICATION_CLEAR "grp.square.notification.clear"
 
+/* Definitions for action menu view */
+#define ACTION_MENU_VIEW "ACTION_MENUVIEW"
+#define GRP_VIEW_ACTION_MENU "grp.view.action_menu"
+#define PART_TOP_BUTTON "part.top.button"
+#define PART_MENU "part.menu"
+#define IMAGE_CLEAR_NOR IMAGEDIR"/btn_menu_clear_nor.png"
+#define IMAGE_CLEAR_FOC IMAGEDIR"/btn_menu_clear_foc.png"
+#define IMAGE_CLEAR_SEL IMAGEDIR"/btn_menu_clear_sel.png"
+#define IMAGE_CLEAR_DIS IMAGEDIR"/btn_menu_clear_dis.png"
+
 #endif /* __AIR_INFOSQUARE_DEFINE_H__*/
index fb210e0..224fce2 100644 (file)
@@ -37,4 +37,7 @@
 #define STR_DEFAULT_TIME_MINUTE "30"
 #define STR_DEFAULT_DATE "Thusday, May 23"
 
+#define STR_LIVETV "Live TV"
+#define STR_BUTTON_CLEAR "Clear"
+
 #endif /* __AIR_INFOSQUARE_STRINGS_H__*/
index d2e0553..f48ef25 100644 (file)
@@ -21,5 +21,9 @@
 
 Evas_Object *util_show_notification_popup(Evas_Object *base, notification_h noti);
 void util_clear_notification(void);
+Evas_Object *util_add_icon(Evas_Object *parent, const char *file,
+               const char *part);
+Evas_Object *util_add_button(Evas_Object *parent, const char *part,
+               const char *text, const char *style);
 
 #endif
diff --git a/src/action_menu_view.c b/src/action_menu_view.c
new file mode 100644 (file)
index 0000000..18907d0
--- /dev/null
@@ -0,0 +1,536 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <Elementary.h>
+#include <viewmgr.h>
+#include <inputmgr.h>
+#include <app_debug.h>
+#include <app_define.h>
+#include <notification.h>
+
+#include "define.h"
+#include "util.h"
+
+#define BUF_MAX 128
+#define BUTTON_MAX 16
+#define BUTTON_BORDER 1
+#define ITEMS_IN_ROW 4
+
+#define STYLE_LIVETV_BTN "style.livetv.button"
+#define STYLE_ACTION_MENU_BTN "style.action.menu.button"
+
+#define UNTOGGLE 0
+#define TOGGLE 1
+
+enum _button_id {
+       BUTTON_INVALID = -1,
+       BUTTON_CLEAR,
+       BUTTON_LIVETV = BUTTON_MAX,
+};
+
+enum _button_state {
+       STATE_INVALID = -1,
+       STATE_UNTOGGLE,
+       STATE_TOGGLE,
+       STATE_DISABLED,
+};
+
+struct _priv {
+       Evas_Object *win;
+       Evas_Object *base;
+       Evas_Object *table;
+       Evas_Object *live;
+       Evas_Object *menu_btn[BUTTON_MAX];
+
+       notification_h noti;
+};
+
+struct _button_data {
+       const char *text;
+       const char *normal;
+       const char *focused;
+       const char *selected;
+       const char *disabled;
+};
+
+static void _livetv_clicked(void *data)
+{
+       app_control_h app_ctrl;
+       int r;
+
+       r = app_control_create(&app_ctrl);
+       if (r != APP_CONTROL_ERROR_NONE) {
+               _ERR("failed to create app control handle");
+               return;
+       }
+
+       r = app_control_set_operation(app_ctrl, APP_CONTROL_OPERATION_DEFAULT);
+       if (r != APP_CONTROL_ERROR_NONE) {
+               _ERR("failed to set app control operation");
+               app_control_destroy(app_ctrl);
+               return;
+       }
+
+       r = app_control_set_app_id(app_ctrl, APP_ID_LIVETV);
+       if (r != APP_CONTROL_ERROR_NONE) {
+               _ERR("failed to set app control app id");
+               app_control_destroy(app_ctrl);
+               return;
+       }
+
+       r = app_control_send_launch_request(app_ctrl, NULL, NULL);
+       if (r != APP_CONTROL_ERROR_NONE) {
+               _ERR("failed to send app control launch request");
+               app_control_destroy(app_ctrl);
+               return;
+       }
+
+       app_control_destroy(app_ctrl);
+
+       viewmgr_hide_view(ACTION_MENU_VIEW);
+}
+
+static void _clear_clicked(void *data)
+{
+       struct _priv *priv;
+
+       if (!data) {
+               _ERR("Get data failed.");
+               return;
+       }
+
+       priv = data;
+
+       notification_delete(priv->noti);
+
+       viewmgr_hide_view(ACTION_MENU_VIEW);
+}
+
+static int _clear_state(void *data)
+{
+       struct _priv *priv;
+       int noti_err = NOTIFICATION_ERROR_NONE;
+       notification_type_e type;
+
+       if (!data) {
+               _ERR("Get data failed.");
+               return STATE_INVALID;
+       }
+
+       priv = data;
+
+       if (!priv->noti)
+               return STATE_DISABLED;
+
+       noti_err = notification_get_type(priv->noti, &type);
+       if (noti_err != NOTIFICATION_ERROR_NONE ||
+                       type == NOTIFICATION_TYPE_ONGOING)
+               return STATE_DISABLED;
+
+       return STATE_UNTOGGLE;
+}
+
+struct _button {
+       int id;
+       struct _button_data data[2];
+
+       void (*clicked)(void *data);
+       int (*state)(void *data);
+};
+
+static struct _button buttons[] = {
+       {
+               .id = BUTTON_CLEAR,
+               .data[UNTOGGLE] = {
+                       .text = STR_BUTTON_CLEAR,
+                       .normal = IMAGE_CLEAR_NOR,
+                       .focused = IMAGE_CLEAR_FOC,
+                       .selected = IMAGE_CLEAR_SEL,
+                       .disabled = IMAGE_CLEAR_DIS
+               },
+               .clicked = _clear_clicked,
+               .state = _clear_state
+       },
+       {
+               .id = BUTTON_INVALID
+       }
+};
+
+static void _key_up_cb(int id, void *data, Evas *e, Evas_Object *obj,
+               Evas_Event_Key_Up *ev)
+{
+       if (!strcmp(ev->keyname, KEY_BACK) ||
+                       !strcmp(ev->keyname, KEY_BACK_REMOTE))
+               viewmgr_hide_view(ACTION_MENU_VIEW);
+}
+
+static input_handler key_handler = {
+       .key_up = _key_up_cb,
+};
+
+static void _update_button_state(Evas_Object *obj,
+               struct _button *button, void *data)
+{
+       int state;
+
+       if (!obj || !button->state) {
+               _ERR("failed to get button state");
+               return;
+       }
+
+       state = button->state(data);
+
+       switch (state) {
+       case STATE_UNTOGGLE:
+               elm_object_signal_emit(obj, SIGNAL_UNTOGGLE, SOURCE_ELM);
+               break;
+       case STATE_TOGGLE:
+               elm_object_signal_emit(obj, SIGNAL_TOGGLE, SOURCE_ELM);
+               break;
+       case STATE_DISABLED:
+               elm_object_disabled_set(obj, EINA_TRUE);
+               break;
+       case STATE_INVALID:
+               break;
+       }
+}
+
+static void _button_clicked(Evas_Object *obj, int id, void *data)
+{
+       struct _button *button;
+
+       switch (id) {
+       case BUTTON_LIVETV:
+               _livetv_clicked(data);
+               break;
+       case BUTTON_CLEAR:
+               button = evas_object_data_get(obj, KEY_BUTTON);
+
+               if (!button) {
+                       _ERR("failed to get button");
+                       return;
+               }
+
+               if (button->clicked)
+                       button->clicked(data);
+
+               _update_button_state(obj, button, data);
+
+               break;
+       }
+}
+
+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) &&
+               strcmp(ev->keyname, KEY_ENTER_REMOTE))
+               return;
+
+       _button_clicked(obj, id, data);
+}
+
+static void _button_mouse_up_cb(int id, void *data, Evas *e,
+               Evas_Object *obj, Evas_Event_Mouse_Up *ev)
+{
+       _button_clicked(obj, id, data);
+}
+
+static void _button_mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj,
+               Evas_Event_Mouse_Move *ev)
+{
+       if (!obj)
+               return;
+
+       if (!elm_object_focus_get(obj))
+               elm_object_focus_set(obj, EINA_TRUE);
+}
+
+static input_handler button_handler = {
+       .key_up = _button_key_up_cb,
+       .mouse_up = _button_mouse_up_cb,
+       .mouse_move = _button_mouse_move_cb
+};
+
+static void _child_removed_cb(void *data, Evas_Object *obj, void *ei)
+{
+       if (obj)
+               inputmgr_remove_callback(obj, &button_handler);
+}
+
+
+static bool _draw_top_area(struct _priv *priv)
+{
+       Evas_Object *btn;
+
+       btn = util_add_button(priv->base,
+                       PART_TOP_BUTTON, STR_LIVETV, STYLE_LIVETV_BTN);
+       if (!btn) {
+               _ERR("Add button failed.");
+               return false;
+       }
+       inputmgr_add_callback(btn, BUTTON_LIVETV,
+                               &button_handler, NULL);
+
+       priv->live = btn;
+
+       return true;
+}
+
+static void _update_menu_area(struct _priv *priv)
+{
+       Evas_Object *btn;
+       int i, row, col;
+
+       elm_table_clear(priv->table, EINA_TRUE);
+
+       i = 0;
+       while (buttons[i].id != BUTTON_INVALID && i < BUTTON_MAX) {
+               btn = util_add_button(priv->base, NULL,
+                               buttons[i].data[UNTOGGLE].text,
+                               STYLE_ACTION_MENU_BTN);
+               if (!btn) {
+                       _ERR("Add button failed.");
+                       return;
+               }
+
+               evas_object_data_set(btn, KEY_BUTTON, &buttons[i]);
+               util_add_icon(btn, buttons[i].data[UNTOGGLE].normal,
+                               PART_ICON);
+               util_add_icon(btn, buttons[i].data[UNTOGGLE].focused,
+                               PART_ICON_FOCUSED);
+               util_add_icon(btn, buttons[i].data[UNTOGGLE].selected,
+                               PART_ICON_SELECTED);
+               util_add_icon(btn, buttons[i].data[UNTOGGLE].disabled,
+                               PART_ICON_DISABLED);
+               elm_object_part_text_set(btn, PART_TEXT_1,
+                               buttons[i].data[TOGGLE].text);
+               util_add_icon(btn, buttons[i].data[TOGGLE].normal,
+                               PART_ICON_1);
+               util_add_icon(btn, buttons[i].data[TOGGLE].focused,
+                               PART_ICON_1_FOCUSED);
+               util_add_icon(btn, buttons[i].data[TOGGLE].selected,
+                               PART_ICON_1_SELECTED);
+               util_add_icon(btn, buttons[i].data[TOGGLE].disabled,
+                               PART_ICON_1_DISABLED);
+               inputmgr_add_callback(btn, buttons[i].id,
+                               &button_handler, priv);
+
+               _update_button_state(btn, &buttons[i], priv);
+
+               col = i % ITEMS_IN_ROW;
+               row = i / ITEMS_IN_ROW;
+               elm_table_pack(priv->table, btn, col, row, 1, 1);
+
+               priv->menu_btn[i] = btn;
+
+               i++;
+       }
+
+       elm_object_focus_next_object_set(priv->menu_btn[0],
+                       priv->menu_btn[i - 1], ELM_FOCUS_LEFT);
+       elm_object_focus_next_object_set(priv->menu_btn[i - 1],
+                       priv->menu_btn[0], ELM_FOCUS_RIGHT);
+
+       while (col + 1 != ITEMS_IN_ROW) {
+               btn = util_add_button(priv->base, NULL, NULL,
+                               STYLE_ACTION_MENU_BTN);
+               if (!btn) {
+                       _ERR("Add button failed.");
+                       return;
+               }
+
+               elm_object_disabled_set(btn, EINA_TRUE);
+
+               col = i % ITEMS_IN_ROW;
+
+               elm_table_pack(priv->table, btn, col, row, 1, 1);
+
+               i++;
+       }
+}
+
+static bool _draw_menu_area(struct _priv *priv)
+{
+       Evas_Object *table;
+
+       table = elm_table_add(priv->base);
+       if (!table) {
+               _ERR("Add table failed.");
+               return false;
+       }
+       elm_table_padding_set(table, BUTTON_BORDER, BUTTON_BORDER);
+       evas_object_show(table);
+       elm_object_part_content_set(priv->base, PART_MENU, table);
+       evas_object_smart_callback_add(priv->table, SIGNAL_CHILD_REMOVED,
+                       _child_removed_cb, NULL);
+
+       priv->table = table;
+
+       return true;
+}
+
+static void _draw_view_content(struct _priv *priv)
+{
+       if (!_draw_top_area(priv)) {
+               _ERR("Draw top area failed.");
+               return;
+       }
+
+       if (!_draw_menu_area(priv)) {
+               _ERR("Draw menu area failed.");
+               return;
+       }
+}
+
+static Evas_Object *_create(Evas_Object *win, void *data)
+{
+       struct _priv *priv;
+       Evas_Object *base;
+
+       if (!win) {
+               _ERR("Get window object failed.");
+               return NULL;
+       }
+
+       priv = calloc(1, sizeof(*priv));
+       if (!priv) {
+               _ERR("Calloc failed.");
+               return NULL;
+       }
+
+       base = elm_layout_add(win);
+       if (!base) {
+               _ERR("failed to create base object");
+               free(priv);
+               return NULL;
+       }
+       elm_layout_file_set(base, EDJEFILE, GRP_VIEW_ACTION_MENU);
+       evas_object_size_hint_weight_set(base,
+                       EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_win_resize_object_add(win, base);
+
+       priv->base = base;
+       priv->win = win;
+
+       if (!viewmgr_set_view_data(ACTION_MENU_VIEW, priv)) {
+               _ERR("Set view data failed.");
+               evas_object_del(base);
+               free(priv);
+               return NULL;
+       }
+
+       _draw_view_content(priv);
+
+       inputmgr_add_callback(priv->base, 0, &key_handler, priv);
+
+       return base;
+}
+
+static void _show(void *data)
+{
+       struct _priv *priv;
+
+       if (!data) {
+               _ERR("Get data failed.");
+               return;
+       }
+       priv = data;
+
+       _update_menu_area(priv);
+
+       evas_object_show(priv->base);
+
+       elm_object_focus_set(priv->menu_btn[0], EINA_TRUE);
+}
+
+static void _hide(void *data)
+{
+       struct _priv *priv;
+
+       if (!data) {
+               _ERR("Get data failed.");
+               return;
+       }
+       priv = data;
+
+       evas_object_hide(priv->base);
+}
+
+static void _destroy(void *data)
+{
+       struct _priv *priv;
+       int i;
+
+       if (!data) {
+               _ERR("Get data failed.");
+               return;
+       }
+       priv = data;
+
+       inputmgr_remove_callback(priv->base, &key_handler);
+       inputmgr_remove_callback(priv->live, &button_handler);
+
+       i = 0;
+       while (priv->menu_btn[i] && i < BUTTON_MAX) {
+               inputmgr_remove_callback(priv->menu_btn[i], &button_handler);
+               i++;
+       }
+
+       evas_object_smart_callback_del(priv->table, SIGNAL_CHILD_REMOVED,
+                       _child_removed_cb);
+
+       evas_object_del(priv->base);
+
+       free(priv);
+}
+
+static void _update(void *view_data, int type, void *data)
+{
+       struct _priv *priv;
+
+       if (!view_data) {
+               _ERR("failed to get view data");
+               return;
+       }
+
+       priv = view_data;
+
+       switch (type) {
+       case UPDATE_TYPE_SET_NOTIFICATION:
+               if (!data) {
+                       _ERR("failed to get data");
+                       return;
+               }
+
+               priv->noti = data;
+               break;
+       }
+}
+
+static view_class _vclass = {
+       .view_id = ACTION_MENU_VIEW,
+       .create = _create,
+       .show = _show,
+       .hide = _hide,
+       .destroy = _destroy,
+       .update = _update
+};
+
+view_class *action_menu_view_get_vclass(void)
+{
+       return &_vclass;
+}
index d704b39..c70fc51 100644 (file)
@@ -22,6 +22,7 @@
 #include "define.h"
 #include "notification_view.h"
 #include "square_view.h"
+#include "action_menu_view.h"
 
 #define KEY_LAUNCH_TYPE "launch_type"
 #define TYPE_SQUARE "infosquare"
@@ -88,6 +89,7 @@ static bool _create(void *data)
 
        viewmgr_add_view(notification_view_get_vclass(), NULL);
        viewmgr_add_view(square_view_get_vclass(), NULL);
+       viewmgr_add_view(action_menu_view_get_vclass(), NULL);
 
        ad->win = win;
 
@@ -107,6 +109,7 @@ static void _terminate(void *data)
 
        viewmgr_remove_view(NOTIFICATION_VIEW);
        viewmgr_remove_view(SQUARE_VIEW);
+       viewmgr_remove_view(ACTION_MENU_VIEW);
        viewmgr_destroy();
 
        if (ad->win) {
index 7fa9c39..cd81959 100644 (file)
 #define NOTIFICATION_ITEM_PADDING 26
 #define NOTIFICATION_ITEMS_IN_COL 4.0
 
-#define SIG_ITEM_FOCUSED "item,focused"
-#define SIG_ITEM_UNFOCUSED "item,unfocused"
-
-enum _update_type {
-       UPDATE_TYPE_SHOW_POPUP,
-};
-
 enum _obj_id {
        OBJ_CLEAR,
        OBJ_TITLE,
@@ -73,6 +66,7 @@ struct _priv {
        Evas_Object *base;
        Evas_Object *clear_btn;
        Evas_Object *category_container;
+       Elm_Object_Item *current_it;
        Elm_Gengrid_Item_Class *grid_class;
        struct _category *category[CATEGORY_MAX];
 };
@@ -87,6 +81,12 @@ static void _category_unfocused_cb(int id, void *data,
                Evas_Object *obj, Elm_Object_Item *it);
 static void _mouse_move(int id, void *data, Evas *e, Evas_Object *obj,
                Evas_Event_Mouse_Move *ev);
+static void _focus_key_up_cb(int id, void *data,
+               Evas *e, Evas_Object *obj, Evas_Event_Key_Up *ev);
+static void _focus_focused_cb(int id, void *data,
+               Evas_Object *obj, Elm_Object_Item *it);
+static void _focus_unfocused_cb(int id, void *data,
+               Evas_Object *obj, Elm_Object_Item *it);
 
 static input_handler base_handler = {
        .key_up = _base_key_up_cb,
@@ -100,6 +100,9 @@ static input_handler category_handler = {
 };
 static input_handler focus_handler = {
        .mouse_move = _mouse_move,
+       .key_up = _focus_key_up_cb,
+       .focused = _focus_focused_cb,
+       .unfocused = _focus_unfocused_cb
 };
 
 static const char *_get_category_title(int category)
@@ -230,9 +233,9 @@ static void _draw_category(struct _priv *priv, int category)
        elm_object_focus_next_object_set(grid, grid, ELM_FOCUS_RIGHT);
 
        inputmgr_add_callback(title, category, &category_handler, priv);
-       inputmgr_add_callback(title, OBJ_TITLE, &focus_handler, NULL);
+       inputmgr_add_callback(title, OBJ_TITLE, &focus_handler, priv);
        inputmgr_add_callback(grid, category, &category_handler, priv);
-       inputmgr_add_callback(grid, OBJ_GRID, &focus_handler, NULL);
+       inputmgr_add_callback(grid, OBJ_GRID, &focus_handler, priv);
 
        elm_box_pack_end(priv->category_container, ly);
        evas_object_show(grid);
@@ -459,7 +462,7 @@ static Evas_Object *_create(Evas_Object *win, void *data)
                        PART_NOTIFICATION_CLEAR, priv->clear_btn);
        evas_object_show(priv->clear_btn);
        inputmgr_add_callback(priv->clear_btn, 0, &clear_handler, NULL);
-       inputmgr_add_callback(priv->clear_btn, OBJ_CLEAR, &focus_handler, NULL);
+       inputmgr_add_callback(priv->clear_btn, OBJ_CLEAR, &focus_handler, priv);
 
        priv->grid_class = elm_gengrid_item_class_new();
        priv->grid_class->item_style = STYLE_GRID_ITEM;
@@ -639,6 +642,63 @@ static void _mouse_move(int id, void *data, Evas *e, Evas_Object *obj,
        }
 }
 
+static void _focus_key_up_cb(int id, void *data, Evas *e,
+               Evas_Object *obj, Evas_Event_Key_Up *ev)
+{
+       struct _priv *priv;
+       void *noti;
+
+       priv = data;
+
+       switch (id) {
+       case OBJ_GRID:
+               if (!strcmp(ev->keyname, KEY_MENU) ||
+                       !strcmp(ev->keyname, KEY_MENU_REMOTE)) {
+                       if (!priv || !priv->current_it)
+                               return;
+
+                       noti = elm_object_item_data_get(priv->current_it);
+                       if (!noti)
+                               return;
+
+                       viewmgr_update_view(ACTION_MENU_VIEW,
+                                       UPDATE_TYPE_SET_NOTIFICATION, noti);
+                       viewmgr_show_view(ACTION_MENU_VIEW);
+               }
+               break;
+       case OBJ_CLEAR:
+       case OBJ_TITLE:
+               break;
+       }
+}
+
+static void _focus_focused_cb(int id, void *data,
+               Evas_Object *obj, Elm_Object_Item *it)
+{
+       struct _priv *priv;
+
+       if (!data || !it)
+               return;
+
+       priv = data;
+
+       priv->current_it = it;
+}
+
+static void _focus_unfocused_cb(int id, void *data,
+               Evas_Object *obj, Elm_Object_Item *it)
+{
+       struct _priv *priv;
+
+       if (!data || !it)
+               return;
+
+       priv = data;
+
+       if (priv->current_it == it)
+               priv->current_it = NULL;
+}
+
 view_class *notification_view_get_vclass(void)
 {
        return &vclass;
index 883b068..5baa108 100644 (file)
@@ -29,7 +29,6 @@
 #define CLOCK_UPDATE_DUR 1
 #define NOTIFICATION_ITEM_PADDING_X 0
 #define NOTIFICATION_ITEM_PADDING_Y 20
-#define SIG_CHILD_REMOVED "child,removed"
 #define STYLE_LAUNCH "square/notification_launch"
 #define STYLE_CLEAR "square/notification_clear"
 #define STYLE_ITEM "square/notification_item"
@@ -161,7 +160,6 @@ static void _update_list(struct _priv *priv)
 
                        item = elm_button_add(priv->list);
                        elm_object_style_set(item, STYLE_ITEM);
-                       elm_object_focus_allow_set(item, EINA_TRUE);
                        evas_object_data_set(item, KEY_NOTI, noti);
                        inputmgr_add_callback(item, BUTTON_NOTIFICATION,
                                        &button_handler, priv);
@@ -320,7 +318,7 @@ static Evas_Object *_create(Evas_Object *win, void *data)
                        NOTIFICATION_ITEM_PADDING_Y);
        evas_object_show(priv->list);
        elm_object_content_set(scroller, priv->list);
-       evas_object_smart_callback_add(priv->list, SIG_CHILD_REMOVED,
+       evas_object_smart_callback_add(priv->list, SIGNAL_CHILD_REMOVED,
                        _child_removed_cb, NULL);
 
        _create_button(priv);
@@ -387,7 +385,7 @@ static void _destroy(void *view_data)
        priv = (struct _priv *) view_data;
 
        stop_clock_timer(priv);
-       evas_object_smart_callback_del(priv->list, SIG_CHILD_REMOVED,
+       evas_object_smart_callback_del(priv->list, SIGNAL_CHILD_REMOVED,
                        _child_removed_cb);
        inputmgr_remove_callback(priv->clear_btn, &button_handler);
        inputmgr_remove_callback(priv->launch_btn, &button_handler);
index 587eccf..e51da3a 100644 (file)
@@ -111,3 +111,60 @@ void util_clear_notification(void)
                notification_free(noti);
        }
 }
+
+Evas_Object *util_add_icon(Evas_Object *parent, const char *file,
+               const char *part)
+{
+       Evas_Object *ic;
+
+       if (!parent) {
+               _ERR("failed to get parent");
+               return NULL;
+       }
+
+       ic = elm_icon_add(parent);
+       if (!ic) {
+               _ERR("failed to create icon");
+               return NULL;
+       }
+
+       if (file)
+               elm_image_file_set(ic, file, NULL);
+
+       if (part)
+               elm_object_part_content_set(parent, part, ic);
+
+       elm_image_fill_outside_set(ic, EINA_TRUE);
+
+       evas_object_show(ic);
+
+       return ic;
+}
+
+Evas_Object *util_add_button(Evas_Object *parent, const char *part,
+               const char *text, const char *style)
+{
+       Evas_Object *btn;
+
+       if (!parent) {
+               _ERR("Invalid argument.");
+               return NULL;
+       }
+
+       btn = elm_button_add(parent);
+       if (!btn) {
+               _ERR("elm_button_add failed.");
+               return NULL;
+       }
+
+       if (part)
+               elm_object_part_content_set(parent, part, btn);
+       if (text)
+               elm_object_text_set(btn, text);
+       if (style)
+               elm_object_style_set(btn, style);
+
+       evas_object_show(btn);
+
+       return btn;
+}