Network layout: Draw upper buttons 01/49001/1
authorHyojung Jo <hj903.jo@samsung.com>
Mon, 5 Oct 2015 05:00:46 +0000 (14:00 +0900)
committerHyojung Jo <hj903.jo@samsung.com>
Mon, 5 Oct 2015 05:01:50 +0000 (14:01 +0900)
Change-Id: I1a76f352276ee4e3e7445c8d3e7ed56ac6ee89c6
Signed-off-by: Hyojung Jo <hj903.jo@samsung.com>
13 files changed:
include/define.h
include/layout/network.h [new file with mode: 0644]
include/utils.h
res/images/btn_option_arrow_foc_down.png [new file with mode: 0644]
res/images/btn_option_arrow_nor.png [new file with mode: 0644]
res/images/btn_option_arrow_sel.png [new file with mode: 0644]
res/layout/network.edc [new file with mode: 0644]
res/settings-theme.edc
res/settings.edc
res/widget/button.edc
res/widget/ctxpopup.edc [new file with mode: 0644]
src/common/utils.c
src/layout/layout_network.c

index 4dfb785..3409369 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "layout/channel.h"
 #include "layout/support.h"
+#include "layout/network.h"
 
 /* View ID */
 #define VIEW_BASE "VIEW_BASE"
@@ -53,6 +54,9 @@
 #define STYLE_BASE_BTN "style.base.button"
 #define STYLE_NOMARL_BTN "style.normal.button"
 #define STYLE_STATUS_BTN "style.status.button"
+#define STYLE_OPTION_BTN "style.option.button"
+#define STYLE_OPTION_LIST_BTN "style.option.list.button"
+#define STYLE_CTXPOPUP "style.ctxpopup"
 
 /* Signal */
 #define SIG_FOCUSED "elm,action,focus"
 
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 
+/* Image */
+#define ARROW_ICON_DOWN_PNG "btn_option_arrow_nor.png"
+#define ARROW_ICON_DOWN_FOC_PNG "btn_option_arrow_foc_down.png"
+#define ARROW_ICON_SEL_PNG "btn_option_arrow_sel.png"
+
 /* Transition */
 #define TRANSITION_FOCUS DECELERATE 0.20
 
