} appdata_s;
Evas_Object *create_content(Evas_Object *parent, const char *text, Evas_Smart_Cb prev_btn_clicked_cb, Evas_Smart_Cb next_btn_clicked_cb, appdata_s *ad);
+Evas_Object *create_tabbar(Evas_Object *parent);
#define TIZEN_VIEW_BACK_BUTTON_TITLE_RIGHT_PADDING_WIDTH_INC 90
#define BUTTON_TIZEN_VIEW_BACK_BUTTON_SIZE_INC 80 80
#define TIZEN_VIEW_TITLE_RIGHT_PADDING_WIDTH_INC 32
+#define TIZEN_VIEW_TABBAR_TITLE_TOP_PADDING_HEIGHT_INC 80
+#define TIZEN_VIEW_TABBAR_TITLE_HEIGHT_INC 100
+#define TIZEN_VIEW_TABBAR_TITLE_CLIPPER_HEIGHT_INC 80
+#define TIZEN_VIEW_TABBAR_LIGHT_VIEW_HEIGHT_INC 86
+#define TIZEN_VIEW_TABBAR2_HEIGHT_INC 144
+#define TIZEN_VIEW_TABBAR_TOP_DIVIDER_HEIGHT_INC 0
collections {
base_scale: 2.6;
}
}
}
+ group { name: "elm/layout/tizen_view/tabbar";
+ inherit: "elm/layout/tizen_view/default";
+ parts {
+ part { name: "tabbar_top_padding";
+ type: SPACER;
+ scale: 1;
+ repeat_events: 1;
+ description { state: "default" 0.0;
+ min: 0 TIZEN_VIEW_TABBAR_TITLE_TOP_PADDING_HEIGHT_INC;
+ max: -1 TIZEN_VIEW_TABBAR_TITLE_TOP_PADDING_HEIGHT_INC;
+ fixed: 0 1;
+ align: 0.5 0.0;
+ rel1 { to: "title_bg"; relative: 0.0 0.0; }
+ rel2 { to: "title_bg"; relative: 1.0 0.0; }
+ }
+ }
+ part { name: "tabbar";
+ type: SWALLOW;
+ scale: 1;
+ clip_to: "tabbar_clipper";
+ description { state: "default" 0.0;
+ min: 0 0;
+ max: -1 0;
+ fixed: 0 1;
+ align: 0.5 0.0;
+ rel1 { to: "tabbar_top_padding"; relative: 0.0 1.0; }
+ rel2 { to: "tabbar_top_padding"; relative: 1.0 1.0; }
+ visible: 0;
+ }
+ description { state: "visible" 0.0;
+ inherit: "default" 0.0;
+ min: 0 TIZEN_VIEW_TABBAR_TITLE_HEIGHT_INC;
+ max: -1 TIZEN_VIEW_TABBAR_TITLE_HEIGHT_INC;
+ visible: 1;
+ }
+ }
+ part { name: "tabbar_top_divider";
+ type: RECT;
+ scale: 1;
+ mouse_events: 0;
+ clip_to: "tabbar_clipper";
+ description { state: "default" 0.0;
+ min: 0 0;
+ max: -1 0;
+ fixed: 0 1;
+ align: 0.5 0.0;
+ rel1 { to: "tabbar_clipper"; relative: 0.0 0.0; }
+ rel2 { to: "tabbar_clipper"; relative: 1.0 0.0; }
+ color: 244 244 244 25;
+ visible: 0;
+ }
+ description { state: "visible" 0.0;
+ inherit: "default" 0.0;
+ min: 0 TIZEN_VIEW_TABBAR_TOP_DIVIDER_HEIGHT_INC;
+ max: -1 TIZEN_VIEW_TABBAR_TOP_DIVIDER_HEIGHT_INC;
+ visible: 1;
+ }
+ }
+ part { name: "tabbar_clipper";
+ type: RECT;
+ scale: 1;
+ mouse_events: 0;
+ clip_to: "clipper";
+ description { state: "default" 0.0;
+ min: 0 TIZEN_VIEW_TABBAR_TITLE_CLIPPER_HEIGHT_INC;
+ max: -1 TIZEN_VIEW_TABBAR_TITLE_CLIPPER_HEIGHT_INC;
+ fixed: 0 1;
+ align: 0.5 1.0;
+ rel1 { to: "tabbar"; relative: 0.0 1.0; }
+ rel2 { to: "tabbar"; relative: 1.0 1.0; }
+ }
+ }
+ part { name: "elm.swallow.content";
+ type: SWALLOW;
+ scale: 1;
+ repeat_events: 0;
+ clip_to: "content_clipper";
+ description { state: "default" 0.0;
+ align: 0.0 0.0;
+ rel1 { to_x: "base"; to_y: "tabbar"; relative: 0.0 1.0; }
+ rel2 { to_x: "base"; to_y: "toolbar"; relative: 1.0 0.0; }
+ }
+ }
+ }
+ programs {
+ program { name: "title_show";
+ signal: "elm,state,title,show";
+ source: "elm";
+ script {
+ set_state(PART:"title_bg", "default", 0.0);
+ set_state(PART:"title_clipper", "default", 0.0);
+ if (get_int(title_left_btn_visible)) {
+ set_state(PART:"title_left_btn_bg", "visible", 0.0);
+ set_state(PART:"title_left_padding", "hidden", 0.0);
+ set_state(PART:"title_left_btn", "visible", 0.0);
+ set_state(PART:"title_right_btn_bg", "visible", 0.0);
+ set_state(PART:"title_right_padding", "hidden", 0.0);
+ }
+ else if (get_int(prev_btn_visible))
+ set_state(PART:"elm.swallow.prev_btn", "default", 0.0);
+ if (get_int(title_right_btn_visible)) {
+ set_state(PART:"title_right_btn_bg", "visible", 0.0);
+ set_state(PART:"title_right_padding", "hidden", 0.0);
+ set_state(PART:"title_right_btn", "visible", 0.0);
+ set_state(PART:"title_left_btn_bg", "visible", 0.0);
+ set_state(PART:"title_left_padding", "hidden", 0.0);
+ }
+ if (get_int(tabbar_visible)) {
+ set_state(PART:"tabbar", "visible", 0.0);
+ set_state(PART:"tabbar_top_divider", "visible", 0.0);
+ }
+ }
+ }
+ program { name: "title_hide";
+ signal: "elm,state,title,hide";
+ source: "elm";
+ script {
+ set_state(PART:"title_bg", "hidden", 0.0);
+ set_state(PART:"title_clipper", "hidden", 0.0);
+ set_state(PART:"title_left_btn_bg", "default", 0.0);
+ set_state(PART:"title_left_padding", "default", 0.0);
+ set_state(PART:"title_left_btn", "default", 0.0);
+ set_state(PART:"title_right_btn_bg", "default", 0.0);
+ set_state(PART:"title_right_padding", "default", 0.0);
+ set_state(PART:"title_right_btn", "default", 0.0);
+ set_state(PART:"tabbar", "default", 0.0);
+ set_state(PART:"tabbar_top_divider", "default", 0.0);
+ set_state(PART:"elm.swallow.prev_btn", "hidden", 0.0);
+ }
+ }
+ program { name: "tabbar_show";
+ signal: "elm,state,tabbar,show";
+ source: "elm";
+ script {
+ set_state(PART:"tabbar", "visible", 0.0);
+ set_state(PART:"tabbar_top_divider", "visible", 0.0);
+ set_int(tabbar_visible, 1);
+ }
+ }
+ program { name: "tabbar_hide";
+ signal: "elm,state,tabbar,hide";
+ source: "elm";
+ script {
+ set_state(PART:"tabbar", "default", 0.0);
+ set_state(PART:"tabbar_top_divider", "default", 0.0);
+ set_int(tabbar_visible, 0);
+ }
+ }
+ }
+ }
}
*
*/
#include "main.h"
+#include "page6.h"
#include "page5.h"
#include "page4.h"
#include "page3.h"
#include "page2.h"
#include "page1.h"
+
+Evas_Object*
+create_tabbar(Evas_Object *parent)
+{
+ Evas_Object *toolbar;
+
+ toolbar = elm_toolbar_add(parent);
+
+ elm_object_style_set(toolbar, "tabbar_with_title");
+ elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_EXPAND);
+ elm_toolbar_transverse_expanded_set(toolbar, EINA_TRUE);
+
+ elm_toolbar_item_append(toolbar, NULL, "Tab1", NULL, NULL);
+ elm_toolbar_item_append(toolbar, NULL, "Tab2", NULL, NULL);
+
+ elm_toolbar_select_mode_set(toolbar, ELM_OBJECT_SELECT_MODE_ALWAYS);
+
+ return toolbar;
+}
Evas_Object*
create_content(Evas_Object *parent, const char *text, Evas_Smart_Cb prev_btn_clicked_cb, Evas_Smart_Cb next_btn_clicked_cb, appdata_s *ad)
{
//No basic form.
/* ui_view(controller, identity name).
Later, you could get the identity name using view->get_name(); */
- ui_view *view = ad->viewmgr->push_view(new ui_view(this, "page5"));
+ ad->viewmgr->push_view(new ui_view(this, "page5"));
}
~page5()
[](void *data, Evas_Object *obj, void *event_info) -> void
{
appdata_s *ad = static_cast<appdata_s *>(data);
- ad->viewmgr->deactivate();
+ create_page6(ad);
},
this->ad);
--- /dev/null
+/*
+ * Copyright (c) 2016 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.
+ *
+ */
+class page6: public ui_controller
+{
+private:
+ appdata_s *ad;
+
+public:
+ page6(appdata_s *ad)
+ : ad(ad)
+ {
+ /* ui_basic_view(controller, identity name, style name of view).
+ Later, you could get the identity name using view->get_name();
+ you could get the style name of view as well */
+ ad->viewmgr->push_view(new ui_basic_view(this, "page6", "tabbar"));
+ }
+
+ ~page6()
+ {
+ }
+
+ void load()
+ {
+ //Initialize contents.
+
+ ui_basic_view *view = dynamic_cast<ui_basic_view *>(this->get_view());
+
+ //Create a main content.
+ Evas_Object *content = create_content(view->get_base(), "ViewMgr Demo<br>Page 6<br>With Tabar",
+ //Prev Button Callback
+ [](void *data, Evas_Object *obj, void *event_info) -> void
+ {
+ appdata_s *ad = static_cast<appdata_s *>(data);
+ ad->viewmgr->pop_view();
+ },
+ //Next Button Callback
+ [](void *data, Evas_Object *obj, void *event_info) -> void
+ {
+ appdata_s *ad = static_cast<appdata_s *>(data);
+ ad->viewmgr->deactivate();
+ },
+ this->ad);
+
+ //Arguments: content, title
+ view->set_content(content, "Title with tabbar");
+ Evas_Object *toolbar = create_tabbar(view->get_base());
+ view->set_tabbar(toolbar);
+ }
+};
+
+void create_page6(appdata_s *ad)
+{
+ new page6(ad);
+}
//FIXME: is it correct to define here?
#define EDJ_PATH "/opt/usr/apps/org.tizen.ui-viewmgr/res/ui-viewmgr.edj"
#define GROUP "elm/layout/tizen_view/default"
+#define TABBAR "elm/layout/tizen_view/tabbar"
using namespace efl_viewmgr;
using namespace viewmgr;
return false;
}
- if (!elm_layout_file_set(layout, EDJ_PATH, GROUP))
+ if (!strcmp(this->get_style(), "tabbar"))
+ {
+ if (!elm_layout_file_set(layout, EDJ_PATH, TABBAR))
+ {
+ LOGE("Failed to set tabbar style = ui_basic_view(%p)", this);
+ evas_object_del(layout);
+ return false;
+ }
+ }
+ else if (!elm_layout_file_set(layout, EDJ_PATH, GROUP))
{
LOGE("Failed to set file = ui_basic_view(%p), path(%s), group(%s)", this, EDJ_PATH, GROUP);
evas_object_del(layout);
return true;
}
-ui_basic_view::ui_basic_view(ui_controller *controller, const char *name)
- : ui_view(controller, name), layout(NULL)
+ui_basic_view::ui_basic_view(ui_controller *controller, const char *name, const char *style)
+ : ui_view(controller, name, style), layout(NULL)
{
}
return pcontent;
}
+bool ui_basic_view::set_tabbar(Evas_Object *toolbar)
+{
+ if (this->layout)
+ {
+ elm_object_part_content_set(this->layout, "tabbar", toolbar);
+ if (toolbar) elm_object_signal_emit(this->layout, "elm,state,tabbar,show", "elm");
+ return true;
+ }
+ LOGE("Layout is not exist!");
+ return false;
+}
+
void ui_basic_view::unload_content()
{
ui_view::set_content(NULL);
virtual void unload_content();
public:
- ui_basic_view(ui_controller *controller, const char *name = NULL);
+ ui_basic_view(ui_controller *controller, const char *name = NULL, const char *style = NULL);
virtual ~ui_basic_view();
Evas_Object *set_content(Evas_Object *content, const char *title = NULL);
bool set_title_left_btn(Evas_Object *title_left_btn);
bool set_title_right_btn(Evas_Object *title_right_btn);
bool set_title(const char *text);
+ bool set_tabbar(Evas_Object *toolbar);
virtual Evas_Object *get_base()
{
using namespace efl_viewmgr;
using namespace viewmgr;
-ui_view::ui_view(ui_controller *controller, const char *name)
- : ui_view_interface(controller, name)
+ui_view::ui_view(ui_controller *controller, const char *name, const char *style)
+ : ui_view_interface(controller, name, style)
{
}
friend class ui_viewmgr;
public:
- ui_view(ui_controller *controller, const char *name = NULL);
+ ui_view(ui_controller *controller, const char *name = NULL, const char *style = NULL);
virtual ~ui_view();
virtual Evas_Object *set_content(Evas_Object *content);
this->controller->destroy();
}
-ui_view_interface::ui_view_interface(T content, ui_controller_interface *controller, const char *name)
- : content(content), controller(controller), name(string(name ? name : "")), style(string("")), viewmgr(NULL), state(UI_VIEW_STATE_LOAD),
+ui_view_interface::ui_view_interface(T content, ui_controller_interface *controller, const char *name, const char *style)
+ : content(content), controller(controller), name(string(name ? name : "")), style(string(style ? style : "")), viewmgr(NULL), state(UI_VIEW_STATE_LOAD),
indicator(UI_VIEW_INDICATOR_DEFAULT), event_block(false), removable_content(true)
{
if (!content) this->state = UI_VIEW_STATE_UNLOAD;
controller->set_view(this);
}
-ui_view_interface::ui_view_interface(ui_controller_interface *controller, const char *name)
- : ui_view_interface(NULL, controller, name)
+ui_view_interface::ui_view_interface(ui_controller_interface *controller, const char *name, const char *style)
+ : ui_view_interface(NULL, controller, name, style)
{
this->state = UI_VIEW_STATE_UNLOAD;
}
* @warning Be aware the deletion of controller passed here will be covered by ui_view_interface.
* If you want to keep it for any reasons, please unset it using set_controller() before ui_view_interface is deleted.
*/
- ui_view_interface(T content, ui_controller_interface *controller, const char *name);
+ ui_view_interface(T content, ui_controller_interface *controller, const char *name, const char *style = NULL);
///Constructor for initializing with controller.
- ui_view_interface(ui_controller_interface *controller, const char *name = NULL);
+ ui_view_interface(ui_controller_interface *controller, const char *name = NULL, const char *style = NULL);
///Constructor for initializing with name.
ui_view_interface(const char *name = NULL);