add initial action menu view 10/45810/2 accepted/tizen/tv/20150813.055045 submit/tizen/20150813.021018
authorJehun Lim <jehun.lim@samsung.com>
Mon, 10 Aug 2015 11:43:43 +0000 (20:43 +0900)
committerJehun Lim <jehun.lim@samsung.com>
Tue, 11 Aug 2015 12:05:28 +0000 (21:05 +0900)
Change-Id: I8ca095e9896a6791121609878e32de9155095981
Signed-off-by: Jehun Lim <jehun.lim@samsung.com>
CMakeLists.txt
include/define.h
include/view.h
include/view/action_menu.h [new file with mode: 0644]
res/edc/mediahub.edc
res/edc/view/action_menu.edc [new file with mode: 0644]
src/main.c
src/view/action_menu.c [new file with mode: 0644]

index 11a6b8a..8f4c9db 100644 (file)
@@ -60,6 +60,7 @@ src/main.c
 src/view/base.c
 src/view/viewer.c
 src/view/mplayer.c
+src/view/action_menu.c
 src/layout/movie.c
 src/layout/gallery.c
 src/layout/music.c
index f2fe159..5872281 100644 (file)
@@ -21,6 +21,7 @@
 #include "view/base.h"
 #include "view/viewer.h"
 #include "view/mplayer.h"
+#include "view/action_menu.h"
 
 /* layouts */
 #include "layout/movie.h"
index ebb5a0e..653bd34 100644 (file)
@@ -26,6 +26,9 @@ view_class *view_viewer_get_vclass(void);
 /* music player */
 view_class *view_mplayer_get_vclass(void);
 
