From: Hermet Park Date: Sat, 26 Mar 2016 06:31:05 +0000 (+0900) Subject: refactoring code. X-Git-Tag: submit/tizen/20160617.075742~88^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f42048f127ffc643a751b32162cb609997b00588;p=platform%2Fcore%2Fuifw%2Fui-viewmgr.git refactoring code. Still, viewmgr implementation has a lot of missings. we are gradually improving the bodies. Change-Id: I1628bc0e58f1ac72b7366963b4115e8bd6c6d76f --- diff --git a/src/examples/efl/main.cpp b/src/examples/efl/main.cpp index 37c74aa..5a42973 100644 --- a/src/examples/efl/main.cpp +++ b/src/examples/efl/main.cpp @@ -15,6 +15,7 @@ * */ #include "main.h" +#include "page13.h" #include "page12.h" #include "page11.h" #include "page10.h" diff --git a/src/examples/efl/page10.h b/src/examples/efl/page10.h index a3fca1c..edcef26 100644 --- a/src/examples/efl/page10.h +++ b/src/examples/efl/page10.h @@ -62,6 +62,7 @@ public: }, this->ad); view->set_content(content, "Title"); + view->set_indicator(UI_VIEW_INDICATOR_DEFAULT); } void on_landscape() @@ -82,6 +83,7 @@ public: }, this->ad); view->set_content(content, "Title"); + view->set_indicator(UI_VIEW_INDICATOR_OPTIMAL); } }; diff --git a/src/examples/efl/page11.h b/src/examples/efl/page11.h index 4bb95ca..ff0dd57 100644 --- a/src/examples/efl/page11.h +++ b/src/examples/efl/page11.h @@ -45,7 +45,8 @@ protected: create_page12(ad); }, this->ad); - this->set_content(content, "Title Portrait"); + this->set_content(content, "Title"); + this->set_indicator(UI_VIEW_INDICATOR_DEFAULT); } //Landscape else @@ -64,7 +65,8 @@ protected: create_page12(ad); }, this->ad); - this->set_content(content, "Title Landscape"); + this->set_content(content, "Title"); + this->set_indicator(UI_VIEW_INDICATOR_OPTIMAL); } } diff --git a/src/examples/efl/page12.h b/src/examples/efl/page12.h index 548fa8b..676cf17 100644 --- a/src/examples/efl/page12.h +++ b/src/examples/efl/page12.h @@ -46,7 +46,7 @@ protected: [](void *data, Evas_Object *obj, void *event_info) -> void { appdata_s *ad = static_cast(data); - ad->viewmgr->deactivate(); + create_page13(ad); }, this->ad); diff --git a/src/examples/efl/page13.h b/src/examples/efl/page13.h new file mode 100644 index 0000000..e61abc6 --- /dev/null +++ b/src/examples/efl/page13.h @@ -0,0 +1,101 @@ +/* + * 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 page13: public ui_view +{ +private: + appdata_s *ad; + +protected: + void on_load() + { + //Create a main content. + Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Page 13
(Popup)", + //Prev Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + appdata_s *ad = static_cast(data); + ad->viewmgr->pop_view(); + }, + //Next Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + appdata_s *ad = static_cast(data); + ad->viewmgr->deactivate(); + }, + this->ad); + 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); + } + +public: + page13(const char *name, appdata_s *ad) + : ui_view(name), ad(ad) + { + ad->viewmgr->push_view(this); + } + + ~page13() + { + } + + void create_popup() + { +#if 0 + ui_popup_view *view = new ui_popup_view(this); + + Evas_Object *popup = elm_popup_add(view->get_base()); + + elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0); + 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, "block,clicked", + [](void *data, Evas_Object *obj, void *event_info) -> void + { + evas_object_del(obj); + }, + NULL); + evas_object_smart_callback_add(popup, "timeout", + [](void *data, Evas_Object *obj, void *event_info) -> void + { + evas_object_del(obj); + }, + NULL); + evas_object_show(popup); + + view->set_content(popup); + view->activate(); +#endif + } +}; + +void create_page13(appdata_s *ad) +{ + /* A example for view class extension instead of using controller class. */ + new page13("page13", ad); +} diff --git a/src/include/efl/mobile/ui_menu.h b/src/include/efl/mobile/ui_menu.h index 0982280..6c1dc18 100644 --- a/src/include/efl/mobile/ui_menu.h +++ b/src/include/efl/mobile/ui_menu.h @@ -40,14 +40,14 @@ public: virtual bool deactivate(); virtual bool set_content(Elm_Ctxpopup* ctxpopup); virtual Elm_Ctxpopup *unset_content(); + virtual void on_back(); + virtual bool is_activated(); + virtual Evas_Object *get_base(); virtual Elm_Ctxpopup *get_content() { return this->ctxpopup; } - - virtual bool is_activated(); - virtual Evas_Object *get_base(); }; } diff --git a/src/include/efl/mobile/ui_view.h b/src/include/efl/mobile/ui_view.h index e3a1ccf..b77bec1 100644 --- a/src/include/efl/mobile/ui_view.h +++ b/src/include/efl/mobile/ui_view.h @@ -69,17 +69,17 @@ public: return this->layout; } - const Elm_Button *get_title_left_btn() + Elm_Button *get_title_left_btn() { return this->title_left_btn; } - const Elm_Button *get_title_right_btn() + Elm_Button *get_title_right_btn() { return this->title_right_btn; } - const Elm_Toolbar *get_toolbar() + Elm_Toolbar *get_toolbar() { return this->toolbar; } @@ -88,7 +88,6 @@ public: { return this->menu; } - }; } diff --git a/src/lib/efl/mobile/ui_menu.cpp b/src/lib/efl/mobile/ui_menu.cpp index 996348c..847f684 100644 --- a/src/lib/efl/mobile/ui_menu.cpp +++ b/src/lib/efl/mobile/ui_menu.cpp @@ -170,3 +170,8 @@ Evas_Object *ui_menu::get_base() return this->get_window(); } + +void ui_menu::on_back() +{ + this->deactivate(); +} diff --git a/src/lib/efl/mobile/ui_view.cpp b/src/lib/efl/mobile/ui_view.cpp index 5788c1e..45d969b 100644 --- a/src/lib/efl/mobile/ui_view.cpp +++ b/src/lib/efl/mobile/ui_view.cpp @@ -120,7 +120,7 @@ void ui_view::on_back() { if (this->menu->is_activated()) { - this->menu->deactivate(); + this->menu->on_back(); return; } } diff --git a/src/lib/efl/ui_base_key_listener.cpp b/src/lib/efl/ui_base_key_listener.cpp index 8abefd8..3a2bd92 100644 --- a/src/lib/efl/ui_base_key_listener.cpp +++ b/src/lib/efl/ui_base_key_listener.cpp @@ -42,7 +42,6 @@ static void event_proc(ui_base_key_listener *key_listener, Evas_Event_Key_Down * if (strcmp(ev->keyname, KEY_BACK) && strcmp(ev->keyname, KEY_BACK2)) return; - //FIXME: cancel menu?? view->on_back(); }