From 469e1c9d41e6ff18f978e36538a89c01dcbd87fb Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Wed, 30 Mar 2016 19:44:09 +0900 Subject: [PATCH] Get rid of controller interface. We've considered supporting controller interface. But it turned out it's unnecesary here. It just made ui_viewmgr complex and we couldn't find out the actual usuability. If, it's usage is figured out, then we could revert this interface again. Change-Id: Ie58ce01aaee8708371e2ed7e187a7910624cb6ea --- src/examples/efl/CMakeLists.txt | 3 - src/examples/efl/main.cpp | 1 - src/examples/efl/page1.h | 4 +- src/examples/efl/page10.h | 78 ++++++------ src/examples/efl/page11.h | 90 +++++++------- src/examples/efl/page12.h | 76 +++++++----- src/examples/efl/page13.h | 59 ++------- src/examples/efl/page14.h | 10 +- src/examples/efl/page15.h | 54 --------- src/examples/efl/page2.h | 4 +- src/examples/efl/page3.h | 4 +- src/examples/efl/page4.h | 4 +- src/examples/efl/page5.h | 2 +- src/examples/efl/page6.h | 4 +- src/examples/efl/page7.h | 4 +- src/examples/efl/page8.h | 45 +++---- src/examples/efl/page9.h | 70 +++++++---- src/include/efl/mobile/ui_controller.h | 40 ------ src/include/efl/mobile/ui_view.h | 14 +-- src/include/efl/mobile/ui_viewmanager.h | 1 - src/include/efl/mobile/ui_viewmgr.h | 1 - src/include/efl/ui_base_controller.h | 139 --------------------- src/include/efl/ui_base_view.h | 14 --- src/include/efl/ui_viewmanager_base.h | 1 - src/include/interface/ui_iface_controller.h | 148 ----------------------- src/include/interface/ui_iface_rotatable.h | 8 -- src/include/interface/ui_iface_view.h | 34 ------ src/include/interface/ui_viewmanager_interface.h | 1 - src/lib/CMakeLists.txt | 3 - src/lib/efl/mobile/ui_controller.cpp | 28 ----- src/lib/efl/mobile/ui_view.cpp | 15 +-- src/lib/efl/ui_base_controller.cpp | 32 ----- src/lib/efl/ui_base_view.cpp | 22 +--- src/lib/interface/ui_iface_controller.cpp | 28 ----- src/lib/interface/ui_iface_view.cpp | 43 +------ 35 files changed, 229 insertions(+), 855 deletions(-) delete mode 100644 src/examples/efl/page15.h delete mode 100644 src/include/efl/mobile/ui_controller.h delete mode 100644 src/include/efl/ui_base_controller.h delete mode 100644 src/include/interface/ui_iface_controller.h delete mode 100644 src/lib/efl/mobile/ui_controller.cpp delete mode 100644 src/lib/efl/ui_base_controller.cpp delete mode 100644 src/lib/interface/ui_iface_controller.cpp diff --git a/src/examples/efl/CMakeLists.txt b/src/examples/efl/CMakeLists.txt index 225f69c..99b4f7f 100644 --- a/src/examples/efl/CMakeLists.txt +++ b/src/examples/efl/CMakeLists.txt @@ -1,14 +1,11 @@ SET(EXAM_NAME viewmgr_demo) SET(EXAM_SRCS - ../../lib/interface/ui_iface_controller.cpp ../../lib/interface/ui_iface_view.cpp ../../lib/interface/ui_iface_viewmgr.cpp ../../lib/efl/ui_base_popup.cpp - ../../lib/efl/ui_base_controller.cpp ../../lib/efl/ui_base_view.cpp ../../lib/efl/ui_base_viewmgr.cpp ../../lib/efl/ui_base_key_listener.cpp - ../../lib/efl/mobile/ui_controller.cpp ../../lib/efl/mobile/ui_menu.cpp ../../lib/efl/mobile/ui_view.cpp ../../lib/efl/mobile/ui_key_listener.cpp diff --git a/src/examples/efl/main.cpp b/src/examples/efl/main.cpp index 143497a..d374167 100644 --- a/src/examples/efl/main.cpp +++ b/src/examples/efl/main.cpp @@ -15,7 +15,6 @@ * */ #include "main.h" -#include "page15.h" #include "page14.h" #include "page13.h" #include "page12.h" diff --git a/src/examples/efl/page1.h b/src/examples/efl/page1.h index 5a0e4e3..4263a41 100644 --- a/src/examples/efl/page1.h +++ b/src/examples/efl/page1.h @@ -24,7 +24,7 @@ protected: void on_load() { //Create a main content. - Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Page 1", + Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Basic View", //Prev Button Callback [](void *data, Evas_Object *obj, void *event_info) -> void { @@ -35,7 +35,7 @@ protected: { create_page2(); }); - this->set_content(content, "Title"); + this->set_content(content, "Page1"); } public: diff --git a/src/examples/efl/page10.h b/src/examples/efl/page10.h index 9dadddd..fcc12c2 100644 --- a/src/examples/efl/page10.h +++ b/src/examples/efl/page10.h @@ -15,56 +15,54 @@ * */ -/** This page inherit ui_view. - * And implement on_portait(), on_landscape() method to create portarit, landscape content. - * This page will be created suitable content in on_portrait(), on_landscape() method. +/** This page implements on_rotate() method to create portarit, landscape content. + * This page will be created suitable content in on_rotate() method. */ class page10: public ui_view { protected: void on_load() { - //FIXME: Change below code to more convenient and clear way. - if (this->get_degree() == 90 || this->get_degree() == 270) - this->on_landscape(); - else - this->on_portrait(); - } - - void on_portrait() - { - Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Page 10
(Portrait + Landscape)", - //Prev Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->pop_view(); - }, - //Next Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - create_page11(); - }); - this->set_content(content, "Title"); - this->set_indicator(UI_VIEW_INDICATOR_DEFAULT); + this->on_rotate(this->get_degree()); } - void on_landscape() + void on_rotate(int degree) { - Evas_Object *content = create_landscape_content(this->get_base(), "ViewMgr Demo
Page 10
(Portrait + Landscape)", - //Prev Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->pop_view(); - }, - //Next Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - create_page11(); - }); - this->set_content(content, "Title"); - this->set_indicator(UI_VIEW_INDICATOR_OPTIMAL); + //Portrait + if (this->get_degree() == 0 || this->get_degree() == 180) + { + Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Rotation", + //Prev Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->pop_view(); + }, + //Next Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + create_page11(); + }); + this->set_content(content, "Page 10"); + this->set_indicator(UI_VIEW_INDICATOR_DEFAULT); + } + //Landscape + else + { + Evas_Object *content = create_landscape_content(this->get_base(), "ViewMgr Demo
Rotation", + //Prev Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->pop_view(); + }, + //Next Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + create_page11(); + }); + this->set_content(content, "Page 10"); + this->set_indicator(UI_VIEW_INDICATOR_OPTIMAL); + } } - public: page10() : ui_view("page10") {} ~page10() {} diff --git a/src/examples/efl/page11.h b/src/examples/efl/page11.h index 9312359..676fd0d 100644 --- a/src/examples/efl/page11.h +++ b/src/examples/efl/page11.h @@ -15,68 +15,62 @@ * */ -/** This page inherit ui_controller - * And implement on_rotate() method to create portarit, landscape content. - * This page will be created suitable content in on_rotate() method. + +/** This page implement on_menu() method to create ctxpopup when menu HW key clicked. + * This page will be created menu(ctxpopup)items in on_menu() method. */ -class page11: public ui_controller +static void ctxpopup_item_select_cb(void *data, Evas_Object *obj, void *event_info) +{ + ui_view *view = static_cast(data); + Elm_Object_Item *it = static_cast(event_info); + elm_ctxpopup_dismiss(obj); + LOGE("Item (%s) is selected", elm_object_item_text_get(it)); +} + +class page11: public ui_view { protected: void on_load() { - ui_view *view = dynamic_cast(this->get_view()); - this->on_rotate(view->get_degree()); + //Create a main content. + Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Menu Popup", + //Prev Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->pop_view(); + }, + //Next Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + create_page12(); + }); + + this->set_content(content, "Page11"); } - void on_rotate(int degree) + void on_menu(ui_menu *menu) { - ui_view *view = dynamic_cast(this->get_view()); + Elm_Ctxpopup *ctxpopup = elm_ctxpopup_add(menu->get_base()); + elm_ctxpopup_item_append(ctxpopup, "Phone calls", NULL, ctxpopup_item_select_cb, this); + elm_ctxpopup_item_append(ctxpopup, "Favorites", NULL, ctxpopup_item_select_cb, this); + elm_ctxpopup_item_append(ctxpopup, "Search", NULL, ctxpopup_item_select_cb, this); + elm_ctxpopup_item_append(ctxpopup, "Dialer", NULL, ctxpopup_item_select_cb, this); + elm_ctxpopup_item_append(ctxpopup, "Add contact", NULL, ctxpopup_item_select_cb, this); + elm_ctxpopup_item_append(ctxpopup, "Phone calls", NULL, ctxpopup_item_select_cb, this); + elm_ctxpopup_item_append(ctxpopup, "Favorites", NULL, ctxpopup_item_select_cb, this); + elm_ctxpopup_item_append(ctxpopup, "Search", NULL, ctxpopup_item_select_cb, this); + elm_ctxpopup_item_append(ctxpopup, "Dialer", NULL, ctxpopup_item_select_cb, this); - //Portrait - if (view->get_degree() == 0 || view->get_degree() == 180) - { - Evas_Object *content = create_content(view->get_base(), "ViewMgr Demo
Page 11
(Rotate)", - //Prev Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->pop_view(); - }, - //Next Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - create_page12(); - }); - view->set_content(content, "Title"); - view->set_indicator(UI_VIEW_INDICATOR_DEFAULT); - } - //Landscape - else - { - Evas_Object *content = create_landscape_content(view->get_base(), "ViewMgr Demo
Page 11
(Rotate)", - //Prev Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->pop_view(); - }, - //Next Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - create_page12(); - }); - view->set_content(content, "Title"); - view->set_indicator(UI_VIEW_INDICATOR_OPTIMAL); - } + menu->set_content(ctxpopup); } + public: - page11() - { - UI_VIEWMGR->push_view(new ui_view(this, "page11")); - } + page11() {} ~page11() {} }; void create_page11() { - //page 11 controller - page11 *controller = new page11(); + //Push this view in viewmgr. + UI_VIEWMGR->push_view(new page11()); } diff --git a/src/examples/efl/page12.h b/src/examples/efl/page12.h index c65c976..51cee23 100644 --- a/src/examples/efl/page12.h +++ b/src/examples/efl/page12.h @@ -15,17 +15,18 @@ * */ - -/** This page inherit ui_controller - * And implement on_menu() method to create ctxpopup when menu HW key clicked. - * This page will be created menu(ctxpopup)items in on_menu() method. +/** This page inherit ui_ui_view + * And make a button on right top side of title area to activate popup. + * The created popup has view and it will be managed by viewmgr. */ -static void ctxpopup_item_select_cb(void *data, Evas_Object *obj, void *event_info) + +static void popup_dismissed_cb(void *data, Evas_Object *obj, void *event_info) { - ui_view *view = static_cast(data); - Elm_Object_Item *it = static_cast(event_info); - elm_ctxpopup_dismiss(obj); - LOGE("Item (%s) is selected", elm_object_item_text_get(it)); + //FIXME: remove dismissed callback because this callback is called twice. + //It seems this is an efl or popup error, not this ui_popup nor example. + evas_object_smart_callback_del(obj, "dismissed", popup_dismissed_cb); + ui_base_popup *overlay = static_cast(data); + delete (overlay); } class page12: public ui_view @@ -34,7 +35,7 @@ protected: void on_load() { //Create a main content. - Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Page 12
(Menu Popup)", + Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Popup", //Prev Button Callback [](void *data, Evas_Object *obj, void *event_info) -> void { @@ -46,28 +47,49 @@ protected: create_page13(); }); - this->set_content(content, "Title"); - } - - void on_menu(ui_menu *menu) - { - Elm_Ctxpopup *ctxpopup = elm_ctxpopup_add(menu->get_base()); - elm_ctxpopup_item_append(ctxpopup, "Phone calls", NULL, ctxpopup_item_select_cb, this); - elm_ctxpopup_item_append(ctxpopup, "Favorites", NULL, ctxpopup_item_select_cb, this); - elm_ctxpopup_item_append(ctxpopup, "Search", NULL, ctxpopup_item_select_cb, this); - elm_ctxpopup_item_append(ctxpopup, "Dialer", NULL, ctxpopup_item_select_cb, this); - elm_ctxpopup_item_append(ctxpopup, "Add contact", NULL, ctxpopup_item_select_cb, this); - elm_ctxpopup_item_append(ctxpopup, "Phone calls", NULL, ctxpopup_item_select_cb, this); - elm_ctxpopup_item_append(ctxpopup, "Favorites", NULL, ctxpopup_item_select_cb, this); - elm_ctxpopup_item_append(ctxpopup, "Search", NULL, ctxpopup_item_select_cb, this); - elm_ctxpopup_item_append(ctxpopup, "Dialer", NULL, ctxpopup_item_select_cb, this); + this->set_content(content, "Page12"); - menu->set_content(ctxpopup); + //Title Right button + Elm_Button *right_btn = elm_button_add(this->get_base()); + elm_object_text_set(right_btn, "popup"); + evas_object_smart_callback_add(right_btn, "clicked", + [](void *data, Evas_Object *obj, void *event_info) -> void + { + page12 *view = static_cast(data); + view->create_popup(); + }, + this); + this->set_title_right_btn(right_btn); } public: - page12() {} + page12() : ui_view("page12") {} ~page12() {} + + void create_popup() + { + //FIXME: is overlay a proper name? + ui_base_popup *overlay = new ui_base_popup(this); + + Elm_Popup *popup = elm_popup_add(overlay->get_base()); + elm_object_text_set(popup, "This popup has only text which is set via desc set function, (This popup gets hidden when user clicks outside) here timeout of 3 sec is set."); + elm_popup_timeout_set(popup, 3.0); + evas_object_smart_callback_add(popup, "dismissed", popup_dismissed_cb, overlay); + evas_object_smart_callback_add(popup, "block,clicked", + [](void *data, Evas_Object *obj, void *event_info) -> void + { + elm_popup_dismiss(obj); + }, + NULL); + evas_object_smart_callback_add(popup, "timeout", + [](void *data, Evas_Object *obj, void *event_info) -> void + { + elm_popup_dismiss(obj); + }, + NULL); + overlay->set_content(popup); + overlay->activate(); + } }; void create_page12() diff --git a/src/examples/efl/page13.h b/src/examples/efl/page13.h index 27e940b..9fab450 100644 --- a/src/examples/efl/page13.h +++ b/src/examples/efl/page13.h @@ -15,27 +15,16 @@ * */ -/** This page inherit ui_ui_view - * And make a button on right top side of title area to activate popup. - * The created popup has view and it will be managed by viewmgr. +/** This example create a simple view which is inheritance ui_view. + * Then push in viewmgr. */ - -static void popup_dismissed_cb(void *data, Evas_Object *obj, void *event_info) -{ - //FIXME: remove dismissed callback because this callback is called twice. - //It seems this is an efl or popup error, not this ui_popup nor example. - evas_object_smart_callback_del(obj, "dismissed", popup_dismissed_cb); - ui_base_popup *overlay = static_cast(data); - delete (overlay); -} - class page13: public ui_view { protected: void on_load() { //Create a main content. - Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Page 13
(Popup)", + Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Fade Transition", //Prev Button Callback [](void *data, Evas_Object *obj, void *event_info) -> void { @@ -47,49 +36,15 @@ protected: create_page14(); }); - this->set_content(content, "Title"); - - //Title Right button - Elm_Button *right_btn = elm_button_add(this->get_base()); - elm_object_text_set(right_btn, "popup"); - evas_object_smart_callback_add(right_btn, "clicked", - [](void *data, Evas_Object *obj, void *event_info) -> void - { - page13 *view = static_cast(data); - view->create_popup(); - }, - this); - this->set_title_right_btn(right_btn); + this->set_content(content, "Page13"); } public: - page13() : ui_view("page13") {} - ~page13() {} - - void create_popup() + page13() : ui_view("page13") { - //FIXME: is overlay a proper name? - ui_base_popup *overlay = new ui_base_popup(this); - - Elm_Popup *popup = elm_popup_add(overlay->get_base()); - elm_object_text_set(popup, "This popup has only text which is set via desc set function, (This popup gets hidden when user clicks outside) here timeout of 3 sec is set."); - elm_popup_timeout_set(popup, 3.0); - evas_object_smart_callback_add(popup, "dismissed", popup_dismissed_cb, overlay); - evas_object_smart_callback_add(popup, "block,clicked", - [](void *data, Evas_Object *obj, void *event_info) -> void - { - elm_popup_dismiss(obj); - }, - NULL); - evas_object_smart_callback_add(popup, "timeout", - [](void *data, Evas_Object *obj, void *event_info) -> void - { - elm_popup_dismiss(obj); - }, - NULL); - overlay->set_content(popup); - overlay->activate(); + this->set_transition_style("fade"); } + ~page13() {} }; void create_page13() diff --git a/src/examples/efl/page14.h b/src/examples/efl/page14.h index dd6e6c4..f875de4 100644 --- a/src/examples/efl/page14.h +++ b/src/examples/efl/page14.h @@ -24,7 +24,7 @@ protected: void on_load() { //Create a main content. - Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Page 14
(Fade Transition)", + Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
None Transition", //Prev Button Callback [](void *data, Evas_Object *obj, void *event_info) -> void { @@ -33,18 +33,18 @@ protected: //Next Button Callback [](void *data, Evas_Object *obj, void *event_info) -> void { - create_page15(); + UI_VIEWMGR->deactivate(); }); - this->set_content(content, "Title"); + this->set_content(content, "Page14"); } public: page14() : ui_view("page14") { - this->set_transition_style("fade"); + this->set_transition_style("none"); } - ~page14() {} + ~page14(){} }; void create_page14() diff --git a/src/examples/efl/page15.h b/src/examples/efl/page15.h deleted file mode 100644 index 2cbf09a..0000000 --- a/src/examples/efl/page15.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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. - * - */ - -/** This example create a simple view which is inheritance ui_view. - * Then push in viewmgr. - */ -class page15: public ui_view -{ -protected: - void on_load() - { - //Create a main content. - Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Page 15
(None Transition)", - //Prev Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->pop_view(); - }, - //Next Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->deactivate(); - }); - - this->set_content(content, "Title"); - } - -public: - page15() : ui_view("page15") - { - this->set_transition_style("none"); - } - ~page15(){} -}; - -void create_page15() -{ - //Push this view in viewmgr. - UI_VIEWMGR->push_view(new page15()); -} diff --git a/src/examples/efl/page2.h b/src/examples/efl/page2.h index dd3986c..ba3c38d 100644 --- a/src/examples/efl/page2.h +++ b/src/examples/efl/page2.h @@ -24,7 +24,7 @@ protected: void on_load() { //Create a main content. - Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Page 2", + Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Title Buttons", //Prev Button Callback [](void *data, Evas_Object *obj, void *event_info) -> void { @@ -45,7 +45,7 @@ protected: elm_object_text_set(right_title_btn, "Done"); //Arguments: content, title, subtitle, title left button, title right button - this->set_content(content, "Title Buttons", NULL, left_title_btn, right_title_btn); + this->set_content(content, "Page2", NULL, left_title_btn, right_title_btn); } public: diff --git a/src/examples/efl/page3.h b/src/examples/efl/page3.h index 3c6dbba..99762d9 100644 --- a/src/examples/efl/page3.h +++ b/src/examples/efl/page3.h @@ -24,7 +24,7 @@ protected: void on_load() { //Create a main content. - Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Page 3", + Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Subtitle", //Prev Button Callback [](void *data, Evas_Object *obj, void *event_info) -> void { @@ -37,7 +37,7 @@ protected: }); //Arguments: content, title, subtitle, title left button, title right button - this->set_content(content, "Title", "Subtitle", NULL, NULL); + this->set_content(content, "Page3", "Subtitle", NULL, NULL); } public: diff --git a/src/examples/efl/page4.h b/src/examples/efl/page4.h index 3c9ac18..153fc20 100644 --- a/src/examples/efl/page4.h +++ b/src/examples/efl/page4.h @@ -25,7 +25,7 @@ protected: void on_load() { //Create a main content. - Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Page 4", + Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Title Badge", //Prev Button Callback [](void *data, Evas_Object *obj, void *event_info) -> void { @@ -38,7 +38,7 @@ protected: }); //Arguments: content, title - this->set_content(content, "TitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitle"); + this->set_content(content, "Page4. We put a long title here intentionally"); this->set_title_badge("999+"); } diff --git a/src/examples/efl/page5.h b/src/examples/efl/page5.h index 420993e..1c19d06 100644 --- a/src/examples/efl/page5.h +++ b/src/examples/efl/page5.h @@ -24,7 +24,7 @@ protected: void on_load() { //Create a main content. - Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Page 5
(Full View)", + Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Full View", //Prev Button Callback [](void *data, Evas_Object *obj, void *event_info) -> void { diff --git a/src/examples/efl/page6.h b/src/examples/efl/page6.h index b8fb69c..540c277 100644 --- a/src/examples/efl/page6.h +++ b/src/examples/efl/page6.h @@ -23,7 +23,7 @@ protected: void on_load() { //Create a main content. - Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Page 6", + Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Toolbar", //Prev Button Callback [](void *data, Evas_Object *obj, void *event_info) -> void { @@ -36,7 +36,7 @@ protected: }); //Arguments: content, title - this->set_content(content, "Title with toolbar"); + this->set_content(content, "Page6"); Elm_Toolbar *toolbar = create_toolbar(this->get_base(), "toolbar_with_title"); this->set_toolbar(toolbar); } diff --git a/src/examples/efl/page7.h b/src/examples/efl/page7.h index 089a483..debbfa3 100644 --- a/src/examples/efl/page7.h +++ b/src/examples/efl/page7.h @@ -24,7 +24,7 @@ public: page7() : ui_view("page7") { //Create a main content. - Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Page 7
(Navigationbar style)", + Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Navigationbar", //Prev Button Callback [](void *data, Evas_Object *obj, void *event_info) -> void { @@ -38,7 +38,7 @@ public: //FIXME: Don't delete view's content when this view poped. this->set_removable_content(false); - this->set_content(content, "Title with toolbar"); + this->set_content(content, "Page7"); Elm_Toolbar *toolbar = create_toolbar(this->get_base(), "navigationbar"); this->set_toolbar(toolbar); } diff --git a/src/examples/efl/page8.h b/src/examples/efl/page8.h index 53bff35..4c6712f 100644 --- a/src/examples/efl/page8.h +++ b/src/examples/efl/page8.h @@ -15,40 +15,35 @@ * */ -/** This page inherit ui_controller to show view create in controller side. +/** This page shows how to create a view content in advance. */ -class page8: public ui_controller +class page8: public ui_view { -protected: - void on_load() +public: + page8() : ui_view("page8") { - //Initialize contents. - ui_view *view = dynamic_cast(this->get_view()); - //Create a main content. - Evas_Object *content = create_content(view->get_base(), "ViewMgr Demo
Page 8
(Controller Inheritance)", - //Prev Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->pop_view(); - }, - //Next Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - create_page9(); - }); + Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Content Preloading", + //Prev Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->pop_view(); + }, + //Next Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + create_page9(); + }); - view->set_content(content, "Title"); - } -public: - page8() - { - UI_VIEWMGR->push_view(new ui_view(this, "page8")); + //Don't delete view's content when this view poped. + this->set_removable_content(false); + this->set_content(content, "Page 8"); } ~page8() {} }; void create_page8() { - page8 *controller = new page8(); + //Push this view in viewmgr. + UI_VIEWMGR->push_view(new page8()); } diff --git a/src/examples/efl/page9.h b/src/examples/efl/page9.h index f70c232..6e4059c 100644 --- a/src/examples/efl/page9.h +++ b/src/examples/efl/page9.h @@ -15,39 +15,63 @@ * */ -/** This page inherit ui_controller to show view create in controller side. - * And this page create content in controller constructor time. +/** This page inherit ui_view. + * And implement on_portait(), on_landscape() method to create portarit, landscape content. + * This page will be created suitable content in on_portrait(), on_landscape() method. */ -class page9: public ui_controller +class page9: public ui_view { -public: - page9() +protected: + void on_load() { - ui_view *view = new ui_view(this, "page9"); + //FIXME: Change below code to more convenient and clear way. + if (this->get_degree() == 90 || this->get_degree() == 270) + this->on_landscape(); + else + this->on_portrait(); + } - //Create a main content. - Evas_Object *content = create_content(view->get_base(), "ViewMgr Demo
Page 9
(Controller Inheritance + Content Preloading)", + void on_portrait() + { + Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Portrait/Landscape", //Prev Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->pop_view(); - }, - //Next Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - create_page10(); - }); - - //Don't delete view's content when this view poped. - view->set_removable_content(false); - view->set_content(content, "Title"); + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->pop_view(); + }, + //Next Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + create_page10(); + }); + this->set_content(content, "Page 9"); + this->set_indicator(UI_VIEW_INDICATOR_DEFAULT); + } - UI_VIEWMGR->push_view(view); + void on_landscape() + { + Evas_Object *content = create_landscape_content(this->get_base(), "ViewMgr Demo
Portrait/Landscape", + //Prev Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->pop_view(); + }, + //Next Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + create_page10(); + }); + this->set_content(content, "Page 9"); + this->set_indicator(UI_VIEW_INDICATOR_OPTIMAL); } + +public: + page9() : ui_view("page9") {} ~page9() {} }; void create_page9() { - page9 *controller = new page9(); + //Push this view in viewmgr. + UI_VIEWMGR->push_view(new page9()); } diff --git a/src/include/efl/mobile/ui_controller.h b/src/include/efl/mobile/ui_controller.h deleted file mode 100644 index 58e0017..0000000 --- a/src/include/efl/mobile/ui_controller.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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. - * - */ -#ifndef UI_CONTROLLER_H -#define UI_CONTROLLER_H - -#include "../ui_viewmanager_base.h" - -namespace efl_viewmgr -{ -class ui_menu; -class ui_viewmgr; - -class ui_controller: public ui_base_controller -{ - friend class ui_viewmgr; - friend class ui_view; - -protected: - virtual void on_menu(ui_menu *menu); - -public: - virtual ~ui_controller(); -}; -} - -#endif /* UI_CONTROLLER_H */ diff --git a/src/include/efl/mobile/ui_view.h b/src/include/efl/mobile/ui_view.h index 5dc1227..1df362c 100644 --- a/src/include/efl/mobile/ui_view.h +++ b/src/include/efl/mobile/ui_view.h @@ -22,11 +22,13 @@ namespace efl_viewmgr { +class ui_menu; +class ui_key_listener; + class ui_view: public ui_base_view { friend class ui_menu; friend class ui_key_listener; - friend class ui_controller; private: Elm_Layout *layout; //Base layout for view @@ -47,21 +49,11 @@ protected: virtual void unload_content(); virtual void set_event_block(bool block); virtual void on_back(); - - /** @brief This is for calling controller's rotate method. - */ virtual void on_rotate(int degree); - - /** @brief This is for calling controller's portrait method. - */ virtual void on_portrait(); - - /** @brief This is for calling controller's landscape method. - */ virtual void on_landscape(); public: - ui_view(ui_controller *controller, const char *name = NULL); ui_view(const char *name = NULL); virtual ~ui_view(); diff --git a/src/include/efl/mobile/ui_viewmanager.h b/src/include/efl/mobile/ui_viewmanager.h index a0bb471..797581f 100644 --- a/src/include/efl/mobile/ui_viewmanager.h +++ b/src/include/efl/mobile/ui_viewmanager.h @@ -21,7 +21,6 @@ #endif #define LOG_TAG "UI_VIEWMGR" -#include "ui_controller.h" #include "ui_view.h" #include "ui_key_listener.h" #include "ui_viewmgr.h" diff --git a/src/include/efl/mobile/ui_viewmgr.h b/src/include/efl/mobile/ui_viewmgr.h index 314f3f2..bb9d3db 100644 --- a/src/include/efl/mobile/ui_viewmgr.h +++ b/src/include/efl/mobile/ui_viewmgr.h @@ -29,7 +29,6 @@ class ui_viewmgr; class ui_viewmgr: public ui_base_viewmgr { friend class ui_view; - friend class ui_controller; public: ui_viewmgr(const char *pkg); diff --git a/src/include/efl/ui_base_controller.h b/src/include/efl/ui_base_controller.h deleted file mode 100644 index d93f4eb..0000000 --- a/src/include/efl/ui_base_controller.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - * 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. - * - */ -#ifndef UI_BASE_CONTROLLER_H -#define UI_BASE_CONTROLLER_H - -#include "../interface/ui_viewmanager_interface.h" - -namespace efl_viewmgr -{ - -/** - * @class ui_base_controller - * - * @ingroup viewmgr - * - * @brief UI Controller. This is a class for handling of life-cycle events from user side. - */ -class ui_base_controller: public viewmgr::ui_iface_controller -{ - friend class ui_base_view; - -protected: - /** @brief load callback. - * - * @note Now, this view is moving onto the screen. Get ready for this view. If this view content is alive, load callback won't be called. - * In the most cases, this callback will be triggered with this step load -> deactivate -> activate. - */ - virtual void on_load() {} - - /** @brief unload callback. - * - * @note Remove resources with regards to this view for saving memory or keep the content for performance. It's up to your scenario. - * Unload will be called just right before when the view is going to be deleted by popping or it's piled under the more than one view. - * If the view content is not alive, the unload won't be called. - * In the most cases, this callback will be triggered with this step. deactivate -> unload -> destroy - */ - virtual void on_unload() {} - - /** @brief activate callback. - * - * @note View is on activate state after show transition is finished. - * From whatever the state, if the view is on the screen, the activate callback will be called. - * In the most cases, this callback will be triggered with this step. load -> deactivate -> activate - */ - virtual void on_activate() {} - - /** @brief deactivate callback. - * - * @note View is on deactivate state. Get ready for unload. Hide transition may be triggered at this point. - * Deactivate state is triggered on this scenario that the view is still visible but it's not interactivate with users. - * In the most cases, when view is going to be popped or destroyed or pushed one more depth, the deactivate state will be triggered. - * Some UI controls such as a center popup or a menu popup blocks the view, this view may be deactivate but still visible in someway (with transparency) - */ - virtual void on_deactivate() {} - - /** @brief pause callback. - * - * @note When the system blocks the application running in cases such as phone call, system notification, switching applications ... - * When Window turns to deactivate. (@see ui_base_viewmgr_base :: deactivate()). - * If the view were deactivate or unload state, the pause won't be called. - */ - virtual void on_pause() {} - - /** @brief resume callback. - * - * @note View is turning back to the activate state again from pause. - * When the system allows the application turns to activate. - * When the Window turns to activate. (@see ui_base_viewmgr :: activate()) - */ - virtual void on_resume() {} - - /** @brief destroy callback. - * - * @note When this view is on destroying by popping or deleting. - */ - virtual void on_destroy() {} - - /** @brief View rotate callback. - * - * @param degree Current rotation degree. - * - * @note This method will be called when view rotation occurred. - */ - virtual void on_rotate(int degree) {} - - /** @brief Portrait callback. - * - * @note When current view is on portrait mode. - */ - virtual void on_portrait() {} - - /** @brief Landscape callback. - * - * @note When current view is on landscape mode. - */ - virtual void on_landscape() {} - - /** @brief Back key callback. - * - * @note In default. current view will be popped by viewmgr in those scenarios - * that viewmgr is requested to poo the current view. - * If you return false in the overriding, then popping will be stopped. - */ - virtual bool on_back() { return true; } - -public: - ///Destructor. - virtual ~ui_base_controller(); - - /** - * @brief Return a view which is matched with controller - * - * @return The view which is matched with controller - * - * @note User can set a controller 2 ways, 1. send a controller instance when view created, - * 2. call set_view() method with controller instance. - * - * @see set_view() - */ - - ui_base_view *get_view(); -}; -} - -#endif /* UI_BASE_CONTROLLER_H */ diff --git a/src/include/efl/ui_base_view.h b/src/include/efl/ui_base_view.h index d1e7c08..1cbb01d 100644 --- a/src/include/efl/ui_base_view.h +++ b/src/include/efl/ui_base_view.h @@ -25,7 +25,6 @@ namespace efl_viewmgr { -class ui_base_controller; class ui_base_popup; /** @@ -75,30 +74,19 @@ protected: */ virtual void set_event_block(bool block); - /** @brief This is for calling controller's rotate method. - */ virtual void on_rotate(int degree); - - /** @brief This is for calling controller's portrait method. - */ virtual void on_portrait(); - - /** @brief This is for calling controller's landscape method. - */ virtual void on_landscape(); /** @brief view deactivate state. * * @note this state will be triggered by ui_iface_viewmgr. * - * @see ui_iface_controller for this state in detail. */ virtual void on_deactivate(); public: ///Constructor. - ui_base_view(ui_base_controller *controller, const char *name = NULL); - ///Constructor. ui_base_view(const char *name = NULL); ///Destructor. @@ -122,8 +110,6 @@ public: */ virtual Evas_Object *get_base(); - /** @brief This is for calling controller's back method. - */ //FIXME: public? virtual void on_back(); diff --git a/src/include/efl/ui_viewmanager_base.h b/src/include/efl/ui_viewmanager_base.h index 33f383f..8a5a717 100644 --- a/src/include/efl/ui_viewmanager_base.h +++ b/src/include/efl/ui_viewmanager_base.h @@ -23,7 +23,6 @@ #include "ui_base_singleton.h" #include "ui_base_viewmgr.h" -#include "ui_base_controller.h" #include "ui_base_view.h" #include "ui_base_key_listener.h" #include "ui_base_popup.h" diff --git a/src/include/interface/ui_iface_controller.h b/src/include/interface/ui_iface_controller.h deleted file mode 100644 index 769965b..0000000 --- a/src/include/interface/ui_iface_controller.h +++ /dev/null @@ -1,148 +0,0 @@ -/* - * 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. - * - */ -#ifndef UI_CONTROLLER_INTERFACE_H_ -#define UI_CONTROLLER_INTERFACE_H_ - -namespace viewmgr { - -class ui_iface_view; - -/** - * @class ui_iface_controller. - * - * @internal - * @ingroup viewmgr - * - * @brief UI Controller Interface. This interface is designed for handling of life-cycle events from user side. - */ -class ui_iface_controller -{ - friend class ui_iface_view; - -private: - ui_iface_view *view; - - void set_view(ui_iface_view *view); - -protected: - /** - * @brief Return a view which is matched with controller - * - * @return The view which is matched with controller - * - * @note User can set a controller 2 ways, 1. send a controller instance when view created, - * 2. call set_view() method with controller instance. - * - * @see set_view() - */ - ui_iface_view *get_view() - { - return this->view; - } - - /** @brief load callback. - * - * @note Now, this view is moving onto the screen. Get ready for this view. If this view content is alive, load callback won't be called. - * In the most cases, this callback will be triggered with this step load -> deactivate -> activate. - */ - virtual void on_load() = 0; - - /** @brief unload callback. - * - * @note Remove resources with regards to this view for saving memory or keep the content for performance. It's up to your scenario. - * Unload will be called just right before when the view is going to be deleted by popping or it's piled under the more than one view. - * If the view content is not alive, the unload won't be called. - * In the most cases, this callback will be triggered with this step. deactivate -> unload -> destroy - */ - virtual void on_unload() = 0; - - /** @brief activate callback. - * - * @note View is on activate state after show transition is finished. - * From whatever the state, if the view is on the screen, the activate callback will be called. - * In the most cases, this callback will be triggered with this step. load -> deactivate -> activate - */ - virtual void on_activate() = 0; - - /** @brief deactivate callback. - * - * @note View is on deactivate state. Get ready for unload. Hide transition may be triggered at this point. - * Deactivate state is triggered on this scenario that the view is still visible but it's not interactivate with users. - * In the most cases, when view is going to be popped or destroyed or pushed one more depth, the deactivate state will be triggered. - * Some UI controls such as a center popup or a menu popup blocks the view, this view may be deactivate but still visible in someway (with transparency) - */ - virtual void on_deactivate() = 0; - - /** @brief pause callback. - * - * @note When the system blocks the application running in cases such as phone call, system notification, switching applications ... - * When Window turns to deactivate. (@see ui_viewmgr_base :: deactivate()). - * If the view were deactivate or unload state, the pause won't be called. - */ - virtual void on_pause() = 0; - - /** @brief resume callback. - * - * @note View is turning back to the activate state again from pause. - * When the system allows the application turns to activate. - * When the Window turns to activate. (@see ui_viewmgr_base :: activate()) - */ - virtual void on_resume() = 0; - - /** @brief destroy callback. - * - * @note When this view is on destroying by popping or deleting. - */ - virtual void on_destroy() = 0; - - /** @brief View rotate callback. - * - * @param degree Current rotation degree. - * - * @note This method will be called when view rotation occurred. - */ - virtual void on_rotate(int degree) = 0; - - /** @brief Portrait callback. - * - * @note When current view is on portrait mode. - */ - virtual void on_portrait() = 0; - - /** @brief Landscape callback. - * - * @note When current view is on landscape mode. - */ - virtual void on_landscape() = 0; - - -public: - ///Constructor. - ui_iface_controller() : - view(NULL) - { - } - - ///Destructor. - virtual ~ui_iface_controller() - { - } -}; - -} - -#endif /* UI_CONTROLLER_INTERFACE_H_ */ diff --git a/src/include/interface/ui_iface_rotatable.h b/src/include/interface/ui_iface_rotatable.h index 6d46c2a..e5018df 100644 --- a/src/include/interface/ui_iface_rotatable.h +++ b/src/include/interface/ui_iface_rotatable.h @@ -22,16 +22,8 @@ namespace viewmgr class ui_iface_rotatable { protected: - /** @brief This is for calling controller's portrait method. - */ virtual void on_portrait() {} - - /** @brief This is for calling controller's landscape method. - */ virtual void on_landscape() {} - - /** @brief This is for calling controller's rotate method. - */ virtual void on_rotate(int degree) {} public: diff --git a/src/include/interface/ui_iface_view.h b/src/include/interface/ui_iface_view.h index 577ff07..2d67074 100644 --- a/src/include/interface/ui_iface_view.h +++ b/src/include/interface/ui_iface_view.h @@ -26,7 +26,6 @@ typedef void* T; namespace viewmgr { class ui_iface_viewmgr; -class ui_iface_controller; /** * @class ui_iface_view @@ -44,7 +43,6 @@ class ui_iface_controller; class ui_iface_view { friend class ui_iface_viewmgr; - friend class ui_iface_controller; private: /// View state definition @@ -59,7 +57,6 @@ private: }; T content; ///< A content instance for a screen as a view. - ui_iface_controller *controller; ///< View life-cycle controller interface. string name; ///< View name. string transition_style; ///< View transition style name. ui_iface_viewmgr *viewmgr; ///< Viewmgr which this view belongs to. @@ -83,7 +80,6 @@ protected: * * @note this state will be triggered by ui_iface_viewmgr. * - * @see ui_iface_controller for this state in detail. */ virtual void on_load(); @@ -91,7 +87,6 @@ protected: * * @note this state will be triggered by ui_iface_viewmgr. * - * @see ui_iface_controller for this state in detail. */ virtual void on_unload(); @@ -99,7 +94,6 @@ protected: * * @note this state will be triggered by ui_iface_viewmgr. * - * @see ui_iface_controller for this state in detail. */ virtual void on_activate(); @@ -107,7 +101,6 @@ protected: * * @note this state will be triggered by ui_iface_viewmgr. * - * @see ui_iface_controller for this state in detail. */ virtual void on_deactivate(); @@ -115,7 +108,6 @@ protected: * * @note this state will be triggered by ui_iface_viewmgr. * - * @see ui_iface_controller for this state in detail. */ virtual void on_pause(); @@ -123,7 +115,6 @@ protected: * * @note this state will be triggered by ui_iface_viewmgr. * - * @see ui_iface_controller for this state in detail. */ virtual void on_resume(); @@ -131,7 +122,6 @@ protected: * * @note this state will be triggered by ui_iface_viewmgr. * - * @see ui_iface_controller for this state in detail. */ virtual void on_destroy(); @@ -147,12 +137,6 @@ protected: return this->event_block; } - /// Return a controller of this view. - ui_iface_controller* get_controller() - { - return this->controller; - } - /** @brief Return a viewmgr which this view is belonging to. */ ui_iface_viewmgr *get_viewmgr() @@ -160,29 +144,11 @@ protected: return this->viewmgr; } - /** @brief This is for replacing or setting a controller of the view. - * - * @return A previous controller. If it wasn't, the return value will be @c NULL. - * @note this state will be triggered by ui_iface_viewmgr. - * @param controller a new controller. It allows @c NULL for canceling the previous controller. - * - * @warning Be aware deletion of controller passed here will be taken cover by ui_iface_view. - * If you want to keep the controller for any reasons, please unset it using set_controller() before ui_iface_view is deleted. - */ - ui_iface_controller* set_controller(ui_iface_controller *controller); - public: /** @brief This is a constructor for initializing this view resources. * - * @param controller view life-cycle controller interface. * @param name view name. - * - * @warning Be aware the deletion of controller passed here will be covered by ui_iface_view. - * If you want to keep it for any reasons, please unset it using set_controller() before ui_iface_view is deleted. */ - ///Constructor for initializing with controller. - ui_iface_view(ui_iface_controller *controller, const char *name = NULL); - ///Constructor for initializing with name. ui_iface_view(const char *name = NULL); ///Destructor for terminating view. diff --git a/src/include/interface/ui_viewmanager_interface.h b/src/include/interface/ui_viewmanager_interface.h index baae5e4..6001341 100644 --- a/src/include/interface/ui_viewmanager_interface.h +++ b/src/include/interface/ui_viewmanager_interface.h @@ -38,6 +38,5 @@ enum ui_view_indicator #include "ui_iface_rotatable.h" #include "ui_iface_viewmgr.h" #include "ui_iface_view.h" -#include "ui_iface_controller.h" #endif /* UI_VIEWMANAGER_INTERFACE_H */ diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index a768555d..4a1e3b4 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -1,13 +1,10 @@ SET(LIB_SRCS - interface/ui_iface_controller.cpp interface/ui_iface_view.cpp interface/ui_iface_viewmgr.cpp efl/ui_base_popup.cpp - efl/ui_base_controller.cpp efl/ui_base_view.cpp efl/ui_base_viewmgr.cpp efl/ui_base_key_listener.cpp - efl/mobile/ui_controller.cpp efl/mobile/ui_menu.cpp efl/mobile/ui_view.cpp efl/mobile/ui_key_listener.cpp diff --git a/src/lib/efl/mobile/ui_controller.cpp b/src/lib/efl/mobile/ui_controller.cpp deleted file mode 100644 index 7bff689..0000000 --- a/src/lib/efl/mobile/ui_controller.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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. - * - */ -#include "../../../include/efl/mobile/ui_viewmanager.h" - -using namespace efl_viewmgr; -using namespace viewmgr; - -ui_controller::~ui_controller() -{ -} - -void ui_controller::on_menu(ui_menu *menu) -{ -} diff --git a/src/lib/efl/mobile/ui_view.cpp b/src/lib/efl/mobile/ui_view.cpp index c5bf06b..d6c6288 100644 --- a/src/lib/efl/mobile/ui_view.cpp +++ b/src/lib/efl/mobile/ui_view.cpp @@ -23,8 +23,6 @@ using namespace efl_viewmgr; using namespace viewmgr; -#define MY_CONTROLLER dynamic_cast(this->get_controller()) - static void content_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) { ui_view *view = static_cast(data); @@ -126,13 +124,8 @@ void ui_view::on_back() ui_base_view ::on_back(); } -ui_view::ui_view(ui_controller *controller, const char *name) - : ui_base_view(controller, name), layout(NULL), menu(NULL) -{ -} - ui_view::ui_view(const char *name) - : ui_view(NULL, name) + : ui_base_view(name), layout(NULL), menu(NULL) { } @@ -333,12 +326,6 @@ bool ui_view::on_menu_pre() { this->menu = new ui_menu(this); } - - if (this->get_controller()) - { - MY_CONTROLLER->on_menu(this->menu); - return false; - } return true; } diff --git a/src/lib/efl/ui_base_controller.cpp b/src/lib/efl/ui_base_controller.cpp deleted file mode 100644 index 434964b..0000000 --- a/src/lib/efl/ui_base_controller.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - * - */ -#include "../../include/efl/ui_viewmanager_base.h" - -using namespace efl_viewmgr; -using namespace viewmgr; - -ui_base_view * ui_base_controller::get_view() -{ - ui_iface_view *view = ui_iface_controller::get_view(); - if (!view) return NULL; - return dynamic_cast(view); -} - -ui_base_controller::~ui_base_controller() -{ - -} diff --git a/src/lib/efl/ui_base_view.cpp b/src/lib/efl/ui_base_view.cpp index 4a4d896..3cbc695 100644 --- a/src/lib/efl/ui_base_view.cpp +++ b/src/lib/efl/ui_base_view.cpp @@ -19,7 +19,6 @@ using namespace efl_viewmgr; using namespace viewmgr; -#define MY_CONTROLLER dynamic_cast(this->get_controller()) typedef list::reverse_iterator popup_ritr; void ui_base_view::connect_popup(ui_base_popup *popup) @@ -32,13 +31,8 @@ void ui_base_view::disconnect_popup(ui_base_popup *popup) this->popup_list.remove(popup); } -ui_base_view::ui_base_view(ui_base_controller *controller, const char *name) - : ui_iface_view(controller, name) -{ -} - ui_base_view::ui_base_view(const char *name) - : ui_base_view(NULL, name) + : ui_iface_view(name) { } @@ -134,13 +128,6 @@ void ui_base_view::on_back() //If any popup is activated, deactivate the popup first. if (this->deactivate_popup(true)) return; - if (this->get_controller()) - { - if (!MY_CONTROLLER->on_back()) - { - return; - } - } ui_base_viewmgr *viewmgr = UI_BASE_VIEWMGR; if (!viewmgr) { @@ -152,21 +139,16 @@ void ui_base_view::on_back() void ui_base_view::on_rotate(int degree) { - if (!this->get_controller()) return; - MY_CONTROLLER->on_rotate(degree); } void ui_base_view::on_portrait() { - if (!this->get_controller()) return; - MY_CONTROLLER->on_portrait(); } void ui_base_view::on_landscape() { - if (!this->get_controller()) return; - MY_CONTROLLER->on_landscape(); } + void ui_base_view::set_event_block(bool block) { ui_iface_view::set_event_block(block); diff --git a/src/lib/interface/ui_iface_controller.cpp b/src/lib/interface/ui_iface_controller.cpp deleted file mode 100644 index e86b333..0000000 --- a/src/lib/interface/ui_iface_controller.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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. - * - */ -#include "../../include/interface/ui_viewmanager_interface.h" - -using namespace viewmgr; - -void ui_iface_controller::set_view(ui_iface_view *view) -{ - if (this->view) - { - this->view->set_controller(NULL); - } - this->view = view; -} diff --git a/src/lib/interface/ui_iface_view.cpp b/src/lib/interface/ui_iface_view.cpp index e1dc7c0..76945d9 100644 --- a/src/lib/interface/ui_iface_view.cpp +++ b/src/lib/interface/ui_iface_view.cpp @@ -26,9 +26,6 @@ void ui_iface_view::set_event_block(bool block) void ui_iface_view::on_load() { this->state = UI_VIEW_STATE_LOAD; - if (this->content) return; - if (!this->controller) return; - this->controller->on_load(); } void ui_iface_view::on_unload() @@ -39,78 +36,42 @@ void ui_iface_view::on_unload() this->unload_content(); return; } - if (!this->content) return; - if (!this->controller) return; - this->controller->on_unload(); } void ui_iface_view::on_activate() { this->state = UI_VIEW_STATE_ACTIVATE; - if (!this->controller) return; - this->controller->on_activate(); } void ui_iface_view::on_deactivate() { this->state = UI_VIEW_STATE_DEACTIVATE; - if (!this->controller) return; - this->controller->on_deactivate(); } void ui_iface_view::on_pause() { this->state = UI_VIEW_STATE_PAUSE; - if (!this->content) return; - if (state != UI_VIEW_STATE_ACTIVATE) return; - if (!this->controller) return; - this->controller->on_pause(); } void ui_iface_view::on_resume() { this->state = UI_VIEW_STATE_ACTIVATE; - if (state != UI_VIEW_STATE_PAUSE) return; - if (!this->content) return; - if (!this->controller) return; - this->controller->on_resume(); } void ui_iface_view::on_destroy() { - if (!this->controller) return; - this->controller->on_destroy(); } -ui_iface_view::ui_iface_view(ui_iface_controller *controller, const char *name) - : content(NULL), controller(controller), name(string(name ? name : "")), transition_style(string("default")), viewmgr(NULL), state(UI_VIEW_STATE_LOAD), +ui_iface_view::ui_iface_view(const char *name) + : content(NULL), name(string(name ? name : "")), transition_style(string("default")), viewmgr(NULL), state(UI_VIEW_STATE_LOAD), indicator(UI_VIEW_INDICATOR_DEFAULT), event_block(false), removable_content(true) { this->state = UI_VIEW_STATE_UNLOAD; - - if (controller) - controller->set_view(this); -} - -ui_iface_view::ui_iface_view(const char *name) - : ui_iface_view(NULL, name) -{ - } ui_iface_view::~ui_iface_view() { this->viewmgr->remove_view(this); - if (this->controller) delete (this->controller); -} - -ui_iface_controller* ui_iface_view::set_controller(ui_iface_controller *controller) -{ - ui_iface_controller *prev_controller = this->controller; - this->controller = controller; - if (controller) controller->set_view(this); - if (prev_controller) prev_controller->set_view(NULL); - return prev_controller; } T ui_iface_view::set_content(T content) -- 2.7.4