+/* action menu */
+view_class *view_action_menu_get_vclass(void);
+
 /* view data */
 struct view_update_data {
        Eina_List *list;
diff --git a/include/view/action_menu.h b/include/view/action_menu.h
new file mode 100644 (file)
index 0000000..f74b934
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * 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_MEDIAHUB_VIEW_ACTION_MENU_H__
+#define __AIR_MEDIAHUB_VIEW_ACTION_MENU_H__
+
+/* view */
+#define VIEW_ACTION_MENU "VIEW_ACTION_MENU"
+
+/* group */
+#define GRP_ACTION_MENU_VIEW "group.action_menu_view"
+
+/* part */
+#define PART_ACTION_TV_BTN "part.action_tv_btn"
+#define PART_ACTION_MENU_AREA "part.action_menu_area"
+#define PART_ACTION_FAVORITE_TITLE "part.action_favorite_title"
+#define PART_ACTION_FAVORITE_AREA "part.action_favorite_area"
+
+#endif /* __AIR_MEDIAHUB_VIEW_ACTION_MENU_H__ */
index 448edc8..c73dcd1 100644 (file)
@@ -20,6 +20,7 @@ collections {
        #include "view/base.edc"
        #include "view/viewer.edc"
        #include "view/mplayer.edc"
+       #include "view/action_menu.edc"
        #include "layout/movie.edc"
        #include "layout/gallery.edc"
        #include "layout/music.edc"
diff --git a/res/edc/view/action_menu.edc b/res/edc/view/action_menu.edc
new file mode 100644 (file)
index 0000000..2ba3028
--- /dev/null
@@ -0,0 +1,171 @@
+/*
+ * 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_ACTION_MENU_VIEW;
+       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;
+                               rel1.relative: 1.0 0.0;
+                               min: 500 0;
+                               align: 1.0 0.5;
+                               color: COLOR_ITEM_BG;
+                               fixed: 1 0;
+                       }
+               }
+               part {
+                       name: "divider";
+                       type: RECT;
+                       scale: 1;
+                       description {
+                               state: "default" 0.0;
+                               rel1.to: "menu_area";
+                               rel2 {
+                                       to: "menu_area";
+                                       relative: 0.0 1.0;
+                               }
+                               min: 1 0;
+                               align: 1.0 0.5;
+                               color: 0 0 0 25;
+                               fixed: 1 0;
+                       }
+               }
+               part {
+                       name: "tv_btn_area";
+                       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_ACTION_TV_BTN;
+                       type: SWALLOW;
+                       scale: 1;
+                       description {
+                               state: "default" 0.0;
+                               rel1 {
+                                       to: "tv_btn_area";
+                                       relative: 0.5 0.5;
+                               }
+                               rel2 {
+                                       to: "tv_btn_area";
+                                       relative: 0.5 0.5;
+                               }
+                               min: 372 64;
+                               fixed: 1 1;
+                       }
+               }
+               part {
+                       name: PART_ACTION_MENU_AREA;
+                       type: SWALLOW;
+                       scale: 1;
+                       description {
+                               state: "default" 0.0;
+                               rel1 {
+                                       to: "tv_btn_area";
+                                       relative: 0.0 1.0;
+                               }
+                               rel2.to: "tv_btn_area";
+                               min: 0 251;
+                               align: 0.5 0.0;
+                               fixed: 0 1;
+                       }
+               }
+               part {
+                       name: "padding_favorite_title";
+                       type: SPACER;
+                       scale: 1;
+                       description {
+                               state: "default" 0.0;
+                               rel1 {
+                                       to: PART_ACTION_MENU_AREA;
+                                       relative: 0.0 1.0;
+                               }
+                               rel2.to: PART_ACTION_MENU_AREA;
+                               min: 0 40;
+                               align: 0.5 0.0;
+                               fixed: 0 1;
+                       }
+               }
+               part {
+                       name: PART_ACTION_FAVORITE_TITLE;
+                       type: TEXT;
+                       scale: 1;
+                       description {
+                               state: "default" 0.0;
+                               rel1 {
+                                       to: "padding_favorite_title";
+                                       relative: 0.0 1.0;
+                               }
+                               rel2.to: "padding_favorite_title";
+                               min: 0 32;
+                               align: 0.5 0.0;
+                               fixed: 0 1;
+                       }
+               }
+               part {
+                       name: "padding_favorite_area";
+                       type: SPACER;
+                       scale: 1;
+                       description {
+                               state: "default" 0.0;
+                               rel1 {
+                                       to: PART_ACTION_FAVORITE_TITLE;
+                                       relative: 0.0 1.0;
+                               }
+                               rel2.to: PART_ACTION_FAVORITE_TITLE;
+                               min: 0 30;
+                               align: 0.5 0.0;
+                               fixed: 0 1;
+                       }
+               }
+               part {
+                       name: PART_ACTION_FAVORITE_AREA;
+                       type: SWALLOW;
+                       scale: 1;
+                       description {
+                               state: "default" 0.0;
+                               rel1 {
+                                       to: "padding_favorite_area";
+                                       relative: 0.0 1.0;
+                               }
+                               rel2.to: "bg";
+                       }
+               }
+       }
+}
index b3272f7..36f007d 100644 (file)
@@ -90,6 +90,7 @@ static bool _create(void *data)
        viewmgr_add_view(view_base_get_vclass(), NULL);
        viewmgr_add_view(view_viewer_get_vclass(), NULL);
        viewmgr_add_view(view_mplayer_get_vclass(), NULL);
+       viewmgr_add_view(view_action_menu_get_vclass(), NULL);
 
        elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
        elm_win_focus_highlight_style_set(win, STYLE_INVISIBLE);
@@ -113,6 +114,7 @@ static void _terminate(void *data)
        viewmgr_remove_view(VIEW_BASE);
        viewmgr_remove_view(VIEW_VIEWER);
        viewmgr_remove_view(VIEW_MPLAYER);
+       viewmgr_remove_view(VIEW_ACTION_MENU);
 
        viewmgr_destroy();
 
diff --git a/src/view/action_menu.c b/src/view/action_menu.c
new file mode 100644 (file)
index 0000000..ef0cc30
--- /dev/null
@@ -0,0 +1,120 @@
+/*
+ * 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 <app_debug.h>
+#include <viewmgr.h>
+
+#include "define.h"
+
+struct _priv {
+       Evas_Object *win;
+       Evas_Object *base;
+};
+
+static Evas_Object *_create(Evas_Object *win, void *data)
+{
+       struct _priv *priv;
+       Evas_Object *base;
+
+       if (!win) {
+               _ERR("failed to get win object");
+               return NULL;
+       }
+
+       priv = calloc(1, sizeof(*priv));
+       if (!priv) {
+               _ERR("failed to allocate priv");
+               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_ACTION_MENU_VIEW);
+
+       evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND,
+                               EVAS_HINT_EXPAND);
+       elm_win_resize_object_add(win, base);
+
+       priv->win = win;
+       priv->base = base;
+
+       viewmgr_set_view_data(VIEW_ACTION_MENU, priv);
+
+       return base;
+}
+
+static void _show(void *view_data)
+{
+       struct _priv *priv;
+
+       if (!view_data) {
+               _ERR("failed to get view data");
+               return;
+       }
+
+       priv = view_data;
+
+       evas_object_show(priv->base);
+}
+
+static void _hide(void *view_data)
+{
+       struct _priv *priv;
+
+       if (!view_data) {
+               _ERR("failed to get view data");
+               return;
+       }
+
+       priv = view_data;
+
+       evas_object_hide(priv->base);
+}
+
+static void _destroy(void *view_data)
+{
+       struct _priv *priv;
+
+       if (!view_data) {
+               _ERR("failed to get view data");
+               return;
+       }
+
+       priv = view_data;
+
+       evas_object_del(priv->base);
+
+       free(priv);
+}
+
+static view_class _vclass = {
+       .view_id = VIEW_ACTION_MENU,
+       .create = _create,
+       .show = _show,
+       .hide = _hide,
+       .destroy = _destroy,
+};
+
+view_class *view_action_menu_get_vclass(void)
+{
+       return &_vclass;
+}