diff --git a/include/layout/network.h b/include/layout/network.h
new file mode 100644 (file)
index 0000000..29ec488
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * 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_SETTINGS_LAYOUT_NETWORK_H__
+#define __AIR_SETTINGS_LAYOUT_NETWORK_H__
+
+/* Group for edc */
+#define GRP_LAYOUT_NETWORK "grp.layout.network"
+
+/* Style */
+
+/* Part for network layout */
+#define PART_NETWORK_TYPE "part.network.type"
+#define PART_REFRESH "part.refresh"
+
+/* Signal for network layout */
+
+/* String for network layout */
+#define STR_WIRELESS "Wireless"
+#define STR_WIRED "Wired"
+#define STR_REFRESH "Refresh"
+#define STR_RETRY "Retry"
+
+/* Count */
+#define COUNT_NETWORK_TYPE 2
+
+/* Size */
+#define SIZE_NETWORK_CTXPOPUP_W 310
+#define SIZE_NETWORK_CTXPOPUP_H 114
+
+#endif  /* __AIR_SETTINGS_LAYOUT_NETWORK_H__ */
index 8d9e4a6..d8d2157 100644 (file)
@@ -28,5 +28,7 @@ Evas_Object *utils_add_progressbar(Evas_Object *parent, const char *part,
 Evas_Object *utils_add_popup(Evas_Object *parent, const char *style,
                const char *popup_title, const char *popup_text);
 Evas_Object *utils_add_table(Evas_Object *parent, int padding_x, int padding_y);
+Evas_Object *utils_add_ctxpopup(Evas_Object *parent, int opt_size, int *opt_id,
+               const char **opt_text, input_handler *opt_handler, void *data);
 
 #endif /* __AIR_SETTINGS_UTILS_H__ */
diff --git a/res/images/btn_option_arrow_foc_down.png b/res/images/btn_option_arrow_foc_down.png
new file mode 100644 (file)
index 0000000..c2304c0
Binary files /dev/null and b/res/images/btn_option_arrow_foc_down.png differ
diff --git a/res/images/btn_option_arrow_nor.png b/res/images/btn_option_arrow_nor.png
new file mode 100644 (file)
index 0000000..aac46a4
Binary files /dev/null and b/res/images/btn_option_arrow_nor.png differ
diff --git a/res/images/btn_option_arrow_sel.png b/res/images/btn_option_arrow_sel.png
new file mode 100644 (file)
index 0000000..21a67ff
Binary files /dev/null and b/res/images/btn_option_arrow_sel.png differ
diff --git a/res/layout/network.edc b/res/layout/network.edc
new file mode 100644 (file)
index 0000000..96c3948
--- /dev/null
@@ -0,0 +1,117 @@
+/*
+ * 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_LAYOUT_NETWORK;
+       parts {
+               part {
+                       name, "area";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               visible, 0;
+                       }
+               }
+
+               part {
+                       name, "padding.button.area1";
+                       type, SPACER;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               min, 0 58;
+                               rel1.to, "area";
+                               rel2 {
+                                       to, "area";
+                                       relative, 1.0 0.0;
+                               }
+                               align, 0.5 0.0;
+                               fixed, 0 1;
+                       }
+               }
+
+               part {
+                       name, "padding.button.area2";
+                       type, SPACER;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               min, 0 64;
+                               rel1 {
+                                       to, "padding.button.area1";
+                                       relative, 0.0 1.0;
+                               }
+                               rel2.to, "padding.button.area1";
+                               align, 0.5 0.0;
+                               fixed, 0 1;
+                       }
+               }
+
+               part {
+                       name, "padding.button.space";
+                       type, SPACER;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               min, 26 0;
+                               rel1 {
+                                       to, "padding.button.area1";
+                                       relative, 0.5 1.0;
+                               }
+                               rel2 {
+                                       to, "padding.button.area2";
+                                       relative, 0.5 1.0;
+                               }
+                               fixed, 1 0;
+                       }
+               }
+
+               part {
+                       name, PART_NETWORK_TYPE;
+                       type, SWALLOW;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               min, 308 0;
+                               rel1.to, "padding.button.space";
+                               rel2 {
+                                       to, "padding.button.space";
+                                       relative, 0.0 1.0;
+                               }
+                               align, 1.0 0.5;
+                               fixed, 1 0;
+                       }
+               }
+
+               part {
+                       name, PART_REFRESH;
+                       type, SWALLOW;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               min, 308 0;
+                               rel1 {
+                                       to, "padding.button.space";
+                                       relative, 1.0 0.0;
+                               }
+                               rel2.to, "padding.button.space";
+                               align, 0.0 0.5;
+                               fixed, 1 0;
+                       }
+               }
+       }
+}
index c3edd6b..09bf430 100644 (file)
@@ -19,4 +19,5 @@
 collections {
        #include "widget/button.edc"
        #include "widget/progressbar.edc"
+       #include "widget/ctxpopup.edc"
 }
index 3f07540..38d0cdd 100644 (file)
@@ -20,4 +20,5 @@ collections {
        #include "view/base.edc"
        #include "layout/channel.edc"
        #include "layout/support.edc"
+       #include "layout/network.edc"
 }
index 6d71a3a..f468fa1 100644 (file)
@@ -678,3 +678,468 @@ group {
                }
        }
 }
+
+group {
+       name, "elm/button/base/style.option.button";
+       data.item, "focus_highlight" "on";
+       images {
+               image, ARROW_ICON_DOWN_PNG COMP;
+               image, ARROW_ICON_DOWN_FOC_PNG COMP;
+               image, ARROW_ICON_SEL_PNG COMP;
+       }
+
+       script {
+               public cur_state;
+       }
+
+       parts {
+               part {
+                       name, "part.bg";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 255 255 255 255;
+                               min, 308 56;
+                       }
+                       description {
+                               state, "focused" 0.0;
+                               inherit, "default" 0.0;
+                               color, 0 119 246 255;
+                       }
+                       description {
+                               state, "selected" 0.0;
+                               inherit, "default" 0.0;
+                       }
+               }
+
+               part {
+                       name, "part.inside.line.up";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 87 87 87 255;
+                               min, 0 2;
+                               rel1.to, "part.bg";
+                               rel2 {
+                                       to, "part.bg";
+                                       relative, 1.0 0.0;
+                               }
+                               align, 0.5 0.0;
+                               fixed, 0 1;
+                       }
+                       description {
+                               state, "focused" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+                       description {
+                               state, "selected" 0.0;
+                               inherit, "default" 0.0;
+                               color, 64 136 211 255;
+                       }
+               }
+
+               part {
+                       name, "part.inside.line.left";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 87 87 87 255;
+                               min, 2 0;
+                               rel1 {
+                                       to, "part.inside.line.up";
+                                       relative, 0.0 1.0;
+                               }
+                               rel2 {
+                                       to, "part.bg";
+                                       relative, 0.0 1.0;
+                               }
+                               align, 0.0 0.5;
+                               fixed, 1 0;
+                       }
+                       description {
+                               state, "focused" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+                       description {
+                               state, "selected" 0.0;
+                               inherit, "default" 0.0;
+                               color, 64 136 211 255;
+                       }
+               }
+
+               part {
+                       name, "part.inside.line.right";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 87 87 87 255;
+                               min, 2 0;
+                               rel1 {
+                                       to, "part.inside.line.up";
+                                       relative, 1.0 1.0;
+                               }
+                               rel2.to, "part.bg";
+                               align, 1.0 0.5;
+                               fixed, 1 0;
+                       }
+                       description {
+                               state, "focused" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+                       description {
+                               state, "selected" 0.0;
+                               inherit, "default" 0.0;
+                               color, 64 136 211 255;
+                       }
+               }
+
+               part {
+                       name, "part.inside.line.down";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 87 87 87 255;
+                               min, 0 2;
+                               rel1 {
+                                       to, "part.inside.line.left";
+                                       relative, 1.0 1.0;
+                               }
+                               rel2 {
+                                       to, "part.inside.line.right";
+                                       relative, 0.0 1.0;
+                               }
+                               align, 0.5 1.0;
+                               fixed, 0 1;
+                       }
+                       description {
+                               state, "focused" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+                       description {
+                               state, "selected" 0.0;
+                               inherit, "default" 0.0;
+                               color, 64 136 211 255;
+                       }
+               }
+
+               part {
+                       name, "padding.text.left";
+                       type, SPACER;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               min, 30 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, 54 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, 32;
+                                       align, 0.0 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;
+                       }
+               }
+
+               part {
+                       name, "padding.arrow";
+                       type, SPACER;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               min, 4 0;
+                               rel1 {
+                                       to, "padding.text.right";
+                                       relative, 0.0 0.5;
+                               }
+                               rel2 {
+                                       to, "padding.text.right";
+                                       relative, 0.0 0.5;
+                               }
+                               align, 0.0 0.5;
+                               fixed, 1 0;
+                       }
+               }
+
+               part {
+                       name, "part.arrow";
+                       type, IMAGE;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               min, 20 30;
+                               image.normal, ARROW_ICON_DOWN_PNG;
+                               rel1 {
+                                       to, "padding.arrow";
+                                       relative, 1.0 1.0;
+                               }
+                               rel2.to, "padding.arrow";
+                               align, 0.0 0.5;
+                               fixed, 1 1;
+                       }
+                       description {
+                               state, "focused" 0.0;
+                               inherit, "default" 0.0;
+                               image.normal, ARROW_ICON_DOWN_FOC_PNG;
+                       }
+                       description {
+                               state, "selected" 0.0;
+                               inherit, "default" 0.0;
+                               image.normal, ARROW_ICON_SEL_PNG;
+                       }
+               }
+       }
+
+       programs {
+               program {
+                       name, SIG_FOCUSED;
+                       signal, SIG_FOCUSED;
+                       source, SRC_ELM;
+                       script {
+                               set_int(cur_state, STATE_NORMAL);
+                               run_program(PROGRAM:"focused,anim");
+                       }
+               }
+
+               program {
+                       name, SIG_UNFOCUSED;
+                       signal, SIG_UNFOCUSED;
+                       source, SRC_ELM;
+                       script {
+                               new state;
+                               state = get_int(cur_state);
+                               if (state == STATE_SELECTED) {
+                                       set_state(PART:"part.bg", "selected", 0.0);
+                                       set_state(PART:"part.inside.line.up", "selected", 0.0);
+                                       set_state(PART:"part.inside.line.down", "selected", 0.0);
+                                       set_state(PART:"part.inside.line.left", "selected", 0.0);
+                                       set_state(PART:"part.inside.line.right", "selected", 0.0);
+                                       set_state(PART:"elm.text", "selected", 0.0);
+                                       set_state(PART:"part.arrow", "selected", 0.0);
+                               } else {
+                                       run_program(PROGRAM:"unfocused,anim");
+                               }
+                       }
+               }
+
+               program {
+                       name, "focused,anim";
+                       action, STATE_SET "focused" 0.0;
+                       target, "part.bg";
+                       target, "part.inside.line.up";
+                       target, "part.inside.line.down";
+                       target, "part.inside.line.left";
+                       target, "part.inside.line.right";
+                       target, "elm.text";
+                       target, "part.arrow";
+                       transition, TRANSITION_FOCUS;
+               }
+
+               program {
+                       name, "unfocused,anim";
+                       action, STATE_SET "default" 0.0;
+                       target, "part.bg";
+                       target, "part.inside.line.up";
+                       target, "part.inside.line.down";
+                       target, "part.inside.line.left";
+                       target, "part.inside.line.right";
+                       target, "elm.text";
+                       target, "part.arrow";
+                       transition, TRANSITION_FOCUS;
+               }
+
+               program {
+                       name, SIG_SELECTED;
+                       signal, SIG_SELECTED;
+                       source, SRC_ELM;
+                       script {
+                               set_int(cur_state, STATE_SELECTED);
+                               set_state(PART:"part.bg", "selected", 0.0);
+                               set_state(PART:"part.inside.line.up", "selected", 0.0);
+                               set_state(PART:"part.inside.line.down", "selected", 0.0);
+                               set_state(PART:"part.inside.line.left", "selected", 0.0);
+                               set_state(PART:"part.inside.line.right", "selected", 0.0);
+                               set_state(PART:"elm.text", "selected", 0.0);
+                               set_state(PART:"part.arrow", "selected", 0.0);
+                       }
+               }
+       }
+}
+
+group {
+       name, "elm/button/base/style.option.list.button";
+       inherit, "elm/button/base/style.option.button";
+       parts {
+               part {
+                       name, "part.inside.line.up";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               visible, 0;
+                       }
+                       description {
+                               state, "focused" 0.0;
+                               inherit, "default" 0.0;
+                       }
+                       description {
+                               state, "selected" 0.0;
+                               inherit, "default" 0.0;
+                       }
+               }
+
+               part {
+                       name, "part.inside.line.left";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               visible, 0;
+                       }
+                       description {
+                               state, "focused" 0.0;
+                               inherit, "default" 0.0;
+                       }
+                       description {
+                               state, "selected" 0.0;
+                               inherit, "default" 0.0;
+                       }
+               }
+
+               part {
+                       name, "part.inside.line.down";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               visible, 0;
+                       }
+                       description {
+                               state, "focused" 0.0;
+                               inherit, "default" 0.0;
+                       }
+                       description {
+                               state, "selected" 0.0;
+                               inherit, "default" 0.0;
+                       }
+               }
+
+               part {
+                       name, "part.inside.line.right";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               visible, 0;
+                       }
+                       description {
+                               state, "focused" 0.0;
+                               inherit, "default" 0.0;
+                       }
+                       description {
+                               state, "selected" 0.0;
+                               inherit, "default" 0.0;
+                       }
+               }
+
+               part {
+                       name, "elm.text";
+                       type, TEXT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 87 87 87 255;
+                               text {
+                                       font, FONT_LIGHT;
+                                       size, 28;
+                                       align, 0.0 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;
+                       }
+               }
+
+               part {
+                       name, "part.arrow";
+                       type, IMAGE;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               visible, 0;
+                       }
+                       description {
+                               state, "focused" 0.0;
+                               inherit, "default" 0.0;
+                       }
+                       description {
+                               state, "selected" 0.0;
+                               inherit, "default" 0.0;
+                       }
+               }
+       }
+}
diff --git a/res/widget/ctxpopup.edc b/res/widget/ctxpopup.edc
new file mode 100644 (file)
index 0000000..1ab7cf4
--- /dev/null
@@ -0,0 +1,111 @@
+group {
+       name, "elm/ctxpopup/base/style.ctxpopup";
+       data.item, "focus_hightlight" "on";
+       parts {
+               part {
+                       name, "part.bg";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 255 255 255 255;
+                       }
+               }
+
+               part {
+                       name, "part.inside.line.up";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 154 154 154 255;
+                               min, 0 1;
+                               rel2.relative, 1.0 0.0;
+                               align, 0.5 0.0;
+                               fixed, 0 1;
+                       }
+               }
+
+               part {
+                       name, "part.inside.line.left";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 154 154 154 255;
+                               min, 1 0;
+                               rel1 {
+                                       to, "part.inside.line.up";
+                                       relative, 0.0 1.0;
+                               }
+                               rel2.relative, 0.0 1.0;
+                               align, 0.0 0.5;
+                               fixed, 1 0;
+                       }
+               }
+
+               part {
+                       name, "part.inside.line.right";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 154 154 154 255;
+                               min, 1 0;
+                               rel1 {
+                                       to, "part.inside.line.up";
+                                       relative, 1.0 1.0;
+                               }
+                               align, 1.0 0.5;
+                               fixed, 1 0;
+                       }
+               }
+
+               part {
+                       name, "part.inside.line.down";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 154 154 154 255;
+                               min, 0 1;
+                               rel1 {
+                                       to, "part.inside.line.left";
+                                       relative, 1.0 1.0;
+                               }
+                               rel2 {
+                                       to, "part.inside.line.right";
+                                       relative, 0.0 1.0;
+                               }
+                               align, 0.5 1.0;
+                               fixed, 0 1;
+                       }
+               }
+
+               part {
+                       name, "elm.swallow.content";
+                       type, SWALLOW;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               rel1 {
+                                       to, "part.inside.line.left";
+                                       relative, 1.0 0.0;
+                               }
+                               rel2 {
+                                       to, "part.inside.line.down";
+                                       relative, 1.0 0.0;
+                               }
+                       }
+               }
+       }
+
+       programs {
+               program {
+                       name, "hide";
+                       signal, "elm,state,hide";
+                       source, "elm";
+                       action, SIGNAL_EMIT "elm,action,hide,finished" "elm";
+               }
+       }
+}
index 5028f15..dbce0e4 100644 (file)
  */
 
 #include <Elementary.h>
+#include <inputmgr.h>
 #include <app_debug.h>
 
+#include "define.h"
+
 Evas_Object *utils_add_layout(Evas_Object *parent, const char *group,
                Eina_Bool win_resize)
 {
@@ -184,3 +187,57 @@ Evas_Object *utils_add_table(Evas_Object *parent, int padding_x, int padding_y)
 
        return table;
 }
+
+Evas_Object *utils_add_ctxpopup(Evas_Object *parent, int opt_size, int *opt_id,
+               const char **opt_text, input_handler *opt_handler, void *data)
+{
+       Evas_Object *ctxpopup, *box, *btn = NULL, *firstbtn = NULL;
+       int i;
+
+       if (!parent || opt_size <= 0 || !opt_text) {
+               _ERR("Invalid argument.");
+               return NULL;
+       }
+
+       ctxpopup = elm_ctxpopup_add(parent);
+       if (!ctxpopup) {
+               _ERR("elm_ctxpopup_add failed.");
+               return NULL;
+       }
+
+       box = utils_add_box(ctxpopup, NULL, EINA_FALSE, 0, 0);
+       if (!box) {
+               _ERR("Add box failed.");
+               evas_object_del(ctxpopup);
+               return NULL;
+       }
+
+       elm_object_style_set(ctxpopup, STYLE_CTXPOPUP);
+       elm_object_content_set(ctxpopup, box);
+       elm_ctxpopup_direction_priority_set(ctxpopup, 0, 0, 0, 0);
+       evas_object_show(ctxpopup);
+
+       for (i = 0; i < opt_size; i++) {
+               btn = utils_add_button(box, NULL, STYLE_OPTION_LIST_BTN,
+                               opt_text[i]);
+               if (!btn) {
+                       _ERR("Add button failed.");
+                       evas_object_del(ctxpopup);
+                       return NULL;
+               }
+
+               elm_box_pack_end(box, btn);
+
+               if (opt_handler)
+                       inputmgr_add_callback(btn, opt_id[i],
+                                       opt_handler, data);
+
+               if (i == 0)
+                       firstbtn = btn;
+       }
+
+       elm_object_focus_next_object_set(firstbtn, btn, ELM_FOCUS_UP);
+       elm_object_focus_next_object_set(btn, firstbtn, ELM_FOCUS_DOWN);
+
+       return ctxpopup;
+}
\ No newline at end of file
index 9df7566..d015de5 100644 (file)
  */
 
 #include <Elementary.h>
+#include <viewmgr.h>
 #include <layoutmgr.h>
+#include <inputmgr.h>
+#include <app_debug.h>
 
 #include "define.h"
 #include "layout.h"
+#include "utils.h"
+#include "view_base.h"
+
+enum network_type {
+       TYPE_WIRELESS = 0,
+       TYPE_WIRED,
+};
+
+static int id_network_type_opt[] = {
+       TYPE_WIRELESS,
+       TYPE_WIRED,
+};
+
+const char *str_network_type_opt[] = {
+       STR_WIRELESS,
+       STR_WIRED,
+};
+
+struct _priv {
+       Evas_Object *base;
+       Evas_Object *ly;
+       Evas_Object *network_type_btn;
+       Evas_Object *action_btn;
+       Evas_Object *network_type_popup;
+       enum network_type cur_type;
+};
+
+static void _mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj,
+               Evas_Event_Mouse_Move *ev)
+{
+       if (!obj) {
+               _ERR("Invalid argument.");
+               return;
+       }
+
+       if (!elm_object_focus_get(obj))
+               elm_object_focus_set(obj, EINA_TRUE);
+}
+
+static void _destroy_network_type_popup(struct _priv *priv)
+{
+       evas_object_hide(priv->network_type_popup);
+       evas_object_del(priv->network_type_popup);
+       priv->network_type_popup = NULL;
+}
+
+static void _network_type_option_selected(struct _priv *priv, int id,
+               Evas_Object *obj)
+{
+       _destroy_network_type_popup(priv);
+
+       elm_object_text_set(priv->network_type_btn, elm_object_text_get(obj));
+
+       switch (id) {
+       case TYPE_WIRELESS:
+               elm_object_text_set(priv->action_btn, STR_REFRESH);
+
+               /* It will implemented later */
+               break;
+
+       case TYPE_WIRED:
+               elm_object_text_set(priv->action_btn, STR_RETRY);
+
+               /* It will implemented later */
+               break;
+
+       default:
+               _ERR("Unhandled network type.");
+               return;
+       }
+
+       priv->cur_type = id;
+}
+
+static void _network_type_option_key_down_cb(int id, void *data, Evas *e,
+               Evas_Object *obj, Evas_Event_Key_Down *ev)
+{
+       struct _priv *priv;
+
+       if (!data || !obj || !ev) {
+               _ERR("Invalid argument.");
+               return;
+       }
+       priv = data;
+
+       if (!strcmp(ev->keyname, KEY_BACK) || !strcmp(ev->keyname, KEY_ESC))
+               _destroy_network_type_popup(priv);
+       else if (!strcmp(ev->keyname, KEY_ENTER))
+               _network_type_option_selected(priv, id, obj);
+}
+
+static void _network_type_option_mouse_down_cb(int id, void *data, Evas *e,
+               Evas_Object *obj, Evas_Event_Mouse_Down *ev)
+{
+       struct _priv *priv;
+
+       if (!data || !obj || !ev) {
+               _ERR("Invalid argument.");
+               return;
+       }
+       priv = data;
+
+       _network_type_option_selected(priv, id, obj);
+}
+
+static input_handler _network_type_option_input_handler = {
+       .mouse_move = _mouse_move_cb,
+       .key_down = _network_type_option_key_down_cb,
+       .mouse_down = _network_type_option_mouse_down_cb
+};
+
+static void _draw_network_type_popup(struct _priv *priv)
+{
+       Evas_Object *ctxpopup;
+       Evas_Coord x, y, w, h;
+
+       elm_object_signal_emit(priv->network_type_btn, SIG_SELECTED, SRC_ELM);
+
+       ctxpopup = utils_add_ctxpopup(priv->ly, COUNT_NETWORK_TYPE,
+                       id_network_type_opt, str_network_type_opt,
+                       &_network_type_option_input_handler, priv);
+       if (!ctxpopup) {
+               _ERR("Add ctxpopup failed.");
+               return;
+       }
+
+       evas_object_geometry_get(priv->network_type_btn, &x, &y, &w, &h);
+       evas_object_move(ctxpopup, (x + w / 2) * elm_config_scale_get(),
+                       (y + h) * elm_config_scale_get());
+       evas_object_size_hint_min_set(ctxpopup, SIZE_NETWORK_CTXPOPUP_W,
+                       SIZE_NETWORK_CTXPOPUP_H);
+
+       priv->network_type_popup = ctxpopup;
+
+       elm_object_focus_set(priv->network_type_popup, EINA_TRUE);
+}
+
+static void _network_type_key_down_cb(int id, void *data, Evas *e,
+               Evas_Object *obj, Evas_Event_Key_Down *ev)
+{
+       struct _priv *priv;
+
+       if (!data || !ev) {
+               _ERR("Invalid argument.");
+               return;
+       }
+       priv = data;
+
+       if (!strcmp(ev->keyname, KEY_BACK) || !strcmp(ev->keyname, KEY_ESC)
+                       || !strcmp(ev->keyname, KEY_UP))
+               viewmgr_update_view(VIEW_BASE, UPDATE_FOCUS, NULL);
+       else if (!strcmp(ev->keyname, KEY_ENTER))
+               _draw_network_type_popup(priv);
+}
+
+static void _refresh_wireless_network_list(struct _priv *priv)
+{
+       /* It will implemented later */
+}
+
+static void _retry_wired_network(struct _priv *priv)
+{
+       /* It will implemented later */
+}
+
+static void _action_key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
+               Evas_Event_Key_Down *ev)
+{
+       struct _priv *priv;
+
+       if (!data || !ev) {
+               _ERR("Invalid argument.");
+               return;
+       }
+       priv = data;
+
+       if (!strcmp(ev->keyname, KEY_BACK) || !strcmp(ev->keyname, KEY_ESC)
+                       || !strcmp(ev->keyname, KEY_UP)) {
+               viewmgr_update_view(VIEW_BASE, UPDATE_FOCUS, NULL);
+       } else if (!strcmp(ev->keyname, KEY_ENTER)) {
+               switch (priv->cur_type) {
+               case TYPE_WIRELESS:
+                       _refresh_wireless_network_list(priv);
+                       break;
+
+               case TYPE_WIRED:
+                       _retry_wired_network(priv);
+                       break;
+
+               default:
+                       break;
+               }
+       }
+}
+
+static input_handler _network_type_input_handler = {
+       .mouse_move = _mouse_move_cb,
+       .key_down = _network_type_key_down_cb,
+};
+
+static input_handler _action_input_handler = {
+       .mouse_move = _mouse_move_cb,
+       .key_down = _action_key_down_cb,
+};
+
+static bool _draw_network_buttons(struct _priv *priv)
+{
+       Evas_Object *btn1, *btn2;
+
+       btn1 = utils_add_button(priv->ly, PART_NETWORK_TYPE, STYLE_OPTION_BTN,
+                       STR_WIRELESS);
+       if (!btn1) {
+               _ERR("Add button failed.");
+               return false;
+       }
+
+       btn2 = utils_add_button(priv->ly, PART_REFRESH, STYLE_BASE_BTN,
+                       STR_REFRESH);
+       if (!btn2) {
+               _ERR("Add button failed.");
+               return false;
+       }
+
+       elm_object_focus_next_object_set(btn1, btn1, ELM_FOCUS_LEFT);
+       elm_object_focus_next_object_set(btn2, btn2, ELM_FOCUS_RIGHT);
+
+       inputmgr_add_callback(btn1, 0, &_network_type_input_handler, priv);
+       inputmgr_add_callback(btn2, 0, &_action_input_handler, priv);
+
+       priv->network_type_btn = btn1;
+       priv->action_btn = btn2;
+       priv->cur_type = TYPE_WIRELESS;
+
+       return true;
+}
 
 static bool _create(layoutmgr *lmgr, void *data)
 {
-       /* It will be implemented later */
+       struct _priv *priv;
+       Evas_Object *base, *ly;
+
+       if (!lmgr) {
+               _ERR("Invalid argument.");
+               return false;
+       }
+
+       base = layoutmgr_get_base(lmgr);
+       if (!base) {
+               _ERR("Get base layout failed.");
+               return false;
+       }
+
+       ly = utils_add_layout(base, GRP_LAYOUT_NETWORK, EINA_FALSE);
+       if (!ly) {
+               _ERR("Add layout failed.");
+               return false;
+       }
+
+       priv = calloc(1, sizeof(*priv));
+       if (!priv) {
+               _ERR("Calloc failed.");
+               evas_object_del(ly);
+               return false;
+       }
+
+       priv->base = base;
+       priv->ly = ly;
+
+       if (!_draw_network_buttons(priv)) {
+               _ERR("Draw network buttons failed.");
+               free(priv);
+               evas_object_del(ly);
+               return false;
+       }
+
+       layoutmgr_set_layout_data(lmgr, LAYOUT_ID_NETWORK, priv);
+
        return true;
 }
 
 static void _show(void *layout_data)
 {
-       /* It will be implemented later */
+       struct _priv *priv;
+
+       if (!layout_data) {
+               _ERR("Invalid argument.");
+               return;
+       }
+
+       priv = layout_data;
+
+       if (priv->ly) {
+               evas_object_show(priv->ly);
+               elm_object_part_content_set(priv->base, PART_CONTENT, priv->ly);
+       }
 }
 
 static void _hide(void *layout_data)
 {
-       /* It will be implemented later */
+       struct _priv *priv;
+
+       if (!layout_data) {
+               _ERR("Invalid argument.");
+               return;
+       }
+
+       priv = layout_data;
+
+       if (priv->ly) {
+               evas_object_hide(priv->ly);
+               elm_object_part_content_unset(priv->base, PART_CONTENT);
+       }
 }
 
 static void _destroy(void *layout_data)
 {
-       /* It will be implemented later */
+       struct _priv *priv;
+
+       if (!layout_data) {
+               _ERR("Invalid argument.");
+               return;
+       }
+
+       priv = layout_data;
+
+       evas_object_del(priv->ly);
+
+       free(priv);
 }
 
 static layout_class _lclass = {