From: Woochan Lee Date: Tue, 28 Jun 2016 06:35:57 +0000 (+0900) Subject: Coding Rule: 2. File, Class Naming. X-Git-Tag: submit/tizen/20160630.072558~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F62%2F76962%2F4;p=platform%2Fcore%2Fuifw%2Fui-viewmgr.git Coding Rule: 2. File, Class Naming. Add UiIfaceViewmgr.h for C++ application. (ui_viewmanager.h for C application) Change-Id: Ibffe44cbecad4a04b80c30f00fec9312f8ee1a4f --- diff --git a/src/examples/efl/cpp/contents.cpp b/src/examples/efl/cpp/contents.cpp index 31be69e..d9da8c0 100644 --- a/src/examples/efl/cpp/contents.cpp +++ b/src/examples/efl/cpp/contents.cpp @@ -23,7 +23,7 @@ create_toolbar(Evas_Object *parent, const char *style) toolbar = elm_toolbar_add(parent); - //FIXME: :( UI_View can set this style instead. + //FIXME: :( UiView can set this style instead. elm_object_style_set(toolbar, style); //FIXME: If not call below API, toolbar items create with min size. @@ -125,7 +125,7 @@ create_landscape_content(Evas_Object *parent, const char *text, Evas_Smart_Cb pr Evas_Object* create_title_handle_content(Evas_Object *parent, Evas_Smart_Cb prev_btn_clicked_cb, Evas_Smart_Cb next_btn_clicked_cb, Evas_Smart_Cb title_show_btn_clicked_cb, Evas_Smart_Cb title_hide_btn_clicked_cb, - Evas_Smart_Cb title_show_anim_btn_clicked_cb, Evas_Smart_Cb title_hide_anim_btn_clicked_cb, ui_view *view) + Evas_Smart_Cb title_show_anim_btn_clicked_cb, Evas_Smart_Cb title_hide_anim_btn_clicked_cb, UiView *view) { Elm_Grid *grid; Elm_Box *box; diff --git a/src/examples/efl/cpp/main.cpp b/src/examples/efl/cpp/main.cpp index 2f3de6f..90a5ec6 100644 --- a/src/examples/efl/cpp/main.cpp +++ b/src/examples/efl/cpp/main.cpp @@ -32,21 +32,21 @@ #include "page2.h" #include "page1.h" -class sample_app: public ui_app +class SampleApp: public UiApp { public: - sample_app() - : ui_app(PACKAGE, LOCALE_DIR) + SampleApp() + : UiApp(PACKAGE, LOCALE_DIR) { } - ~sample_app() + ~SampleApp() { } protected: bool on_create() { - if (!ui_app::on_create()) + if (!UiApp::on_create()) { return false; } @@ -60,6 +60,6 @@ protected: int main(int argc, char *argv[]) { - sample_app app; + SampleApp app; return app.run(argc, argv); } diff --git a/src/examples/efl/cpp/main.h b/src/examples/efl/cpp/main.h index 019651a..0c0fd8f 100644 --- a/src/examples/efl/cpp/main.h +++ b/src/examples/efl/cpp/main.h @@ -15,7 +15,7 @@ * */ #include -#include +#include //uncomment if you want debug #ifndef TIZEN_ENGINEER_MODE @@ -36,5 +36,5 @@ Evas_Object *create_content(Evas_Object *parent, const char *text, Evas_Smart_Cb Evas_Object *create_scrolling_content(Evas_Object *parent); Evas_Object* create_title_handle_content(Evas_Object *parent, Evas_Smart_Cb prev_btn_clicked_cb, Evas_Smart_Cb next_btn_clicked_cb, Evas_Smart_Cb title_show_btn_clicked_cb, Evas_Smart_Cb title_hide_btn_clicked_cb, - Evas_Smart_Cb title_show_anim_btn_clicked_cb, Evas_Smart_Cb title_hide_anim_btn_clicked_cb, ui_view *view); + Evas_Smart_Cb title_show_anim_btn_clicked_cb, Evas_Smart_Cb title_hide_anim_btn_clicked_cb, UiView *view); Elm_Toolbar *create_toolbar(Evas_Object *parent, const char *style); diff --git a/src/examples/efl/cpp/page1.h b/src/examples/efl/cpp/page1.h index 37e4819..9417be6 100644 --- a/src/examples/efl/cpp/page1.h +++ b/src/examples/efl/cpp/page1.h @@ -15,16 +15,16 @@ * */ -/** This example create a simple view which is inheritance of an ui_standard_view. +/** This example create a simple view which is inheritance of an UiStandardView. * Then push in viewmgr. */ -class page1: public ui_standard_view +class page1: public UiStandardView { protected: //on_load() will be called when this page1 is requested to be shown. void on_load() { - ui_standard_view::on_load(); + UiStandardView::on_load(); //Create a main content. Evas_Object *content = create_content(this->get_base(), "ViewMgr++ Demo
Basic View", @@ -42,6 +42,6 @@ protected: } public: - page1() : ui_standard_view("page1") {} + page1() : UiStandardView("page1") {} ~page1() {} }; diff --git a/src/examples/efl/cpp/page10.h b/src/examples/efl/cpp/page10.h index 0c3fbca..de53ca4 100644 --- a/src/examples/efl/cpp/page10.h +++ b/src/examples/efl/cpp/page10.h @@ -18,18 +18,18 @@ /** This page implements on_rotate() method to create portrait, landscape content. * This page will be created suitable content in on_rotate() method. */ -class page10: public ui_standard_view +class page10: public UiStandardView { protected: void on_load() { - ui_standard_view::on_load(); + UiStandardView::on_load(); this->on_rotate(this->get_degree()); } void on_rotate(int degree) { - ui_standard_view::on_rotate(degree); + UiStandardView::on_rotate(degree); if (this->get_degree() == 0 || this->get_degree() == 180) { @@ -67,6 +67,6 @@ protected: } } public: - page10() : ui_standard_view("page10") {} + page10() : UiStandardView("page10") {} ~page10() {} }; diff --git a/src/examples/efl/cpp/page11.h b/src/examples/efl/cpp/page11.h index 579b050..cbe1ff3 100644 --- a/src/examples/efl/cpp/page11.h +++ b/src/examples/efl/cpp/page11.h @@ -26,12 +26,12 @@ static void ctxpopup_item_select_cb(void *data, Evas_Object *obj, void *event_in elm_ctxpopup_dismiss(obj); } -class page11: public ui_standard_view +class page11: public UiStandardView { protected: void on_load() { - ui_standard_view::on_load(); + UiStandardView::on_load(); //Create a main content. Evas_Object *content = create_content(this->get_base(), "ViewMgr++ Demo
Menu Popup", @@ -49,9 +49,9 @@ protected: this->set_content(content, "Page11"); } - void on_menu(ui_menu *menu) + void on_menu(UiMenu *menu) { - ui_standard_view::on_menu(menu); + UiStandardView::on_menu(menu); Elm_Ctxpopup *ctxpopup = elm_ctxpopup_add(menu->get_base()); elm_ctxpopup_item_append(ctxpopup, "Phone calls", NULL, ctxpopup_item_select_cb, this); diff --git a/src/examples/efl/cpp/page12.h b/src/examples/efl/cpp/page12.h index cc43e73..480d209 100644 --- a/src/examples/efl/cpp/page12.h +++ b/src/examples/efl/cpp/page12.h @@ -15,7 +15,7 @@ * */ -/** This page inherit ui_ui_standard_view +/** This page inherit UiStandardView * 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. */ @@ -23,16 +23,16 @@ static void popup_dismissed_cb(void *data, Evas_Object *obj, void *event_info) { evas_object_smart_callback_del(obj, "dismissed", popup_dismissed_cb); - ui_popup *popup = static_cast(data); + UiPopup *popup = static_cast(data); delete (popup); } -class page12: public ui_standard_view +class page12: public UiStandardView { protected: void on_load() { - ui_standard_view::on_load(); + UiStandardView::on_load(); //Create a main content. Evas_Object *content = create_content(this->get_base(), "ViewMgr++ Demo
Popup", @@ -64,12 +64,12 @@ protected: } public: - page12() : ui_standard_view("page12") {} + page12() : UiStandardView("page12") {} ~page12() {} void create_popup() { - ui_popup *popup = new ui_popup(this); + UiPopup *popup = new UiPopup(this); if (!popup) return; Elm_Popup *obj = elm_popup_add(popup->get_base()); diff --git a/src/examples/efl/cpp/page13.h b/src/examples/efl/cpp/page13.h index 7f7d487..9ef948b 100644 --- a/src/examples/efl/cpp/page13.h +++ b/src/examples/efl/cpp/page13.h @@ -15,17 +15,17 @@ * */ -/** This page inherit ui_ui_standard_view +/** This page inherit UiStandardView * And make a view transition style as fade. * The fade effect will be shown when view appear or disappear. * The default of transition style of view was slide in/out. */ -class page13: public ui_standard_view +class page13: public UiStandardView { protected: void on_load() { - ui_standard_view::on_load(); + UiStandardView::on_load(); //Create a main content. Evas_Object *content = create_content(this->get_base(), "ViewMgr++ Demo
Fade Transition", @@ -44,7 +44,7 @@ protected: } public: - page13() : ui_standard_view("page13") + page13() : UiStandardView("page13") { this->set_transition_style("fade"); } diff --git a/src/examples/efl/cpp/page14.h b/src/examples/efl/cpp/page14.h index f588ba8..e52b427 100644 --- a/src/examples/efl/cpp/page14.h +++ b/src/examples/efl/cpp/page14.h @@ -15,17 +15,17 @@ * */ -/** This page inherit ui_ui_standard_view +/** This page inherit UiStandardView * And make a view transition style as none. * There will be no effect when view appear or disappear. * The default of transition style of view was slide in/out. */ -class page14: public ui_standard_view +class page14: public UiStandardView { protected: void on_load() { - ui_standard_view::on_load(); + UiStandardView::on_load(); //Create a main content. Evas_Object *content = create_content(this->get_base(), "ViewMgr++ Demo
None Transition", @@ -44,7 +44,7 @@ protected: } public: - page14() : ui_standard_view("page14") + page14() : UiStandardView("page14") { this->set_transition_style("none"); } diff --git a/src/examples/efl/cpp/page15.h b/src/examples/efl/cpp/page15.h index 30dc9ce..46f8823 100644 --- a/src/examples/efl/cpp/page15.h +++ b/src/examples/efl/cpp/page15.h @@ -15,16 +15,16 @@ * */ -/** This page inherit ui_ui_standard_view +/** This page inherit UiStandardView * This create a content that has same size of screen. * When this view has rotated viewmgr's internal scroller will be enabled automatically. */ -class page15: public ui_standard_view +class page15: public UiStandardView { protected: void on_load() { - ui_standard_view::on_load(); + UiStandardView::on_load(); //Create a main content. Evas_Object *content = create_scrolling_content(this->get_base()); @@ -37,7 +37,7 @@ protected: evas_object_smart_callback_add(right_btn, "clicked", [](void *data, Evas_Object *obj, void *event_info) -> void { - UI_VIEWMGR->push_view(new page16()); + UI_VIEWMGR->push_view(new page16()); }, this); diff --git a/src/examples/efl/cpp/page16.h b/src/examples/efl/cpp/page16.h index 89ea0ef..54a83aa 100644 --- a/src/examples/efl/cpp/page16.h +++ b/src/examples/efl/cpp/page16.h @@ -15,15 +15,15 @@ * */ -/** This page inherit ui_ui_standard_view +/** This page inherit UiStandardView * This view create a lot of buttons to show how to handle title area visible state with animation or no effect. */ -class page16: public ui_standard_view +class page16: public UiStandardView { protected: void on_load() { - ui_standard_view::on_load(); + UiStandardView::on_load(); //Create a main content. Evas_Object *content = create_title_handle_content(this->get_base(), @@ -40,25 +40,25 @@ protected: //Title Show Button Callback [](void *data, Evas_Object *obj, void *event_info) -> void { - ui_standard_view *view = static_cast(data); + UiStandardView *view = static_cast(data); view->set_title_visible(true, false); }, //Title Hide Button Callback [](void *data, Evas_Object *obj, void *event_info) -> void { - ui_standard_view *view = static_cast(data); + UiStandardView *view = static_cast(data); view->set_title_visible(false, false); }, //Title Show Anim Button Callback [](void *data, Evas_Object *obj, void *event_info) -> void { - ui_standard_view *view = static_cast(data); + UiStandardView *view = static_cast(data); view->set_title_visible(true, true); }, //Title Hide Anim Button Callback [](void *data, Evas_Object *obj, void *event_info) -> void { - ui_standard_view *view = static_cast(data); + UiStandardView *view = static_cast(data); view->set_title_visible(false, true); }, this); @@ -66,6 +66,6 @@ protected: } public: - page16() : ui_standard_view("page16") {} + page16() : UiStandardView("page16") {} ~page16() {} }; diff --git a/src/examples/efl/cpp/page2.h b/src/examples/efl/cpp/page2.h index aaf1f31..00186a9 100644 --- a/src/examples/efl/cpp/page2.h +++ b/src/examples/efl/cpp/page2.h @@ -15,15 +15,15 @@ * */ -/** This example create a simple view which is inheritance ui_standard_view. +/** This example create a simple view which is inheritance UiStandardView. * And add two buttons in view title area. then push in viewmgr. */ -class page2: public ui_standard_view +class page2: public UiStandardView { protected: void on_load() { - ui_standard_view::on_load(); + UiStandardView::on_load(); //Create a main content. Evas_Object *content = create_content(this->get_base(), "ViewMgr++ Demo
Title Buttons", @@ -35,7 +35,7 @@ protected: //Next Button Callback [](void *data, Evas_Object *obj, void *event_info) -> void { - UI_VIEWMGR->push_view(new page3()); + UI_VIEWMGR->push_view(new page3()); }); //Title left button @@ -51,6 +51,6 @@ protected: } public: - page2() : ui_standard_view("page2") {} + page2() : UiStandardView("page2") {} ~page2() {} }; diff --git a/src/examples/efl/cpp/page3.h b/src/examples/efl/cpp/page3.h index d2d13d1..6317939 100644 --- a/src/examples/efl/cpp/page3.h +++ b/src/examples/efl/cpp/page3.h @@ -15,15 +15,15 @@ * */ -/** This example create a simple view which is inheritance ui_standard_view. +/** This example create a simple view which is inheritance UiStandardView. * And set text in view subtitle. then push in viewmgr. */ -class page3: public ui_standard_view +class page3: public UiStandardView { protected: void on_load() { - ui_standard_view::on_load(); + UiStandardView::on_load(); //Create a main content. Evas_Object *content = create_content(this->get_base(), "ViewMgr++ Demo
Subtitle", @@ -43,6 +43,6 @@ protected: } public: - page3() : ui_standard_view("page3") {} + page3() : UiStandardView("page3") {} ~page3() {} }; diff --git a/src/examples/efl/cpp/page4.h b/src/examples/efl/cpp/page4.h index eda5a39..3cf24b4 100644 --- a/src/examples/efl/cpp/page4.h +++ b/src/examples/efl/cpp/page4.h @@ -15,16 +15,16 @@ * */ -/** This example create a simple view which is inheritance ui_standard_view. +/** This example create a simple view which is inheritance UiStandardView. * And set long text to title, set badge text in view title area. * Then push in viewmgr. */ -class page4: public ui_standard_view +class page4: public UiStandardView { protected: void on_load() { - ui_standard_view::on_load(); + UiStandardView::on_load(); //Create a main content. Evas_Object *content = create_content(this->get_base(), "ViewMgr++ Demo
Title Badge", @@ -45,6 +45,6 @@ protected: } public: - page4() : ui_standard_view("page4") {} + page4() : UiStandardView("page4") {} ~page4() {} }; diff --git a/src/examples/efl/cpp/page5.h b/src/examples/efl/cpp/page5.h index df8da24..360d2cf 100644 --- a/src/examples/efl/cpp/page5.h +++ b/src/examples/efl/cpp/page5.h @@ -15,15 +15,15 @@ * */ -/** This page inherit ui_view to show how to create full view. +/** This page inherit UiView to show how to create full view. * And set indicator state as hide. */ -class page5: public ui_view +class page5: public UiView { protected: void on_load() { - ui_view::on_load(); + UiView::on_load(); //Create a main content. Evas_Object *content = create_content(this->get_base(), "ViewMgr++ Demo
Full View", @@ -43,6 +43,6 @@ protected: } public: - page5() : ui_view("page5") {} + page5() : UiView("page5") {} ~page5() {} }; diff --git a/src/examples/efl/cpp/page6.h b/src/examples/efl/cpp/page6.h index 633be3f..ab7bd94 100644 --- a/src/examples/efl/cpp/page6.h +++ b/src/examples/efl/cpp/page6.h @@ -15,14 +15,14 @@ * */ -/** This page inherit ui_standard_view to show title with toolbar(toolbar_with_title) example. +/** This page inherit UiStandardView to show title with toolbar(toolbar_with_title) example. */ -class page6: public ui_standard_view +class page6: public UiStandardView { protected: void on_load() { - ui_standard_view::on_load(); + UiStandardView::on_load(); //Create a main content. Evas_Object *content = create_content(this->get_base(), "ViewMgr++ Demo
Toolbar", @@ -44,6 +44,6 @@ protected: } public: - page6() : ui_standard_view("page6") {} + page6() : UiStandardView("page6") {} ~page6() {} }; diff --git a/src/examples/efl/cpp/page7.h b/src/examples/efl/cpp/page7.h index dd45edd..fd4e41d 100644 --- a/src/examples/efl/cpp/page7.h +++ b/src/examples/efl/cpp/page7.h @@ -15,14 +15,14 @@ * */ -/** This page inherit ui_standard_view to show title with toolbar(navigationbar) example. +/** This page inherit UiStandardView to show title with toolbar(navigationbar) example. */ -class page7: public ui_standard_view +class page7: public UiStandardView { protected: void on_load() { - ui_standard_view::on_load(); + UiStandardView::on_load(); //Create a main content. Evas_Object *content = create_content(this->get_base(), "ViewMgr++ Demo
Navigationbar", @@ -43,6 +43,6 @@ protected: this->set_toolbar(toolbar); } public: - page7() : ui_standard_view("page7") {} + page7() : UiStandardView("page7") {} ~page7() {} }; diff --git a/src/examples/efl/cpp/page8.h b/src/examples/efl/cpp/page8.h index 314969b..f46a859 100644 --- a/src/examples/efl/cpp/page8.h +++ b/src/examples/efl/cpp/page8.h @@ -17,10 +17,10 @@ /** This page shows how to create a view content in advance. */ -class page8: public ui_standard_view +class page8: public UiStandardView { public: - page8() : ui_standard_view("page8") + page8() : UiStandardView("page8") { //Create a main content. Evas_Object *content = create_content(this->get_base(), "ViewMgr++ Demo
Content Preloading", diff --git a/src/examples/efl/cpp/page9.h b/src/examples/efl/cpp/page9.h index bfe54a0..212e7c9 100644 --- a/src/examples/efl/cpp/page9.h +++ b/src/examples/efl/cpp/page9.h @@ -15,16 +15,16 @@ * */ -/** This page inherit ui_standard_view. +/** This page inherit UiStandardView. * And implement on_portait(), on_landscape() method to create portrait, landscape content. * This page will be created suitable content in on_portrait(), on_landscape() method. */ -class page9: public ui_standard_view +class page9: public UiStandardView { protected: void on_load() { - ui_standard_view::on_load(); + UiStandardView::on_load(); //FIXME: Change below code to more convenient and clear way. if (this->get_degree() == 90 || this->get_degree() == 270) @@ -35,7 +35,7 @@ protected: void on_portrait() { - ui_standard_view::on_portrait(); + UiStandardView::on_portrait(); Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Portrait/Landscape", //Prev Button Callback @@ -55,7 +55,7 @@ protected: void on_landscape() { - ui_standard_view::on_landscape(); + UiStandardView::on_landscape(); Evas_Object *content = create_landscape_content(this->get_base(), "ViewMgr Demo
Portrait/Landscape", //Prev Button Callback @@ -74,6 +74,6 @@ protected: } public: - page9() : ui_standard_view("page9") {} + page9() : UiStandardView("page9") {} ~page9() {} }; diff --git a/src/include/UiViewManager.h b/src/include/UiViewManager.h new file mode 100644 index 0000000..8374434 --- /dev/null +++ b/src/include/UiViewManager.h @@ -0,0 +1,18 @@ +/* + * 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 "efl/mobile/UiMobileViewManager.h" diff --git a/src/include/efl/UiBaseKeyListener.h b/src/include/efl/UiBaseKeyListener.h new file mode 100644 index 0000000..5d99d20 --- /dev/null +++ b/src/include/efl/UiBaseKeyListener.h @@ -0,0 +1,95 @@ +/* + * 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_KEY_LISTENER_H_ +#define _UI_BASE_KEY_LISTENER_H_ + +namespace efl_viewmanager +{ + +class UiBaseViewmgr; + +/** + * @class UiBaseKeyListener + * + * @ingroup efl_viewmanager + * + * @brief This is a base class of EFL key listener. Typically, this class has a role for delegating event propagation from system to a view. + * UiBaseKeyListener grabs HW back key event then pass it to the top view from the view manager. You could extend this class for more HW key + * events for your profile feature. By overriding UiBaseKeyListener::extend_event_proc(), you could get the key event information when that event is + * triggered. This class must be requested by UiBaseViewmgr and controlled wholly by it. + */ +class UiBaseKeyListener +{ +protected: + /** + * @brief This is a constructor for initializing key listener. + * + * @param viewmgr The instance of UiBaseViewmgr. + */ + UiBaseKeyListener(UiBaseViewmgr *viewmgr); + + ///Destructor. + virtual ~UiBaseKeyListener(); + + /** + * @brief Init H/W key listener to grab key event(back key). + * + * @note It makes evas_object_rectangle and add key up callback to grab key event. + * + * @see term() + */ + virtual bool init(); + + /** + * @brief Terminate H/W key listener. + * + * @note Delete key grabber(evas_object_rectangle). + * + * @see init() + */ + virtual bool term(); + + /** + * @brief Check the menu key event occurs or not. + * + * @note This is checking H/W key is menu or not. + */ + virtual void extend_event_proc(UiBaseView *view, Evas_Event_Key_Down *ev) {} + + /** + * @brief Return the viewmgr instance. + * + * @return UiBaseViewmgr instance. + */ + UiBaseViewmgr *get_viewmgr(); + + /** + * @brief Return the key grabber(evas_object_rectangle). + * + * @return key grabber object. + */ + Evas_Object *get_keygrab_obj(); + +private: + _UI_DECLARE_PRIVATE_IMPL(UiBaseKeyListener); + _UI_DISABLE_COPY_AND_ASSIGN(UiBaseKeyListener); + _UI_DECLARE_FRIENDS(UiBaseViewmgr); +}; + +} + +#endif /* _UI_BASE_KEY_LISTENER_H_ */ diff --git a/src/include/efl/UiBaseOverlay.h b/src/include/efl/UiBaseOverlay.h new file mode 100644 index 0000000..9538e93 --- /dev/null +++ b/src/include/efl/UiBaseOverlay.h @@ -0,0 +1,51 @@ +/* + * 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_OVERLAY_H_ +#define _UI_BASE_OVERLAY_H_ + +namespace efl_viewmanager +{ + +class UiBaseView; + +/** + * @class UiBaseOverlay + * + * @internal + * @ingroup efl_viewmanager + * + * @brief This is a base class to support EFL overlay view which could be active on other UiBaseView. An overlay is designed to be one subordinate of one + * UiBaseView. UiBaseOverlay is nothing more than UiIfaceOverlay in behavior perspective. It just comes out with renaming class for adapting with + * other EFL base classes. + */ +class UiBaseOverlay: public UiIfaceOverlay +{ +protected: + /** + * @brief This is a constructor for initializing overlay. + * + * @param view The instance of UiBaseView. + */ + UiBaseOverlay(UiBaseView *view); + + ///Destructor. + virtual ~UiBaseOverlay(); +}; + +} + +#endif /* _UI_BASE_OVERLAY_H_ */ diff --git a/src/include/efl/UiBaseView.h b/src/include/efl/UiBaseView.h new file mode 100644 index 0000000..28fab4f --- /dev/null +++ b/src/include/efl/UiBaseView.h @@ -0,0 +1,142 @@ +/* + * 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_VIEW_H_ +#define _UI_BASE_VIEW_H_ + +namespace efl_viewmanager +{ + +/** + * @class UiBaseView + * + * @ingroup efl_viewmanager + * + * @brief This is a base class of EFL view. Typically, this view extends UiIfaceView and implements basic behaviors for EFL view in all profiles. + * A view must have one Evas_Object content instance which represents a view for a current screen. + */ +class UiBaseView: public UiIfaceView +{ +public: + /** + * @brief This is a constructor for initializing this view resources. + * + * @param name view name. + */ + UiBaseView(const char *name = NULL); + + ///Destructor. + virtual ~UiBaseView(); + + /** + * @brief This is for replacing or setting a content of the view. + * + * @param content a new content. It allows @c NULL for canceling the previous content. + * + * @return A previous content. If it wasn't, return @c NULL. + */ + virtual bool set_content(Evas_Object *content); + + /** + * @brief This is for unsetting a content of the view. + * + * @return A previous content. If it wasn't, return @c NULL. + */ + virtual Evas_Object *unset_content(); + + /** + * @brief Get a base object of ui_view. + * + * @note Normally, this base object can be used for a parent of a view content. + * + * @return The base object of ui_view. + */ + virtual Evas_Object *get_base(); + + /** + * @brief Set the indicator mode. + * + * @param indicator The mode to set, one of #UiViewIndicator. + */ + virtual void set_indicator(UiViewIndicator indicator); + + /** + * @brief Get current view's degree. + * + * @return Current rotation degree, -1 if it fails to get degree information. + */ + virtual int get_degree(); + +protected: + /** + * @brief Get a parent object of view. + * + * @note This is calling viewmgr get_base() method internally. + * + * @return The base layout object of viewmgr. + */ + Evas_Object *get_parent(); + + /** + * @brief Toggle event block. + * + * @note It makes view content event freeze during effect showing. + * + * @param block @c true, when blocking is enabled, otherwise @c false. + */ + virtual void set_event_block(bool block); + + /** + * @brief View rotate changed. + * + * @note This state will be called when view rotation changed. + * + * @param degree The current degree of view. + * + * @see on_portrait() + * @see on_landscpae() + */ + virtual void on_rotate(int degree); + + /** + * @brief View portrait state. + * + * @note This state will be called when view rotation changed to portrait. + * + * @see on_landscpae() + * @see on_rotate() + */ + virtual void on_portrait(); + + /** + * @brief View landscape state. + * + * @note This state will be called when view rotation changed to landscape. + * + * @see on_portrait() + * @see on_rotate() + */ + virtual void on_landscape(); + +private: + _UI_DECLARE_PRIVATE_IMPL(UiBaseView); + _UI_DISABLE_COPY_AND_ASSIGN(UiBaseView); + _UI_DECLARE_FRIENDS(UiBaseViewmgr); +}; + +} + +#endif /* _UI_BASE_VIEW_H_ */ diff --git a/src/include/efl/UiBaseViewManager.h b/src/include/efl/UiBaseViewManager.h new file mode 100644 index 0000000..3473408 --- /dev/null +++ b/src/include/efl/UiBaseViewManager.h @@ -0,0 +1,35 @@ +/* + * 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_VIEWMANAGER_H_ +#define _UI_BASE_VIEWMANAGER_H_ + +//FIXME: ?? +#ifndef Elm_Conformant +#define Elm_Conformant Evas_Object +#endif + +#include "../interface/UiIfaceViewManager.h" +#include "UiBaseOverlay.h" +#include "UiBaseKeyListener.h" +#include "UiBaseViewmgr.h" +#include "UiBaseView.h" + +#define UI_BASE_VIEWMGR dynamic_cast(UiIfaceViewmgr::get_instance()) + +using namespace efl_viewmanager; + +#endif /* UI_BASE_VIEWMANAGER_H */ diff --git a/src/include/efl/UiBaseViewmgr.h b/src/include/efl/UiBaseViewmgr.h new file mode 100644 index 0000000..99210b9 --- /dev/null +++ b/src/include/efl/UiBaseViewmgr.h @@ -0,0 +1,215 @@ +/* + * 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_VIEWMGR_H_ +#define _UI_BASE_VIEWMGR_H_ + +namespace efl_viewmanager +{ + +class UiBaseView; + +/** + * @class UiBaseViewmgr + * + * @ingroup efl_viewmanager + * + * @brief This is a base class of EFL view manager. Typically, this view manager extends UiIfaceViewmgr and implement basic behaviors for + * EFL view manager in all profiles. Basically, this view manager has one default window to display several logic views as well as this has + * a conformant and default application layout to display indicator, application layout and virtual keypad properly. This base view manager implements + * view transition effects. Of course, those could be customized for each profile. Also, it implements events blocking for views during views going + * back and forth. But the behavior will be turned on/off based on the system profile. + * + * @warning viewmgr will remove its window, conformant and default layout when it's destroyed. + */ +class UiBaseViewmgr: public UiIfaceViewmgr +{ +public: + /** + * @brief Activate this view manager. + * + * @note viewmgr window and views will be shown once activate() is called. Usually this activate() should be called after applications set their all views + * on initialization time. + * + * @return @c true on success or @c false otherwise. + * + * @see deactivate() + */ + virtual bool activate(); + + /** + * @brief Deactivate this view manager. + * + * @note viewmgr window and views will be hidden once deactivate() is called. deactivate() behavior is up ui system, but usually it hides(unmap) + * current window in order that application go background. + * + * @return @c true success or @c false not. + * + * @see activate() + */ + virtual bool deactivate(); + + /** + * @brief Push a new view into this viewmgr. This function is used for when application switches a current view to a new one. + * + * @note Normally, the current view will be hidden by a new view. In default, when user calls this API, view will be switched to @p view instantly, + * only when viewmgr state is activated. Otherwise, the @p view will be shown later when viewmgr is activated. push_view() is designed for providing + * view transition effect. If you want push view instantly without any transition, you could use insert_view_before() or insert_view_after(). + * If you want to pop the current view, the please use pop_view(). + * + * @param view A view to insert in the viewmgr view list. + * + * @return @p view, @c NULL when it fails to push a @p view. + * + * @see activated() + * @see insert_view_before() + * @see insert_view_after() + * @see pop_view() + */ + virtual UiBaseView *push_view(UiBaseView *view); + + /** + * @brief Pop the top(last) view from this viewmgr view list. + * This function is used when application switches the current view back to the previous view. + * The top view will be removed from the view stack and then it will be deleted by the viewmgr. + * + * @note If the view is just one left, then viewmgr would be deactivated automatically since the ui application might be invalid anymore. Otherwise, + * the application will be terminated. It's up to system configuration. + * + * @return @c true on success or @c false otherwise. + * + * @see deactivate() + * @see push_view() + */ + virtual bool pop_view(); + + /** + * @brief Insert a view in this viewmgr view list. Specifically, insert a given @p view right before of the given view, @before. + * + * @param view A view to insert in the viewmgr view list. + * @param before A view that will be just inserted after @p view. If you pass @c NULL, @p view will be inserted at the front of the view list. + * + * @return @c true on success or @c false otherwise. + */ + virtual bool insert_view_before(UiBaseView *view, UiBaseView *before); + + /** + * @brief Insert a view in this viewmgr view list. Specifically, insert a given @p view right after of the given view, @after. + * + * @param view A view to insert in the viewmgr view list. + * @param after A view that will be just inserted before the @p view. If you pass @c NULL, @p view will be inserted at the end of the view list. + * + * @return @c true on success or @c false otherwise. + */ + virtual bool insert_view_after(UiBaseView *view, UiBaseView *after); + + /** + * @brief Get a window object of viewmgr. + * + * @return The window object of viewmgr. + */ + Elm_Win *get_window(); + + /** + * @brief Get a conformant object of viewmgr. + * + * @return The conformant object of viewmgr. + */ + Elm_Conformant *get_conformant(); + + /** + * @brief Return a last(top) view. + * + * @return The view which is last view of the viewmgr view list. + */ + UiBaseView *get_last_view(); + + /** + * @brief Return a view which is matched with the index @p idx. + * + * @param idx A index of the view which you are looking for. + * + * @return The view which index is matched with @p idx. + * If there were no views with index @p idx, @c NULL will be returned. + * + * @note You could use the index as the page numbers of the views. + * @warning the index number of views are variable since the view list is variable. + * + * @see get_view_index() + * @see get_view_count() + */ + UiBaseView *get_view(unsigned int idx); + + /** + * @brief Return a view which is matched with the @p name. + * + * @note Every view have their names as their own identifiers. + * + * @param name The name of the view which you are looking for. + * + * @return The view which name is matched with @p name. + * If there were no views name matched, @c NULL will be returned. + * + * @see UiIfaceView::set_name() + */ + UiBaseView *get_view(const char *name); + + /** + * @brief Get a base object of this viewmgr. + * + * @note Normally, a base object can be used for adding additional objects. + * + * @return The base object of this viewmgr. + */ + Evas_Object *get_base(); + +protected: + /** + * @brief Set indicator of the view. + * + * @param indicator The mode to set, one of #UiViewIndicator. + * + * @return @c false if current indicator is same with new one, @c true otherwise. + */ + bool set_indicator(UiViewIndicator indicator); + + /** + * @brief This is a constructor for initializing viewmgr. + * + * @param pkg The name of package. + * @param key_listener The instance of UiBaseKeyListener. + */ + UiBaseViewmgr(const char *pkg, UiBaseKeyListener *key_listener); + + /** + * @brief This is a constructor for initializing viewmgr. + * + * @param pkg The name of package. + */ + UiBaseViewmgr(const char *pkg); + + ///Destructor. + virtual ~UiBaseViewmgr(); + +private: + _UI_DECLARE_PRIVATE_IMPL(UiBaseViewmgr); + _UI_DISABLE_COPY_AND_ASSIGN(UiBaseViewmgr); + _UI_DECLARE_FRIENDS(UiBaseView); +}; + +} + +#endif /* _UI_BASE_VIEWMGR_H_ */ diff --git a/src/include/efl/mobile/UiApp.h b/src/include/efl/mobile/UiApp.h new file mode 100644 index 0000000..211ae10 --- /dev/null +++ b/src/include/efl/mobile/UiApp.h @@ -0,0 +1,70 @@ +/* + * 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_APP_H_ +#define _UI_APP_H_ + +namespace efl_viewmanager +{ + +class UiViewmgr; + +/* + * @class UiIfaceApp + * + * @ingroup ui_viewmanager + * + * @brief UiIfaceApp is designed for wrapping the application instance. This class hides unnecessary application settings but expose only basic functions + * such as initialization and run. Basically, it works on the application life-cycle. It has application life-cycle event interfaces such as create(), + * pause(), resume(), terminate(), etc so that users can handle those events for the their application concept. Also, It provides system event + * interfaces such as low_baterry(), low_meomory(), lang_changed(), region_changed() and so on. UiIfaceApp create an unique UiViewmgr instance + * internally, and manage its life. +*/ +class UiApp : public UiIfaceApp +{ +public: + /** + * @brief This is a constructor for initializing UiPopup. + * + * @param pkg The name of package. + * @param loale_dir The path of locale directory. + */ + UiApp(const char *pkg, const char *locale_dir); + + ///Destructor. + virtual ~UiApp(); + + /** + * @brief Return the viewmgr instance. + * + * @return UiViewmgr instance. + */ + UiViewmgr *get_viewmgr(); + + /** + * @brief Return UiApp instance. + * + * @return The instance of UiApp. + */ + static UiApp *get_instance(); + +private: + _UI_DISABLE_COPY_AND_ASSIGN(UiApp); +}; + +} + +#endif /* _UI_APP_H_ */ diff --git a/src/include/efl/mobile/UiKeyListener.h b/src/include/efl/mobile/UiKeyListener.h new file mode 100644 index 0000000..a7e31e2 --- /dev/null +++ b/src/include/efl/mobile/UiKeyListener.h @@ -0,0 +1,59 @@ +/* + * 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_KEY_LISTENER_H_ +#define _UI_KEY_LISTENER_H_ + +namespace efl_viewmanager +{ +class UiViewmgr; + +/** + * @class UiKeyListener + * + * @ingroup efl_viewmanager + * + * @brief This class extends to UiBaseKeyListener to support an additional HW Menu key for mobile profile. Basically, HW Menu key will be propagated to + * the top view and UiView::on_menu() will be triggered. + */ +class UiKeyListener : public UiBaseKeyListener +{ +public: + /** + * @brief This is a constructor for initializing this UiKeyListener. + * + * @param The instance of UiViewmgr. + */ + UiKeyListener(UiViewmgr *viewmgr); + + /** + * @brief Init H/W key listener to grab key event(menu key). + * + * @note Add menu key to target of key grabber. + */ + virtual bool init(); + + /** + * @brief Check the menu key event occurs or not. + * + * @note This is checking H/W key is menu or not. + */ + virtual void extend_event_proc(UiBaseView *view, Evas_Event_Key_Down *ev); +}; + +} + +#endif /* _UI_KEY_LISTENER_H_ */ diff --git a/src/include/efl/mobile/UiMenu.h b/src/include/efl/mobile/UiMenu.h new file mode 100644 index 0000000..a910e8c --- /dev/null +++ b/src/include/efl/mobile/UiMenu.h @@ -0,0 +1,128 @@ +/* + * 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_MENU_H_ +#define _UI_MENU_H_ + +namespace efl_viewmanager +{ +class UiView; + +/** + * @class UiMenu + * + * @ingroup efl_viewmanager + * + * @brief UiMenu is to support EFL menu UI which could be active on one UiView. A menu is used for traditional contextual popup to give an option in its + * view context. Elm_Ctxpopup widget could be set as this UiMenu content for mobile profile. UiMenu will set up all Elm_Ctxpopup decorating + * options instead of users for their convenient. A UiMenu is designed to be one subordinate of one UiView in order to share events and contexts + * each other to work nicely. Only one menu could be active on a UiView. That means the previous menu will be removed by UiView when a new menu comes. + * + * @warning UiMenu and its content, Elm_Ctxpopup will be deleted by its owned UiView on the proper time. So you can just leave its instance to it. + */ +class UiMenu: public UiBaseOverlay +{ +public: + /** + * @brief menu activate. + * + * @note It makes menu state as show. + * + * @return @c true if it succeeds, @c false otherwise. + * + * @see deactivate() + */ + virtual bool activate(); + + /** + * @brief menu deactivate. + * + * @note It makes menu state as hide. + * + * @return @c true if it succeeds, @c false otherwise. + * + * @see activate() + */ + virtual bool deactivate(); + + /** + * @brief This is for replacing or setting a content of the menu. + * + * @param ctxpopup ctxpopup object. It allows @c NULL for canceling the previous content. + * + * @return @c true if it succeeds, @c false otherwise. + */ + virtual bool set_content(Elm_Ctxpopup* ctxpopup); + + /** + * @brief This is for unsetting a content of the menu. + * + * @return A previous content. If it wasn't, return value will be @c NULL. + */ + virtual Elm_Ctxpopup *unset_content(); + + /** + * @brief Return the active status of menu. + * + * @return @c true if menu is activated, @c false otherwise. + * + * @see activate() + * @see deactivate() + */ + virtual bool is_activated(); + + /** + * @brief Get a base object of a UiMenu. + * + * @note Normally, A base object can be used for a parent of UiMenu content. + * @return base object of UiMenu. + */ + virtual Evas_Object *get_base(); + + /** + * @brief Get a current menu's degree. + * + * @return Current rotation degree, -1 if it fails to get degree information. + */ + virtual int get_degree(); + +protected: + /** + * @brief This is a constructor for initializing this menu. + * + * @param The instance of UiView. + */ + UiMenu(UiView *view); + + ///Destructor. + virtual ~UiMenu(); + + /** + * @brief Get a base window of viewmgr. + * + * @return viewmgr's window object. + */ + Elm_Win *get_window(); + +private: + _UI_DECLARE_PRIVATE_IMPL(UiMenu); + _UI_DISABLE_COPY_AND_ASSIGN(UiMenu); + _UI_DECLARE_FRIENDS(UiView); +}; + +} + +#endif /* _UI_MENU_H_ */ diff --git a/src/include/efl/mobile/UiMobileViewManager.h b/src/include/efl/mobile/UiMobileViewManager.h new file mode 100644 index 0000000..e370b89 --- /dev/null +++ b/src/include/efl/mobile/UiMobileViewManager.h @@ -0,0 +1,31 @@ +/* + * 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_MOBILE_VIEWMANAGER_H_ +#define _UI_MOBILE_VIEWMANAGER_H_ + +#include "../UiBaseViewManager.h" +#include "UiView.h" +#include "UiStandardView.h" +#include "UiKeyListener.h" +#include "UiViewmgr.h" +#include "UiMenu.h" +#include "UiPopup.h" +#include "UiApp.h" + +#define UI_VIEWMGR (UiApp::get_instance()->get_viewmgr()) + +#endif /* UI_MOBILE_VIEWMANAGER_H */ diff --git a/src/include/efl/mobile/UiPopup.h b/src/include/efl/mobile/UiPopup.h new file mode 100644 index 0000000..9cc3150 --- /dev/null +++ b/src/include/efl/mobile/UiPopup.h @@ -0,0 +1,130 @@ +/* + * 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_POPUP_H_ +#define _UI_POPUP_H_ + +namespace efl_viewmanager +{ + +class UiView; + +/** + * @class UiPopup + * + * @ingroup efl_viewmanager + * + * @brief UiPopup is to support EFL popup UI which could be active on one UiView. A popup is used for traditional popping context information to give + * an option or information in its view context. Elm_Popup widget could be set as this UiPopup content for mobile profile. UiPopup will set up all + * Elm_Popup decorating options instead of users for their convenient. A UiPopup is designed to be one subordinate of one UiView in order to share + * events and contexts each other to work nicely. One of differ points of UiPopup with UiMenu is, multiple popup could be active at the same time. + * That means, a new UiPopup will be overlaid on the previous UiPopup on the demands. It's up to user's scenario. + * + * @warning UiPopup and its content, Elm_Popup will be deleted by its owned UiView on the proper time. So you can just leave its instance to it. + */ +class UiPopup : public UiBaseOverlay +{ +public: + /** + * @brief This is a constructor for initializing this popup. + * + * @param The instance of UiView. + */ + UiPopup(UiView *view); + + ///Destructor. + virtual ~UiPopup(); + + /** + * @brief popup activate. + * + * @note It makes popup state as show. + * + * @return @c true if it succeeds, @c false otherwise. + * + * @see deactivate() + */ + virtual bool activate(); + + /** + * @brief popup deactivate. + * + * @note It makes popup state as hide. + * + * @return @c true if it succeeds, @c false otherwise. + * + * @see activate() + */ + virtual bool deactivate(); + + /** + * @brief This is for replacing or setting a content of the popup. + * + * @param popup popup object. It allows @c NULL for canceling the previous content. + * + * @return @c true if it succeeds, @c false otherwise. + */ + virtual bool set_content(Elm_Popup* popup); + + /** + * @brief This is for unsetting a content of the popup. + * + * @return A previous content. If it wasn't, return value will be @c NULL. + */ + virtual Elm_Popup *unset_content(); + + /** + * @brief Return the active status of popup. + * + * @return @c true if overlay is activated, @c false otherwise. + * + * @see activate() + * @see deactivate() + */ + virtual bool is_activated(); + + /** + * @brief Get a base object of an UiPopup. + * + * @note Normally, A base object can be used for a parent of UiPopup content. + * + * @return base object of UiPopup. + */ + virtual Evas_Object *get_base(); + + /** + * @brief Get current popup's degree. + * + * @return Current rotation degree, -1 if it fails to get degree information. + */ + virtual int get_degree(); + +protected: + /** + * @brief Get a base window of viewmgr. + * + * @return viewmgr's window object. + */ + virtual Elm_Win *get_window(); + +private: + _UI_DECLARE_PRIVATE_IMPL(UiPopup); + _UI_DISABLE_COPY_AND_ASSIGN(UiPopup); +}; + +} + +#endif /* _UI_POPUP_H_ */ diff --git a/src/include/efl/mobile/UiStandardView.h b/src/include/efl/mobile/UiStandardView.h new file mode 100644 index 0000000..53602b1 --- /dev/null +++ b/src/include/efl/mobile/UiStandardView.h @@ -0,0 +1,224 @@ +/* + * 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_STANDARD_VIEW_H_ +#define _UI_STANDARD_VIEW_H_ + +namespace efl_viewmanager +{ + +/** + * @class UiView + * + * @ingroup efl_viewmanager + * + * @brief This is a mobile standard view. This view extends UiView and implements mobile specific behaviors for EFL view in mobile profile. + * Basically, UiStandardView implements standard UI form for mobile application view. It internally constructs a layout which builds a basic form + * view that is consisted of title, tool and content parts. The title part locally has a left, right button parts as well as title and sub title text + * parts. The tool part is designed for an additional tools feature in a view. Elm_Toolbar widget could be used for this part and UiStandardView will + * set up all Elm_Toolbar decorating options for users convenient. Lastly, the content part is used for main content for UiStandardView. According + * to the system profile, when this view is pushed into a UiViewmgr, it will internally create a software back key that triggers popping the view. + * + */ +class UiStandardView: public UiView +{ +public: + /** + * @brief A constructor for an UiStandardView. + * + * @param name view name. + */ + UiStandardView(const char *name = NULL); + + ///Destructor. + virtual ~UiStandardView(); + + /** + * @brief Replace or set a content of the view. + * + * @param content a new content. It allows @c NULL for canceling the previous content. + * @param title title_label The label in the title area. The name of the title label part is "elm.text.title" + * + * @return @c true if it succeeds, @c false otherwise. + */ + bool set_content(Evas_Object *content, const char *title = NULL); + + /** + * @brief Replace or set a content of the view. + * + * @param content A new content. It allows @c NULL for canceling the previous content. + * @param title The label in the title area. The name of the title label part is "elm.text.title". + * @param subtitle The label in the subtitle area. The name of the subtitle label part is "elm.text.subtitle". + * @param title_left_btn The button in the left part of title area. + * @param title_right_btn The button in the right part of title area. + * + * @return @c true if it succeeds, @c false otherwise. + */ + bool set_content(Evas_Object *content, const char *title, const char *subtitle, Elm_Button *title_left_btn, Elm_Button *title_right_btn); + + /** + * @brief Set a title badge text. + * + * @param text The label in the title badge area. + * + * @return @c true if it succeeds, @c false otherwise. + */ + bool set_title_badge(const char *text); + + /** + * @brief Set a subtitle text. + * + * @param text The label in the subtitle area. + * + * @return @c true if it succeeds, @c false otherwise. + */ + bool set_subtitle(const char *text); + + /** + * @brief Set a title_left_btn. + * + * @param title_left_btn The button in the left part of title area. + * + * @return @c true if it succeeds, @c false otherwise. + */ + bool set_title_left_btn(Elm_Button *title_left_btn); + + /** + * @brief Set a title_right_btn. + * + * @param title_right_btn The button in the right part of title area. + * + * @return @c true if it succeeds, @c false otherwise. + */ + bool set_title_right_btn(Elm_Button *title_right_btn); + + /** + * @brief Set a title text. + * + * @param text The label in the title area. + * + * @return @c true if it succeeds, @c false otherwise. + */ + bool set_title(const char *text); + + /** + * @brief Set a toolbar below title. + * + * @param toolbar Toolbar object. + * + * @return @c true if it succeeds, @c false otherwise. + */ + bool set_toolbar(Elm_Toolbar *toolbar); + + /** + * @brief Control the title visible state. + * + * @param visible title state set as visible if the given param is @c true, otherwise title area set as invisible. + * @param anim title area will be shown with animation if the given param is @c true, otherwise title area will be shown without animation. + * + * @return @c true if it succeeds, @c false otherwise. + */ + bool set_title_visible(bool visible, bool anim); + + /** + * @brief Unset a content of the view. + * + * @return A previous content. If it wasn't, return @c NULL. + */ + Evas_Object *unset_content(); + + /** + * @brief Unset a title left button of title area. + * + * @return A previous content. If it wasn't, return @c NULL. + */ + Elm_Button *unset_title_left_btn(); + + /** + * @brief Unset a title right button of title area. + * + * @return A previous content. If it wasn't, return @c NULL. + */ + Elm_Button *unset_title_right_btn(); + + /** + * @brief Unset a toolbar. + * + * @return A previous content. If it wasn't, return @c NULL. + */ + Elm_Toolbar *unset_toolbar(); + + /** + * @brief Return a title left button of the view. + * + * @return title left button of the view. + */ + Elm_Button *get_title_left_btn(); + + /** + * @brief Return a title right button of the view. + * + * @return title right button of the view. + */ + Elm_Button *get_title_right_btn(); + + /** + * @brief Return a toolbar of the view. + * + * @return toolbar of the view. + */ + Elm_Toolbar *get_toolbar(); + + /** + * @brief Get a base layout of viewmgr. + * + * @return viewmgr's base layout object. + */ + virtual Evas_Object *get_base(); + +protected: + /** + * @brief view load state. + * + * @note this state will be triggered by UiIfaceViewmgr. + * + */ + virtual void on_load(); + + /** @brief view unload state. + * + * @note this state will be triggered by UiIfaceViewmgr. + * + */ + virtual void on_unload(); + + /** @brief toggle event block. + * + * @note This interface is designed for toggling touch event on view transition. + * UiIfaceViewmgr will call this interface for notifying event blocking toggling on transition time. + * + * @param block @c true, blocking enable, otherwise @c false. + */ + virtual void set_event_block(bool block); + +private: + _UI_DECLARE_PRIVATE_IMPL(UiStandardView); + _UI_DISABLE_COPY_AND_ASSIGN(UiStandardView); +}; + +} + +#endif /* _UI_STANDARD_VIEW_H_ */ diff --git a/src/include/efl/mobile/UiView.h b/src/include/efl/mobile/UiView.h new file mode 100644 index 0000000..b61fd8b --- /dev/null +++ b/src/include/efl/mobile/UiView.h @@ -0,0 +1,154 @@ +/* + * 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_VIEW_H_ +#define _UI_VIEW_H_ + +namespace efl_viewmanager +{ + +class UiMenu; +class UiPopup; +class UiKeyListener; + +/** + * @class UiView + * + * @ingroup efl_viewmanager + * + * @brief This is a mobile view. Typically, this view extends UiBaseView and implements mobile specific behaviors for EFL view in mobile profile. + * Basically, UiView implements basics for running together with overlays such as UiMenu and UiPopup. You can use this UiView as an empty ui form + * view. + */ +class UiView: public UiBaseView +{ +public: + /** + * @brief This is a constructor for initializing this view resources. + * + * @param name view name. + * + * @warning if you don't set a view name, you could not look up the view with its name. @see ui_viewmgr_view_get_by_name() + */ + UiView(const char *name = NULL); + + ///Destructor. + virtual ~UiView(); + + /** + * @brief Get menu object. + * + * @return The menu object that connected with this view. + */ + const UiMenu *get_menu(); + +protected: + /** + * @brief This is making UiMenu instance. + * + * @note It creates UiMenu instance, if there is no connected UiMenu instance of this view. + * It hides menu if there is already menu activated. + * + * @return The menu instance of this view. NULL If the menu already activated. + */ + virtual UiMenu *on_menu_pre(); + + /** + * @brief Activate menu. + * + * @note It calls activate() for posting menu. If there is a menu instance. + */ + virtual void on_menu_post(); + + /** + * @brief The H/W menu key event occurs on view. + * + * @param menu menu instance, This is made by key listener when menu key occured. + */ + virtual void on_menu(UiMenu *menu); + + /** + * @brief The H/W back key event occurs on view. + * + * @note User can override this function to define application specific action when H/W back key + * event occurs. otherwise current view will be popped. + */ + virtual void on_back(); + + /** + * @brief View rotate changed. + * + * @note This state will be called when view rotation changed. + * + * @param degree Current view's degree. + * + * @see on_portrait() + * @see on_landscpae() + */ + virtual void on_rotate(int degree); + + /** + * @brief View portrait state. + * + * @note This state will be called when view rotation changed to portrait. + * + * @see on_landscpae() + * @see on_rotate() + */ + virtual void on_portrait(); + + /** + * @brief View landscape state. + * + * @note This state will be called when view rotation changed to landscape. + * + * @see on_portrait() + * @see on_rotate() + */ + virtual void on_landscape(); + + /** @brief View deactivate state. + * + * @note this state will be triggered by UiIfaceViewmgr. + * + */ + virtual void on_deactivate(); + +private: + /** + * @brief Push given popup instance in the internal popup stack. + * + * @param popup UiPopup instance + */ + void connect_popup(UiPopup *popup); + + /** + * @brief pop given popup instance in the internal popup stack. + * + * @param popup UiPopup instance + */ + void disconnect_popup(UiPopup *popup); + + _UI_DECLARE_PRIVATE_IMPL(UiView); + _UI_DISABLE_COPY_AND_ASSIGN(UiView); + _UI_DECLARE_FRIENDS(UiMenu); + _UI_DECLARE_FRIENDS(UiPopup); + _UI_DECLARE_FRIENDS(UiKeyListener); +}; + +} + +#endif /* _UI_VIEW_H_ */ diff --git a/src/include/efl/mobile/UiViewmgr.h b/src/include/efl/mobile/UiViewmgr.h new file mode 100644 index 0000000..6b9012a --- /dev/null +++ b/src/include/efl/mobile/UiViewmgr.h @@ -0,0 +1,56 @@ +/* + * 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_VIEWMGR_H_ +#define _UI_VIEWMGR_H_ + +namespace efl_viewmanager +{ + +class UiView; +class UiApp; + +/** + * @class UiViewmgr + * + * @ingroup efl_viewmanager + * + * @brief This is a mobile EFL view manager class. Typically, this view manager extends UiBaseViewmgr and implements mobile specific behaviors for + * EFL view manager in mobile profile. UiViewmgr is nothing more than UiBaseViewmgr in behavior perspective. It just comes out with renaming class + * for adapting with other EFL mobile classes. + */ +class UiViewmgr: public UiBaseViewmgr +{ +protected: + //Don't allow to create UiViewmgr instance + /** + * @brief This is a constructor for initializing viewmgr. + * + * @param pkg The name of package. + */ + UiViewmgr(const char *pkg); + + ///Destructor. + virtual ~UiViewmgr(); + +private: + _UI_DISABLE_COPY_AND_ASSIGN(UiViewmgr); + _UI_DECLARE_FRIENDS(UiView); + _UI_DECLARE_FRIENDS(UiApp); +}; +} + +#endif /* _UI_VIEWMGR_H_ */ diff --git a/src/include/efl/mobile/c/_ui_private.h b/src/include/efl/mobile/c/_ui_private.h index 7c92efb..53771f2 100644 --- a/src/include/efl/mobile/c/_ui_private.h +++ b/src/include/efl/mobile/c/_ui_private.h @@ -17,6 +17,12 @@ #ifndef _UI_PRIVATE_H_ #define _UI_PRIVATE_H_ -#include "../../../../include/efl/mobile/ui_mobile_viewmanager.h" +#include "../../../../include/efl/mobile/UiMobileViewManager.h" + +typedef UiViewmgr ui_viewmgr; +typedef UiView ui_view; +typedef UiStandardView ui_standard_view; +typedef UiMenu ui_menu; +typedef UiPopup ui_popup; #endif /* _UI_PRIVATE_H_ */ diff --git a/src/include/efl/mobile/c/ui_mobile_viewmanager.h b/src/include/efl/mobile/c/ui_mobile_viewmanager.h index 33f1a6d..ec23f7e 100644 --- a/src/include/efl/mobile/c/ui_mobile_viewmanager.h +++ b/src/include/efl/mobile/c/ui_mobile_viewmanager.h @@ -55,7 +55,7 @@ typedef struct ui_popup_s ui_popup; //FIXME: better way? -#include "../../../interface/ui_iface_types.h" +#include "../../../interface/UiIfaceTypes.h" #include "ui_application.h" #include "ui_menu.h" diff --git a/src/include/efl/mobile/c/ui_viewmgr.h b/src/include/efl/mobile/c/ui_viewmgr.h index 5360f89..d3acc53 100644 --- a/src/include/efl/mobile/c/ui_viewmgr.h +++ b/src/include/efl/mobile/c/ui_viewmgr.h @@ -148,7 +148,7 @@ EAPI ui_view *ui_viewmgr_view_get_by_idx(ui_viewmgr *viewmgr, int idx); * @return The view which name is matched with @p name. * If there were no views name matched, @c NULL will be returned. * - * @see ui_iface_view::set_name() + * @see UiIfaceView::set_name() */ EAPI ui_view *ui_viewmgr_view_get_by_name(ui_viewmgr *viewmgr, const char *name); diff --git a/src/include/efl/mobile/ui_app.h b/src/include/efl/mobile/ui_app.h deleted file mode 100644 index 2e9276b..0000000 --- a/src/include/efl/mobile/ui_app.h +++ /dev/null @@ -1,70 +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_APP_H_ -#define _UI_APP_H_ - -namespace efl_viewmanager -{ - -class ui_viewmgr; - -/* - * @class ui_iface_app - * - * @ingroup ui_viewmanager - * - * @brief ui_iface_app is designed for wrapping the application instance. This class hides unnecessary application settings but expose only basic functions - * such as initialization and run. Basically, it works on the application life-cycle. It has application life-cycle event interfaces such as create(), - * pause(), resume(), terminate(), etc so that users can handle those events for the their application concept. Also, It provides system event - * interfaces such as low_baterry(), low_meomory(), lang_changed(), region_changed() and so on. ui_iface_app create an unique ui_viewmgr instance - * internally, and manage its life. -*/ -class ui_app : public ui_iface_app -{ -public: - /** - * @brief This is a constructor for initializing ui_app. - * - * @param pkg The name of package. - * @param loale_dir The path of locale directory. - */ - ui_app(const char *pkg, const char *locale_dir); - - ///Destructor. - virtual ~ui_app(); - - /** - * @brief Return the viewmgr instance. - * - * @return ui_viewmgr instance. - */ - ui_viewmgr *get_viewmgr(); - - /** - * @brief Return ui_app instance. - * - * @return The instance of ui_app. - */ - static ui_app *get_instance(); - -private: - _UI_DISABLE_COPY_AND_ASSIGN(ui_app); -}; - -} - -#endif /* _UI_APP_H_ */ diff --git a/src/include/efl/mobile/ui_key_listener.h b/src/include/efl/mobile/ui_key_listener.h deleted file mode 100644 index 63cfcba..0000000 --- a/src/include/efl/mobile/ui_key_listener.h +++ /dev/null @@ -1,59 +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_KEY_LISTENER_H_ -#define _UI_KEY_LISTENER_H_ - -namespace efl_viewmanager -{ -class ui_viewmgr; - -/** - * @class ui_key_listener - * - * @ingroup efl_viewmanager - * - * @brief This class extends to ui_base_key_listener to support an additional HW Menu key for mobile profile. Basically, HW Menu key will be propagated to - * the top view and ui_view::on_menu() will be triggered. - */ -class ui_key_listener : public ui_base_key_listener -{ -public: - /** - * @brief This is a constructor for initializing this ui_key_listener. - * - * @param The instance of ui_viewmgr. - */ - ui_key_listener(ui_viewmgr *viewmgr); - - /** - * @brief Init H/W key listener to grab key event(menu key). - * - * @note Add menu key to target of key grabber. - */ - virtual bool init(); - - /** - * @brief Check the menu key event occurs or not. - * - * @note This is checking H/W key is menu or not. - */ - virtual void extend_event_proc(ui_base_view *view, Evas_Event_Key_Down *ev); -}; - -} - -#endif /* _UI_KEY_LISTENER_H_ */ diff --git a/src/include/efl/mobile/ui_menu.h b/src/include/efl/mobile/ui_menu.h deleted file mode 100644 index 1fd41c8..0000000 --- a/src/include/efl/mobile/ui_menu.h +++ /dev/null @@ -1,128 +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_MENU_H_ -#define _UI_MENU_H_ - -namespace efl_viewmanager -{ -class ui_view; - -/** - * @class ui_menu - * - * @ingroup efl_viewmanager - * - * @brief ui_menu is to support EFL menu UI which could be active on one ui_view. A menu is used for traditional contextual popup to give an option in its - * view context. Elm_Ctxpopup widget could be set as this ui_menu content for mobile profile. ui_menu will set up all Elm_Ctxpopup decorating - * options instead of users for their convenient. A ui_menu is designed to be one subordinate of one ui_view in order to share events and contexts - * each other to work nicely. Only one menu could be active on a ui_view. That means the previous menu will be removed by ui_view when a new menu comes. - * - * @warning ui_menu and its content, Elm_Ctxpopup will be deleted by its owned ui_view on the proper time. So you can just leave its instance to it. - */ -class ui_menu: public ui_base_overlay -{ -public: - /** - * @brief menu activate. - * - * @note It makes menu state as show. - * - * @return @c true if it succeeds, @c false otherwise. - * - * @see deactivate() - */ - virtual bool activate(); - - /** - * @brief menu deactivate. - * - * @note It makes menu state as hide. - * - * @return @c true if it succeeds, @c false otherwise. - * - * @see activate() - */ - virtual bool deactivate(); - - /** - * @brief This is for replacing or setting a content of the menu. - * - * @param ctxpopup ctxpopup object. It allows @c NULL for canceling the previous content. - * - * @return @c true if it succeeds, @c false otherwise. - */ - virtual bool set_content(Elm_Ctxpopup* ctxpopup); - - /** - * @brief This is for unsetting a content of the menu. - * - * @return A previous content. If it wasn't, return value will be @c NULL. - */ - virtual Elm_Ctxpopup *unset_content(); - - /** - * @brief Return the active status of menu. - * - * @return @c true if menu is activated, @c false otherwise. - * - * @see activate() - * @see deactivate() - */ - virtual bool is_activated(); - - /** - * @brief Get a base object of a ui_menu. - * - * @note Normally, A base object can be used for a parent of ui_menu content. - * @return base object of ui_menu. - */ - virtual Evas_Object *get_base(); - - /** - * @brief Get a current menu's degree. - * - * @return Current rotation degree, -1 if it fails to get degree information. - */ - virtual int get_degree(); - -protected: - /** - * @brief This is a constructor for initializing this menu. - * - * @param The instance of ui_view. - */ - ui_menu(ui_view *view); - - ///Destructor. - virtual ~ui_menu(); - - /** - * @brief Get a base window of viewmgr. - * - * @return viewmgr's window object. - */ - Elm_Win *get_window(); - -private: - _UI_DECLARE_PRIVATE_IMPL(ui_menu); - _UI_DISABLE_COPY_AND_ASSIGN(ui_menu); - _UI_DECLARE_FRIENDS(ui_view); -}; - -} - -#endif /* _UI_MENU_H_ */ diff --git a/src/include/efl/mobile/ui_mobile_viewmanager.h b/src/include/efl/mobile/ui_mobile_viewmanager.h deleted file mode 100644 index 62841ea..0000000 --- a/src/include/efl/mobile/ui_mobile_viewmanager.h +++ /dev/null @@ -1,31 +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_MOBILE_VIEWMANAGER_H_ -#define _UI_MOBILE_VIEWMANAGER_H_ - -#include "../ui_base_viewmanager.h" -#include "ui_view.h" -#include "ui_standard_view.h" -#include "ui_key_listener.h" -#include "ui_viewmgr.h" -#include "ui_menu.h" -#include "ui_popup.h" -#include "ui_app.h" - -#define UI_VIEWMGR (ui_app::get_instance()->get_viewmgr()) - -#endif /* UI_MOBILE_VIEWMANAGER_H */ diff --git a/src/include/efl/mobile/ui_popup.h b/src/include/efl/mobile/ui_popup.h deleted file mode 100644 index bdacad7..0000000 --- a/src/include/efl/mobile/ui_popup.h +++ /dev/null @@ -1,130 +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_POPUP_H_ -#define _UI_POPUP_H_ - -namespace efl_viewmanager -{ - -class ui_view; - -/** - * @class ui_popup - * - * @ingroup efl_viewmanager - * - * @brief ui_popup is to support EFL popup UI which could be active on one ui_view. A popup is used for traditional popping context information to give - * an option or information in its view context. Elm_Popup widget could be set as this ui_popup content for mobile profile. ui_popup will set up all - * Elm_Popup decorating options instead of users for their convenient. A ui_popup is designed to be one subordinate of one ui_view in order to share - * events and contexts each other to work nicely. One of differ points of ui_popup with ui_menu is, multiple popup could be active at the same time. - * That means, a new ui_popup will be overlaid on the previous ui_popup on the demands. It's up to user's scenario. - * - * @warning ui_popup and its content, Elm_Popup will be deleted by its owned ui_view on the proper time. So you can just leave its instance to it. - */ -class ui_popup : public ui_base_overlay -{ -public: - /** - * @brief This is a constructor for initializing this popup. - * - * @param The instance of ui_view. - */ - ui_popup(ui_view *view); - - ///Destructor. - virtual ~ui_popup(); - - /** - * @brief popup activate. - * - * @note It makes popup state as show. - * - * @return @c true if it succeeds, @c false otherwise. - * - * @see deactivate() - */ - virtual bool activate(); - - /** - * @brief popup deactivate. - * - * @note It makes popup state as hide. - * - * @return @c true if it succeeds, @c false otherwise. - * - * @see activate() - */ - virtual bool deactivate(); - - /** - * @brief This is for replacing or setting a content of the popup. - * - * @param popup popup object. It allows @c NULL for canceling the previous content. - * - * @return @c true if it succeeds, @c false otherwise. - */ - virtual bool set_content(Elm_Popup* popup); - - /** - * @brief This is for unsetting a content of the popup. - * - * @return A previous content. If it wasn't, return value will be @c NULL. - */ - virtual Elm_Popup *unset_content(); - - /** - * @brief Return the active status of popup. - * - * @return @c true if overlay is activated, @c false otherwise. - * - * @see activate() - * @see deactivate() - */ - virtual bool is_activated(); - - /** - * @brief Get a base object of an ui_popup. - * - * @note Normally, A base object can be used for a parent of ui_popup content. - * - * @return base object of ui_popup. - */ - virtual Evas_Object *get_base(); - - /** - * @brief Get current popup's degree. - * - * @return Current rotation degree, -1 if it fails to get degree information. - */ - virtual int get_degree(); - -protected: - /** - * @brief Get a base window of viewmgr. - * - * @return viewmgr's window object. - */ - virtual Elm_Win *get_window(); - -private: - _UI_DECLARE_PRIVATE_IMPL(ui_popup); - _UI_DISABLE_COPY_AND_ASSIGN(ui_popup); -}; - -} - -#endif /* _UI_POPUP_H_ */ diff --git a/src/include/efl/mobile/ui_standard_view.h b/src/include/efl/mobile/ui_standard_view.h deleted file mode 100644 index 518ad0e..0000000 --- a/src/include/efl/mobile/ui_standard_view.h +++ /dev/null @@ -1,224 +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_STANDARD_VIEW_H_ -#define _UI_STANDARD_VIEW_H_ - -namespace efl_viewmanager -{ - -/** - * @class ui_view - * - * @ingroup efl_viewmanager - * - * @brief This is a mobile standard view. This view extends ui_view and implements mobile specific behaviors for EFL view in mobile profile. - * Basically, ui_standard_view implements standard UI form for mobile application view. It internally constructs a layout which builds a basic form - * view that is consisted of title, tool and content parts. The title part locally has a left, right button parts as well as title and sub title text - * parts. The tool part is designed for an additional tools feature in a view. Elm_Toolbar widget could be used for this part and ui_standard_view will - * set up all Elm_Toolbar decorating options for users convenient. Lastly, the content part is used for main content for ui_standard_view. According - * to the system profile, when this view is pushed into a ui_viewmgr, it will internally create a software back key that triggers popping the view. - * - */ -class ui_standard_view: public ui_view -{ -public: - /** - * @brief A constructor for an ui_standard_view. - * - * @param name view name. - */ - ui_standard_view(const char *name = NULL); - - ///Destructor. - virtual ~ui_standard_view(); - - /** - * @brief Replace or set a content of the view. - * - * @param content a new content. It allows @c NULL for canceling the previous content. - * @param title title_label The label in the title area. The name of the title label part is "elm.text.title" - * - * @return @c true if it succeeds, @c false otherwise. - */ - bool set_content(Evas_Object *content, const char *title = NULL); - - /** - * @brief Replace or set a content of the view. - * - * @param content A new content. It allows @c NULL for canceling the previous content. - * @param title The label in the title area. The name of the title label part is "elm.text.title". - * @param subtitle The label in the subtitle area. The name of the subtitle label part is "elm.text.subtitle". - * @param title_left_btn The button in the left part of title area. - * @param title_right_btn The button in the right part of title area. - * - * @return @c true if it succeeds, @c false otherwise. - */ - bool set_content(Evas_Object *content, const char *title, const char *subtitle, Elm_Button *title_left_btn, Elm_Button *title_right_btn); - - /** - * @brief Set a title badge text. - * - * @param text The label in the title badge area. - * - * @return @c true if it succeeds, @c false otherwise. - */ - bool set_title_badge(const char *text); - - /** - * @brief Set a subtitle text. - * - * @param text The label in the subtitle area. - * - * @return @c true if it succeeds, @c false otherwise. - */ - bool set_subtitle(const char *text); - - /** - * @brief Set a title_left_btn. - * - * @param title_left_btn The button in the left part of title area. - * - * @return @c true if it succeeds, @c false otherwise. - */ - bool set_title_left_btn(Elm_Button *title_left_btn); - - /** - * @brief Set a title_right_btn. - * - * @param title_right_btn The button in the right part of title area. - * - * @return @c true if it succeeds, @c false otherwise. - */ - bool set_title_right_btn(Elm_Button *title_right_btn); - - /** - * @brief Set a title text. - * - * @param text The label in the title area. - * - * @return @c true if it succeeds, @c false otherwise. - */ - bool set_title(const char *text); - - /** - * @brief Set a toolbar below title. - * - * @param toolbar Toolbar object. - * - * @return @c true if it succeeds, @c false otherwise. - */ - bool set_toolbar(Elm_Toolbar *toolbar); - - /** - * @brief Control the title visible state. - * - * @param visible title state set as visible if the given param is @c true, otherwise title area set as invisible. - * @param anim title area will be shown with animation if the given param is @c true, otherwise title area will be shown without animation. - * - * @return @c true if it succeeds, @c false otherwise. - */ - bool set_title_visible(bool visible, bool anim); - - /** - * @brief Unset a content of the view. - * - * @return A previous content. If it wasn't, return @c NULL. - */ - Evas_Object *unset_content(); - - /** - * @brief Unset a title left button of title area. - * - * @return A previous content. If it wasn't, return @c NULL. - */ - Elm_Button *unset_title_left_btn(); - - /** - * @brief Unset a title right button of title area. - * - * @return A previous content. If it wasn't, return @c NULL. - */ - Elm_Button *unset_title_right_btn(); - - /** - * @brief Unset a toolbar. - * - * @return A previous content. If it wasn't, return @c NULL. - */ - Elm_Toolbar *unset_toolbar(); - - /** - * @brief Return a title left button of the view. - * - * @return title left button of the view. - */ - Elm_Button *get_title_left_btn(); - - /** - * @brief Return a title right button of the view. - * - * @return title right button of the view. - */ - Elm_Button *get_title_right_btn(); - - /** - * @brief Return a toolbar of the view. - * - * @return toolbar of the view. - */ - Elm_Toolbar *get_toolbar(); - - /** - * @brief Get a base layout of viewmgr. - * - * @return viewmgr's base layout object. - */ - virtual Evas_Object *get_base(); - -protected: - /** - * @brief view load state. - * - * @note this state will be triggered by ui_iface_viewmgr. - * - */ - virtual void on_load(); - - /** @brief view unload state. - * - * @note this state will be triggered by ui_iface_viewmgr. - * - */ - virtual void on_unload(); - - /** @brief toggle event block. - * - * @note This interface is designed for toggling touch event on view transition. - * ui_iface_viewmgr will call this interface for notifying event blocking toggling on transition time. - * - * @param block @c true, blocking enable, otherwise @c false. - */ - virtual void set_event_block(bool block); - -private: - _UI_DECLARE_PRIVATE_IMPL(ui_standard_view); - _UI_DISABLE_COPY_AND_ASSIGN(ui_standard_view); -}; - -} - -#endif /* _UI_STANDARD_VIEW_H_ */ diff --git a/src/include/efl/mobile/ui_view.h b/src/include/efl/mobile/ui_view.h deleted file mode 100644 index 5ae1d94..0000000 --- a/src/include/efl/mobile/ui_view.h +++ /dev/null @@ -1,154 +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_VIEW_H_ -#define _UI_VIEW_H_ - -namespace efl_viewmanager -{ - -class ui_menu; -class ui_popup; -class ui_key_listener; - -/** - * @class ui_view - * - * @ingroup efl_viewmanager - * - * @brief This is a mobile view. Typically, this view extends ui_base_view and implements mobile specific behaviors for EFL view in mobile profile. - * Basically, ui_view implements basics for running together with overlays such as ui_menu and ui_popup. You can use this ui_view as an empty ui form - * view. - */ -class ui_view: public ui_base_view -{ -public: - /** - * @brief This is a constructor for initializing this view resources. - * - * @param name view name. - * - * @warning if you don't set a view name, you could not look up the view with its name. @see ui_viewmgr_view_get_by_name() - */ - ui_view(const char *name = NULL); - - ///Destructor. - virtual ~ui_view(); - - /** - * @brief Get menu object. - * - * @return The menu object that connected with this view. - */ - const ui_menu *get_menu(); - -protected: - /** - * @brief This is making ui_menu instance. - * - * @note It creates ui_menu instance, if there is no connected ui_menu instance of this view. - * It hides menu if there is already menu activated. - * - * @return The menu instance of this view. NULL If the menu already activated. - */ - virtual ui_menu *on_menu_pre(); - - /** - * @brief Activate menu. - * - * @note It calls activate() for posting menu. If there is a menu instance. - */ - virtual void on_menu_post(); - - /** - * @brief The H/W menu key event occurs on view. - * - * @param menu menu instance, This is made by key listener when menu key occured. - */ - virtual void on_menu(ui_menu *menu); - - /** - * @brief The H/W back key event occurs on view. - * - * @note User can override this function to define application specific action when H/W back key - * event occurs. otherwise current view will be popped. - */ - virtual void on_back(); - - /** - * @brief View rotate changed. - * - * @note This state will be called when view rotation changed. - * - * @param degree Current view's degree. - * - * @see on_portrait() - * @see on_landscpae() - */ - virtual void on_rotate(int degree); - - /** - * @brief View portrait state. - * - * @note This state will be called when view rotation changed to portrait. - * - * @see on_landscpae() - * @see on_rotate() - */ - virtual void on_portrait(); - - /** - * @brief View landscape state. - * - * @note This state will be called when view rotation changed to landscape. - * - * @see on_portrait() - * @see on_rotate() - */ - virtual void on_landscape(); - - /** @brief View deactivate state. - * - * @note this state will be triggered by ui_iface_viewmgr. - * - */ - virtual void on_deactivate(); - -private: - /** - * @brief Push given popup instance in the internal popup stack. - * - * @param popup ui_popup instance - */ - void connect_popup(ui_popup *popup); - - /** - * @brief pop given popup instance in the internal popup stack. - * - * @param popup ui_popup instance - */ - void disconnect_popup(ui_popup *popup); - - _UI_DECLARE_PRIVATE_IMPL(ui_view); - _UI_DISABLE_COPY_AND_ASSIGN(ui_view); - _UI_DECLARE_FRIENDS(ui_menu); - _UI_DECLARE_FRIENDS(ui_popup); - _UI_DECLARE_FRIENDS(ui_key_listener); -}; - -} - -#endif /* _UI_VIEW_H_ */ diff --git a/src/include/efl/mobile/ui_viewmgr.h b/src/include/efl/mobile/ui_viewmgr.h deleted file mode 100644 index d285c5c..0000000 --- a/src/include/efl/mobile/ui_viewmgr.h +++ /dev/null @@ -1,56 +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_VIEWMGR_H_ -#define _UI_VIEWMGR_H_ - -namespace efl_viewmanager -{ - -class ui_view; -class ui_app; - -/** - * @class ui_viewmgr - * - * @ingroup efl_viewmanager - * - * @brief This is a mobile EFL view manager class. Typically, this view manager extends ui_base_viewmgr and implements mobile specific behaviors for - * EFL view manager in mobile profile. ui_viewmgr is nothing more than ui_base_viewmgr in behavior perspective. It just comes out with renaming class - * for adapting with other EFL mobile classes. - */ -class ui_viewmgr: public ui_base_viewmgr -{ -protected: - //Don't allow to create ui_viewmgr instance - /** - * @brief This is a constructor for initializing viewmgr. - * - * @param pkg The name of package. - */ - ui_viewmgr(const char *pkg); - - ///Destructor. - virtual ~ui_viewmgr(); - -private: - _UI_DISABLE_COPY_AND_ASSIGN(ui_viewmgr); - _UI_DECLARE_FRIENDS(ui_view); - _UI_DECLARE_FRIENDS(ui_app); -}; -} - -#endif /* _UI_VIEWMGR_H_ */ diff --git a/src/include/efl/ui_base_key_listener.h b/src/include/efl/ui_base_key_listener.h deleted file mode 100644 index 1852f85..0000000 --- a/src/include/efl/ui_base_key_listener.h +++ /dev/null @@ -1,95 +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_KEY_LISTENER_H_ -#define _UI_BASE_KEY_LISTENER_H_ - -namespace efl_viewmanager -{ - -class ui_base_viewmgr; - -/** - * @class ui_base_key_listener - * - * @ingroup efl_viewmanager - * - * @brief This is a base class of EFL key listener. Typically, this class has a role for delegating event propagation from system to a view. - * ui_base_key_listener grabs HW back key event then pass it to the top view from the view manager. You could extend this class for more HW key - * events for your profile feature. By overriding ui_base_key_listener::extend_event_proc(), you could get the key event information when that event is - * triggered. This class must be requested by ui_base_viewmgr and controlled wholly by it. - */ -class ui_base_key_listener -{ -protected: - /** - * @brief This is a constructor for initializing key listener. - * - * @param viewmgr The instance of ui_base_viewmgr. - */ - ui_base_key_listener(ui_base_viewmgr *viewmgr); - - ///Destructor. - virtual ~ui_base_key_listener(); - - /** - * @brief Init H/W key listener to grab key event(back key). - * - * @note It makes evas_object_rectangle and add key up callback to grab key event. - * - * @see term() - */ - virtual bool init(); - - /** - * @brief Terminate H/W key listener. - * - * @note Delete key grabber(evas_object_rectangle). - * - * @see init() - */ - virtual bool term(); - - /** - * @brief Check the menu key event occurs or not. - * - * @note This is checking H/W key is menu or not. - */ - virtual void extend_event_proc(ui_base_view *view, Evas_Event_Key_Down *ev) {} - - /** - * @brief Return the viewmgr instance. - * - * @return ui_base_viewmgr instance. - */ - ui_base_viewmgr *get_viewmgr(); - - /** - * @brief Return the key grabber(evas_object_rectangle). - * - * @return key grabber object. - */ - Evas_Object *get_keygrab_obj(); - -private: - _UI_DECLARE_PRIVATE_IMPL(ui_base_key_listener); - _UI_DISABLE_COPY_AND_ASSIGN(ui_base_key_listener); - _UI_DECLARE_FRIENDS(ui_base_viewmgr); -}; - -} - -#endif /* _UI_BASE_KEY_LISTENER_H_ */ diff --git a/src/include/efl/ui_base_overlay.h b/src/include/efl/ui_base_overlay.h deleted file mode 100644 index 998e72d..0000000 --- a/src/include/efl/ui_base_overlay.h +++ /dev/null @@ -1,51 +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_OVERLAY_H_ -#define _UI_BASE_OVERLAY_H_ - -namespace efl_viewmanager -{ - -class ui_base_view; - -/** - * @class ui_base_overlay - * - * @internal - * @ingroup efl_viewmanager - * - * @brief This is a base class to support EFL overlay view which could be active on other ui_base_view. An overlay is designed to be one subordinate of one - * ui_base_view. ui_base_overlay is nothing more than ui_iface_overlay in behavior perspective. It just comes out with renaming class for adapting with - * other EFL base classes. - */ -class ui_base_overlay: public ui_iface_overlay -{ -protected: - /** - * @brief This is a constructor for initializing overlay. - * - * @param view The instance of ui_base_view. - */ - ui_base_overlay(ui_base_view *view); - - ///Destructor. - virtual ~ui_base_overlay(); -}; - -} - -#endif /* _UI_BASE_OVERLAY_H_ */ diff --git a/src/include/efl/ui_base_view.h b/src/include/efl/ui_base_view.h deleted file mode 100644 index 4c62844..0000000 --- a/src/include/efl/ui_base_view.h +++ /dev/null @@ -1,142 +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_VIEW_H_ -#define _UI_BASE_VIEW_H_ - -namespace efl_viewmanager -{ - -/** - * @class ui_base_view - * - * @ingroup efl_viewmanager - * - * @brief This is a base class of EFL view. Typically, this view extends ui_iface_view and implements basic behaviors for EFL view in all profiles. - * A view must have one Evas_Object content instance which represents a view for a current screen. - */ -class ui_base_view: public ui_iface_view -{ -public: - /** - * @brief This is a constructor for initializing this view resources. - * - * @param name view name. - */ - ui_base_view(const char *name = NULL); - - ///Destructor. - virtual ~ui_base_view(); - - /** - * @brief This is for replacing or setting a content of the view. - * - * @param content a new content. It allows @c NULL for canceling the previous content. - * - * @return A previous content. If it wasn't, return @c NULL. - */ - virtual bool set_content(Evas_Object *content); - - /** - * @brief This is for unsetting a content of the view. - * - * @return A previous content. If it wasn't, return @c NULL. - */ - virtual Evas_Object *unset_content(); - - /** - * @brief Get a base object of ui_view. - * - * @note Normally, this base object can be used for a parent of a view content. - * - * @return The base object of ui_view. - */ - virtual Evas_Object *get_base(); - - /** - * @brief Set the indicator mode. - * - * @param indicator The mode to set, one of #ui_base_view_indicator. - */ - virtual void set_indicator(ui_view_indicator indicator); - - /** - * @brief Get current view's degree. - * - * @return Current rotation degree, -1 if it fails to get degree information. - */ - virtual int get_degree(); - -protected: - /** - * @brief Get a parent object of view. - * - * @note This is calling viewmgr get_base() method internally. - * - * @return The base layout object of viewmgr. - */ - Evas_Object *get_parent(); - - /** - * @brief Toggle event block. - * - * @note It makes view content event freeze during effect showing. - * - * @param block @c true, when blocking is enabled, otherwise @c false. - */ - virtual void set_event_block(bool block); - - /** - * @brief View rotate changed. - * - * @note This state will be called when view rotation changed. - * - * @param degree The current degree of view. - * - * @see on_portrait() - * @see on_landscpae() - */ - virtual void on_rotate(int degree); - - /** - * @brief View portrait state. - * - * @note This state will be called when view rotation changed to portrait. - * - * @see on_landscpae() - * @see on_rotate() - */ - virtual void on_portrait(); - - /** - * @brief View landscape state. - * - * @note This state will be called when view rotation changed to landscape. - * - * @see on_portrait() - * @see on_rotate() - */ - virtual void on_landscape(); - -private: - _UI_DECLARE_PRIVATE_IMPL(ui_base_view); - _UI_DISABLE_COPY_AND_ASSIGN(ui_base_view); - _UI_DECLARE_FRIENDS(ui_base_viewmgr); -}; - -} - -#endif /* _UI_BASE_VIEW_H_ */ diff --git a/src/include/efl/ui_base_viewmanager.h b/src/include/efl/ui_base_viewmanager.h deleted file mode 100644 index 6b5f37e..0000000 --- a/src/include/efl/ui_base_viewmanager.h +++ /dev/null @@ -1,35 +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_VIEWMANAGER_H_ -#define _UI_BASE_VIEWMANAGER_H_ - -//FIXME: ?? -#ifndef Elm_Conformant -#define Elm_Conformant Evas_Object -#endif - -#include "../interface/ui_iface_viewmanager.h" -#include "ui_base_overlay.h" -#include "ui_base_key_listener.h" -#include "ui_base_viewmgr.h" -#include "ui_base_view.h" - -#define UI_BASE_VIEWMGR dynamic_cast(ui_iface_viewmgr::get_instance()) - -using namespace efl_viewmanager; - -#endif /* UI_BASE_VIEWMANAGER_H */ diff --git a/src/include/efl/ui_base_viewmgr.h b/src/include/efl/ui_base_viewmgr.h deleted file mode 100644 index 7979bda..0000000 --- a/src/include/efl/ui_base_viewmgr.h +++ /dev/null @@ -1,215 +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_VIEWMGR_H_ -#define _UI_BASE_VIEWMGR_H_ - -namespace efl_viewmanager -{ - -class ui_base_view; - -/** - * @class ui_base_viewmgr - * - * @ingroup efl_viewmanager - * - * @brief This is a base class of EFL view manager. Typically, this view manager extends ui_iface_viewmgr and implement basic behaviors for - * EFL view manager in all profiles. Basically, this view manager has one default window to display several logic views as well as this has - * a conformant and default application layout to display indicator, application layout and virtual keypad properly. This base view manager implements - * view transition effects. Of course, those could be customized for each profile. Also, it implements events blocking for views during views going - * back and forth. But the behavior will be turned on/off based on the system profile. - * - * @warning viewmgr will remove its window, conformant and default layout when it's destroyed. - */ -class ui_base_viewmgr: public ui_iface_viewmgr -{ -public: - /** - * @brief Activate this view manager. - * - * @note viewmgr window and views will be shown once activate() is called. Usually this activate() should be called after applications set their all views - * on initialization time. - * - * @return @c true on success or @c false otherwise. - * - * @see deactivate() - */ - virtual bool activate(); - - /** - * @brief Deactivate this view manager. - * - * @note viewmgr window and views will be hidden once deactivate() is called. deactivate() behavior is up ui system, but usually it hides(unmap) - * current window in order that application go background. - * - * @return @c true success or @c false not. - * - * @see activate() - */ - virtual bool deactivate(); - - /** - * @brief Push a new view into this viewmgr. This function is used for when application switches a current view to a new one. - * - * @note Normally, the current view will be hidden by a new view. In default, when user calls this API, view will be switched to @p view instantly, - * only when viewmgr state is activated. Otherwise, the @p view will be shown later when viewmgr is activated. push_view() is designed for providing - * view transition effect. If you want push view instantly without any transition, you could use insert_view_before() or insert_view_after(). - * If you want to pop the current view, the please use pop_view(). - * - * @param view A view to insert in the viewmgr view list. - * - * @return @p view, @c NULL when it fails to push a @p view. - * - * @see activated() - * @see insert_view_before() - * @see insert_view_after() - * @see pop_view() - */ - virtual ui_base_view *push_view(ui_base_view *view); - - /** - * @brief Pop the top(last) view from this viewmgr view list. - * This function is used when application switches the current view back to the previous view. - * The top view will be removed from the view stack and then it will be deleted by the viewmgr. - * - * @note If the view is just one left, then viewmgr would be deactivated automatically since the ui application might be invalid anymore. Otherwise, - * the application will be terminated. It's up to system configuration. - * - * @return @c true on success or @c false otherwise. - * - * @see deactivate() - * @see push_view() - */ - virtual bool pop_view(); - - /** - * @brief Insert a view in this viewmgr view list. Specifically, insert a given @p view right before of the given view, @before. - * - * @param view A view to insert in the viewmgr view list. - * @param before A view that will be just inserted after @p view. If you pass @c NULL, @p view will be inserted at the front of the view list. - * - * @return @c true on success or @c false otherwise. - */ - virtual bool insert_view_before(ui_base_view *view, ui_base_view *before); - - /** - * @brief Insert a view in this viewmgr view list. Specifically, insert a given @p view right after of the given view, @after. - * - * @param view A view to insert in the viewmgr view list. - * @param after A view that will be just inserted before the @p view. If you pass @c NULL, @p view will be inserted at the end of the view list. - * - * @return @c true on success or @c false otherwise. - */ - virtual bool insert_view_after(ui_base_view *view, ui_base_view *after); - - /** - * @brief Get a window object of viewmgr. - * - * @return The window object of viewmgr. - */ - Elm_Win *get_window(); - - /** - * @brief Get a conformant object of viewmgr. - * - * @return The conformant object of viewmgr. - */ - Elm_Conformant *get_conformant(); - - /** - * @brief Return a last(top) view. - * - * @return The view which is last view of the viewmgr view list. - */ - ui_base_view *get_last_view(); - - /** - * @brief Return a view which is matched with the index @p idx. - * - * @param idx A index of the view which you are looking for. - * - * @return The view which index is matched with @p idx. - * If there were no views with index @p idx, @c NULL will be returned. - * - * @note You could use the index as the page numbers of the views. - * @warning the index number of views are variable since the view list is variable. - * - * @see get_view_index() - * @see get_view_count() - */ - ui_base_view *get_view(unsigned int idx); - - /** - * @brief Return a view which is matched with the @p name. - * - * @note Every view have their names as their own identifiers. - * - * @param name The name of the view which you are looking for. - * - * @return The view which name is matched with @p name. - * If there were no views name matched, @c NULL will be returned. - * - * @see ui_iface_view::set_name() - */ - ui_base_view *get_view(const char *name); - - /** - * @brief Get a base object of this viewmgr. - * - * @note Normally, a base object can be used for adding additional objects. - * - * @return The base object of this viewmgr. - */ - Evas_Object *get_base(); - -protected: - /** - * @brief Set indicator of the view. - * - * @param indicator The mode to set, one of #ui_view_indicator. - * - * @return @c false if current indicator is same with new one, @c true otherwise. - */ - bool set_indicator(ui_view_indicator indicator); - - /** - * @brief This is a constructor for initializing viewmgr. - * - * @param pkg The name of package. - * @param key_listener The instance of ui_base_key_listner. - */ - ui_base_viewmgr(const char *pkg, ui_base_key_listener *key_listener); - - /** - * @brief This is a constructor for initializing viewmgr. - * - * @param pkg The name of package. - */ - ui_base_viewmgr(const char *pkg); - - ///Destructor. - virtual ~ui_base_viewmgr(); - -private: - _UI_DECLARE_PRIVATE_IMPL(ui_base_viewmgr); - _UI_DISABLE_COPY_AND_ASSIGN(ui_base_viewmgr); - _UI_DECLARE_FRIENDS(ui_base_view); -}; - -} - -#endif /* _UI_BASE_VIEWMGR_H_ */ diff --git a/src/include/interface/UiIfaceApp.h b/src/include/interface/UiIfaceApp.h new file mode 100644 index 0000000..7cc38d5 --- /dev/null +++ b/src/include/interface/UiIfaceApp.h @@ -0,0 +1,153 @@ +/* + * 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_IFACE_APP_H_ +#define _UI_IFACE_APP_H_ + +namespace ui_viewmanager { + +class UiIfaceViewmgr; + +/** + * @class UiIfaceApp + * + * @ingroup ui_viewmanager + * + * @brief UiIfaceApp is designed for wrapping the application instance. This class hides unnecessary application settings but expose only basic functions + * such as initialization and run. Basically, it works on the application life-cycle. It has application life-cycle event interfaces such as create(), + * pause(), resume(), terminate(), etc so that users can handle those events for the their application concept. Also, It provides system event + * interfaces such as low_baterry(), low_meomory(), lang_changed(), region_changed() and so on. UiIfaceApp create an unique ui_viewmgr instance + * internally, and manage its life. + */ +class UiIfaceApp +{ +public: + /** + * @brief This is a constructor for initializing UiIfaceApp. + * + * @param pkg The name of package. + * @param loale_dir The path of locale directory. + * @param viewmgr instance of ui_viewmgr. + */ + UiIfaceApp(const char *pkg, const char *locale_dir, UiIfaceViewmgr *viewmgr); + + ///Destructor. + virtual ~UiIfaceApp(); + + /** + * @brief Return the viewmgr instance. + * + * @return UiIfaceViewmgr instance. + */ + UiIfaceViewmgr *get_viewmgr(); + + /** + * @brief Return UiIfaceApp instance. + * + * @return The instance of UiIfaceApp. + */ + static UiIfaceApp *get_instance(); + + /** + * @brief Application life-cycle start and add application event callback functions add. + * + * @note This is calling ui_app_main function to start application life-cycle start. + * and adding all of the functions for application events handling such as + * create, terminate, pause, resume, app_control, APP_EVENT_LOW_BATTERY, APP_EVENT_LOW_MEMORY + * APP_EVENT_DEVICE_ORIENTATION_CHANGED, APP_EVENT_LANGUAGE_CHANGED, APP_EVENT_REGION_FORMAT_CHANGED. + * Application can add those events using wrapping functions by viewmgr supported. + */ + virtual int run(int argc, char **argv); + +protected: + /** + * @brief Calling before the main event loop start. + * + * @note Take necessary actions like a Initialize UI resources and application data. + * + * @return If this function returns true, the application main loop starts. + * If this function returns false, the application terminates. + */ + virtual bool on_create(); + + /** + * @brief Calling before the main event loop finish. + * + * @note Release all resources here. + */ + virtual void on_terminate(); + + /** + * @brief Calling when application becomes invisible. + */ + virtual void on_pause(); + + /** + * @brief Calling when application becomes visible. + */ + virtual void on_resume(); + + /** + * @brief Calling when gets a launch request event. + * + * @param app_control_h The instance of app_control_h. + */ + virtual void on_control(app_control_h app_control); + + /** + * @brief Calling when device low battery. + * + * @param app_event_info_h The instance of app_event_info_h. + */ + virtual void on_low_battery(app_event_info_h event_info); + + /** + * @brief Calling when device low memory. + * + * @param app_event_info_h The instance of app_event_info_h. + */ + virtual void on_low_memory(app_event_info_h event_info); + + /** + * @brief Calling when device region changed. + * + * @param app_event_info_h The instance of app_event_info_h. + */ + virtual void on_region_changed(app_event_info_h event_info); + + /** + * @brief Calling when device orient changed. + * + * @param app_event_info_h The instance of app_event_info_h. + */ + virtual void on_orient_changed(app_event_info_h event_info); + + /** + * @brief Calling when language changed. + * + * @param app_event_info_h The instance of app_event_info_h. + */ + virtual void on_lang_changed(app_event_info_h event_info); + +private: + _UI_DECLARE_PRIVATE_IMPL(UiIfaceApp); + _UI_DISABLE_COPY_AND_ASSIGN(UiIfaceApp); + _UI_DECLARE_FRIENDS(UiIfaceView); +}; + +} + +#endif /* _UI_IFACE_APP_H_ */ diff --git a/src/include/interface/UiIfaceOverlay.h b/src/include/interface/UiIfaceOverlay.h new file mode 100644 index 0000000..36ce2f5 --- /dev/null +++ b/src/include/interface/UiIfaceOverlay.h @@ -0,0 +1,129 @@ +/* + * 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_IFACE_OVERLAY_H_ +#define _UI_IFACE_OVERLAY_H_ + +namespace ui_viewmanager +{ + +class UiIfaceView; + +/** + * @class UiIfaceOverlay + * + * @ingroup ui_viewmanager + * + * @brief This is a base class to support overlay view which could be active on other UiIfaceView. An overlay is designed to be one subordinate of one + * UiIfaceView. The specific behaviors of this class are totally depended on the derived class but it must be communicated with UiIfaceView to work + * successfully. Fundamentally, overlay view provides simpler interfaces than UiIfaceView since most of the overlay views will be active temporarily. + * This class is inherited to UiIfaceRotatable class to handle view's rotation state. + */ +class UiIfaceOverlay: public UiIfaceRotatable +{ +public: + /** + * @brief This is for replacing or setting a content of the view. + * + * @note @p content is a logical object that represents a view in your framework. The actual type of the content could be translated to any certain types. + * For instance, the type could be Evas_Object * in EFL and Layer * in Dali. + * + * @param content a new content. It allows @c NULL for canceling the previous content. + * + * @return @c true if it succeeds, @c false otherwise. + */ + virtual bool set_content(T content); + + /** + * @brief This is for unsetting a content of the view. + * + * @return A previous content. If it wasn't, return @c NULL. + */ + virtual T unset_content(); + + /** + * @brief The H/W back key event occurs on view. + * + * @note User can override this function to define application specific action when H/W back key + * event occurs. otherwise current view will be popped. + */ + virtual void on_back(); + + /** + * @brief Overlay activate. + * + * @note It makes overlay state as show. + * + * @return @c true if it succeeds, @c false otherwise. + * + * @see deactivate() + */ + virtual bool activate(); + + /** + * @brief Overlay deactivate. + * + * @note It makes overlay state as hide. + * + * @return @c true on success or @c false otherwise. + * + * @see activate() + */ + virtual bool deactivate(); + + /** + * @brief Return the active status of overlay. + * + * @return @c true if overlay is activated, @c false otherwise. + * + * @see activate() + * @see deactivate() + */ + virtual bool is_activated(); + + /** + * @brief Return a view which is matched with the overlay. + * + * @return The view which is matched with overlay. + */ + UiIfaceView *get_view(); + + /** + * @brief Return a content instance of this overlay. + * + * @return content of overlay. + */ + virtual T get_content(); + +protected: + /** + * @brief This is a constructor for initializing overlay. + * + * @param view The instance of UiIfaceView. + */ + UiIfaceOverlay(UiIfaceView *view); + + ///Destructor. + virtual ~UiIfaceOverlay(); + +private: + _UI_DECLARE_PRIVATE_IMPL(UiIfaceOverlay); + _UI_DISABLE_COPY_AND_ASSIGN(UiIfaceOverlay); +}; + +} + +#endif /* _UI_IFACE_OVERLAY_H_ */ diff --git a/src/include/interface/UiIfaceRotatable.h b/src/include/interface/UiIfaceRotatable.h new file mode 100644 index 0000000..abf1308 --- /dev/null +++ b/src/include/interface/UiIfaceRotatable.h @@ -0,0 +1,77 @@ +/* + * 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_IFACE_ROTATABLE_H_ +#define _UI_IFACE_ROTATABLE_H_ + +namespace ui_viewmanager +{ + +/** + * @class UiIfaceRotatable + * + * @ingroup ui_viewmanager + * + * @brief This is an interface class to support rotation behavior of views (or overlay). This class just defines status such as rotate, portrait, landscape + * so the derived class must implement the behavior body in its concept. + */ +class UiIfaceRotatable +{ +protected: + /** + * @brief View portrait state. + * + * @note This state will be called when view rotation changed to portrait. + * + * @see on_landscpae() + * @see on_rotate() + */ + virtual void on_portrait() {} + + /** + * @brief View landscape state. + * + * @note This state will be called when view rotation changed to landscape. + * + * @see on_portrait() + * @see on_rotate() + */ + virtual void on_landscape() {} + + /** + * @brief View rotate changed. + * + * @note This state will be called when view rotation changed. + * + * @param degree Current view's degree. + * + * @see on_portrait() + * @see on_landscpae() + */ + virtual void on_rotate(int degree) {} + +public: + /** + * @brief Get current view's degree. + * + * @return Current rotation degree, -1 if it fails to get degree information. + */ + virtual int get_degree() { return 0; } +}; + +} + +#endif /* _UI_IFACE_ROTATABLE_H_ */ diff --git a/src/include/interface/UiIfaceTypes.h b/src/include/interface/UiIfaceTypes.h new file mode 100644 index 0000000..65d29b7 --- /dev/null +++ b/src/include/interface/UiIfaceTypes.h @@ -0,0 +1,50 @@ +/* + * 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_IFACE_TYPES_H_ +#define _UI_IFACE_TYPES_H_ + +/** + * Possible values for indicator state. + */ +enum UiViewIndicator +{ + UI_VIEW_INDICATOR_UNKNOWN = 0, ///< Unknown state (Exceptional case) + UI_VIEW_INDICATOR_DEFAULT, ///< Opaque indicator + UI_VIEW_INDICATOR_OPTIMAL, ///< Transparent indicator + UI_VIEW_INDICATOR_OVERLAP, ///< Overlap indicator + UI_VIEW_INDICATOR_HIDE, ///< Indicator hide + UI_VIEW_INDICATOR_SHOW, ///< Indicator show + UI_VIEW_INDICATOR_LAST +}; +typedef enum UiViewIndicator ui_view_indicator; + +/** + * Possible values for view state. + */ +enum UiViewState +{ + UI_VIEW_STATE_UNKNOWN = 0, ///< Unknown state (Exceptional case) + UI_VIEW_STATE_LOAD, ///< Load state + UI_VIEW_STATE_UNLOAD, ///< Unload state + UI_VIEW_STATE_ACTIVATE, ///< Activate state + UI_VIEW_STATE_DEACTIVATE, ///< Deactivate state + UI_VIEW_STATE_PAUSE, ///< Pause state + UI_VIEW_STATE_LAST +}; +typedef enum UiViewState ui_view_state; + +#endif /* _UI_IFACE_TYPES_H_ */ diff --git a/src/include/interface/UiIfaceView.h b/src/include/interface/UiIfaceView.h new file mode 100644 index 0000000..cd34495 --- /dev/null +++ b/src/include/interface/UiIfaceView.h @@ -0,0 +1,299 @@ +/* + * 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_IFACE_VIEW_H_ +#define _UI_IFACE_VIEW_H_ + +namespace ui_viewmanager { + +class UiIfaceViewmgr; + +/** + * @class UiIfaceView + * + * @ingroup ui_viewmanager + * + * @brief This is a base class of view. A view must have one actual view content instance which represents a view for a current screen. + * The content type could be any types with regards to UI systems (ie, Eo*, Layer, Window...) A derived class must implement the view body based on the + * actual content in its UI system. This view will be belongs to a UiIfaceViewmgr instance and dominated its state by UiIfaceViewmgr. Basically, + * a view communicates with UiIfaceViewmgr to active cooperatively. This class is inherited to UiIfaceRotatable class to handle view's rotation + * state. Also, user can handle a view's life-cycle events with these -load, unload, activate, deactivate, pause, resume, destroy-. A view may have + * it's own show/hide transition styles. That means, it's available that views have different show/hide effects on demands. It's not mandatory but view + * should describe the transitions in this class. Please be full aware of view life-cycle to understand view's behavior. + * + * @warning When the transitions are finished, the view must to call UiIfaceViewmgr :: _push_finished(), UiIfaceViewmgr :: _pop_finished() in order that + * The UiIfaceViewmgr keeps the view states exactly. + */ +class UiIfaceView : public UiIfaceRotatable +{ +public: + /** + * @brief This is a constructor for initializing this view resources. + * + * @param name view name. + * + * @warning if you don't set a view name, you could not look up the view with its name. @see ui_viewmgr_view_get_by_name() + */ + UiIfaceView(const char *name = NULL); + + ///Destructor. + virtual ~UiIfaceView(); + + /** + * @brief Set transition style of a view. + * + * @note @p style is reserved for supporting various kinds of view transition effects. + * The actual behaviors with this transition style is up to your frameworks. Default value of the style is NULL. + * and "none" represents none transition. If you don't like give any transition effects to this view, you can pass "none" as @p style. + * + * @param style a transition style name. + * + * @return true if the given @c style is available, otherwise false. + * + * @warning When you override this member function, you should implement the logic to check the given style name is available or not. + * If your framework doesn't support any styles then just allow a @c NULL argument and return true. Otherwise return false. + */ + bool set_transition_style(const char *style); + + /** + * @brief Set content removable. + * + * @param removable if @p removable is @c true, content of this view will be removed on unload state. @c false otherwise. + * + * @warning You should not remove a view content manually on unload status if removable content is set. + */ + void set_removable_content(bool removable); + + /** + * @brief Set the indicator mode of the view. + * + * @param indicator The mode to set, one of #UiViewIndicator. + */ + void set_indicator(UiViewIndicator indicator); + + /** + * @brief Return a style name of this view. + * + * @return style name of view. + */ + const char *get_transition_style(); + + /** + * @brief Return a name of this view. + * + * @return name of view. + */ + const char *get_name(); + + /** + * @brief Return a content instance of this view. + * + * @return content of view. If no contents set yet, @c NULL. + */ + T get_content(); + + /** + * @brief Replace or set a content of the view. + * + * @note @p content is a logical object that represents a view in your framework. The actual type of the content could be translated to any certain types. + * For instance, the type could be Evas_Object * in EFL and Layer * in Dali. + * + * @param content a new content. It allows @c NULL for canceling the previous content. + * + * @return @c true if it succeeds, @c false otherwise. + */ + virtual bool set_content(T content); + + /** + * @brief Unset the view content. + * + * @return A previous content. If it wasn't, return @c NULL. + */ + virtual T unset_content(); + + /** + * @brief Return a state of this view. + * + * @return current state of view. + */ + UiViewState get_state(); + + /** + * @brief Return a state of removable content. + * + * @return true if the view's content is removable, otherwise false. + */ + bool get_removable_content(); + + /** + * @brief Return the indicator mode of this view. + * + * @return indicator state of view. + */ + UiViewIndicator get_indicator(); + + /** + * @brief The H/W back key event occurs on view. + * + * @note User can override this function to define application specific action when H/W back key + * event occurs. otherwise current view will be popped. + */ + virtual void on_back(); + +protected: + /** + * @brief Toggle event block. + * + * @note This interface is designed for toggling touch event on view transition. + * UiIfaceViewmgr will call this interface for notifying event blocking toggling on transition time. + * + * @param block @c true, when blocking is enabled, otherwise @c false. + * + * @see get_event_block() + */ + virtual void set_event_block(bool block); + + /** + * @brief Return the state of event block. + * + * @return true if the event block enabled, otherwise false. + * + * @see set_event_block() + */ + bool get_event_block(); + + /** + * @brief View load state. + * + * @note A view of this state is moving onto the screen. Get ready for this view. Generally, you could prepare this view's content here and set them to + * this view. In the most cases, this on_load() will be triggered with this step. load -> deactivated -> activated. Tihs on_load() will be triggered + * only when view has not any content yet. + */ + virtual void on_load(); + + /** + * @brief View unload state. + * + * @note Remove resources (contents) with regards to this view for saving memory. Otherwise, you could keep those resources (contents) for later access. + * Removing resources might be better in point of performance view. It's up to your scenario. on_unload() will be triggered just right before + * the view is going to be deleted by popping or by somehow. Also, on_unload() will be triggered when this view is pushed behind other views. + */ + virtual void on_unload(); + + /** + * @brief View activate state. + * + * @note Generally, a view will be activated when show-transition is finished. From whatever its state, when the view comes on the screen, + * on_activate() will be triggered. In the most cases, on_activate() will be triggered with this step. load -> deactivate -> activate + */ + virtual void on_activate(); + + /** + * @brief View deactivate state. + * + * @note Get ready for unload. Hide transition may be triggered at this point. If the system blocks application running in some cases such as phone call, + * system notification, application switching ..., Deactivate state will be triggered. Also, when a view is going to be popped or destroyed, + * on_deactivate() will be triggered. Lastly, when a new view is pushed, so if it becomes invisible state by other views, on_deactivate() will be + * triggered also. + */ + virtual void on_deactivate(); + + /** + * @brief View pause state. + * + * @note Some UI controls such as Popup or a Menu popup usually blocks views. For those scenarios, this blocked view would be paused and shouldn't be + * interactive with users. However, still it would be visible in some way (ie, half transparency). For this, this Pause will be triggered. + * If the view is already deactivated or under the unload state, the pause won't be called. + */ + virtual void on_pause(); + + /** + * @brief View resume state. + * + * @note When a view is returns to the activate state from pause state, this on_resume() will be triggered. For instance, a Popup is dismissed. + */ + virtual void on_resume(); + + /** + * @brief View destroy state. + * + * @note When this view is on destroyed by popping or by somehow, destroy will be triggered. Most of the cases, you can free your personal resources for + * the view because this view instance will be totally freed at the end of destroy. Be aware that you must not request any view functions on this + * state. + */ + virtual void on_destroy(); + + /** + * @brief Low Memory Event + * + * @note This event function is responsible for saving data in the main memory to a persistent memory or storage to avoid data loss in case the Tizen + * platform Low Memory Killer kills your application to get more free memory. This event function must also release any cached data in the main + * memory to secure more free memory. + */ + virtual void on_low_memory(); + + /** + * @brief Low Battery Event + * + * @note This event function is responsible for saving data in the main memory to a persistent memory or storage to avoid data loss in case the power goes + * off completely. This event function must also stop heavy CPU consumption or power consumption activities to save the remaining power. + */ + virtual void on_low_battery(); + + /** + * @brief Region Changed Event + * + * @note This event function is responsible for refreshing the display into the new time zone. + */ + virtual void on_region_changed(const char *region); + + /** + * @brief Language Changed Event + * + * @note This event function is responsible for refreshing the display into the new language. + */ + virtual void on_language_changed(const char *language); + +private: + /** + * @brief Connect with given viewmgr. + * + * @param viewmgr The instance of viewmgr. + * + * @return @c true if it succeeds, @c false otherwise. + * + * @see get_viewmgr() + */ + bool set_viewmgr(UiIfaceViewmgr *viewmgr); + + /** + * @brief Return the viewmgr instance. + * + * @return UiIfaceViewmgr instance. + * + * @see set_viewmgr() + */ + UiIfaceViewmgr *get_viewmgr(); + + _UI_DECLARE_PRIVATE_IMPL(UiIfaceView); + _UI_DISABLE_COPY_AND_ASSIGN(UiIfaceView); + _UI_DECLARE_FRIENDS(UiIfaceViewmgr); + _UI_DECLARE_FRIENDS(UiIfaceApp); +}; + +} + +#endif /* _UI_IFACE_VIEW_H_ */ diff --git a/src/include/interface/UiIfaceViewManager.h b/src/include/interface/UiIfaceViewManager.h new file mode 100644 index 0000000..1762e06 --- /dev/null +++ b/src/include/interface/UiIfaceViewManager.h @@ -0,0 +1,69 @@ +/* + * 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_IFACE_VIEWMANAGER_H_ +#define _UI_IFACE_VIEWMANAGER_H_ + +#include + +#define UI_EFL 1 + +#if UI_EFL + #include + typedef Evas_Object* T; +#elif UI_DALI +#endif + +#ifdef LOG_TAG +#undef LOG_TAG +#endif +#define LOG_TAG "UI_VIEWMGR" + +#define _UI_DECLARE_FRIENDS(A) \ + friend class A##Impl; \ + friend class A + +#define _UI_DECLARE_PRIVATE_IMPL(A) \ + class A##Impl *impl; \ + friend class A##Impl + +#define _UI_DISABLE_COPY_AND_ASSIGN(A) \ + A(const A&) = delete; \ + const A& operator=(const A&) = delete + +#ifdef __GNUC__ + #if __GNUC__ >= 4 + #ifndef EAPI + #define EAPI __attribute__ ((visibility("default"))) + #endif + #endif +#endif + + + + +#include +#include "UiIfaceTypes.h" +#include "UiIfaceRotatable.h" +#include "UiIfaceOverlay.h" +#include "UiIfaceView.h" +#include "UiIfaceViewmgr.h" +#include "UiIfaceApp.h" + +using namespace ui_viewmanager; + + +#endif /* UI_IFACE_VIEWMANAGER_H */ diff --git a/src/include/interface/UiIfaceViewmgr.h b/src/include/interface/UiIfaceViewmgr.h new file mode 100644 index 0000000..e4a5813 --- /dev/null +++ b/src/include/interface/UiIfaceViewmgr.h @@ -0,0 +1,256 @@ +/* + * 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_IFACE_VIEWMGR_H_ +#define _UI_IFACE_VIEWMGR_H_ + +namespace ui_viewmanager { + +class UiIfaceView; + +/** + * @class UiIfaceViewmgr + * + * @ingroup ui_viewmanager + * + * @brief This is a base class of viewmgr. One viewmgr represents a class which contains multiple views. + * A viewmgr manages not only views life-cycle but constructs basic infrastructures such as key events handling, transition effects, transient views, + * etc. This interface guides you a basic policy and behaviors of a view manager. Basically, View manager must have a default window internally. + * + * @warning viewmgr will remove all containing views when it's destroyed. + */ +class UiIfaceViewmgr +{ +public: + /** + * @brief Activate this view manager. + * + * @note viewmgr window and views will be shown once activate() is called. Usually this activate() should be called after applications set their all views + * on initialization time. + * + * @return @c true on success or @c false otherwise. + * + * @see deactivate() + */ + virtual bool activate(); + + /** + * @brief Deactivate this view manager. + * + * @note viewmgr window and views will be hidden once deactivate() is called. deactivate() behavior is up ui system, but usually it hides(unmap) + * current window in order that application go background. + * + * @return @c true success or @c false not. + * + * @see activate() + */ + virtual bool deactivate(); + + /** + * @brief Return the active status of viewmgr. + * + * @return @c true if viewmgr is activated, @c false otherwise. + * + * @see activate() + * @see deactivate() + */ + bool is_activated(); + + /** + * @brief Return the number of views which this viewmgr has. + * + * @return the count of views + */ + unsigned int get_view_count(); + + /** + * @brief Return a view index(page) number of the given view. + * You could use this function to query the given @p view list order. + * + * @param view A view to query the index. + * + * @return An index of the given @p view on success, otherwise, -1. + * + * @warning The index number of views are variable since the view list is variable. + */ + int get_view_index(const UiIfaceView *view); + + /** + * @brief Return whether soft key is required or not. + * + * @note Soft key is kind of like the software back button. It's used for product users to change current view to a previous view (pop). + * If a device doesn't have any hardware back buttons, Soft back key is necessary which means this function will return @c true. + * Some devices may needs software back key as well as hardware back key at the same time. That decision is up to product design. + * And soft_key initial value should read from the system configuration. + * + * @return @c true if soft key is required, @c false otherwise. + */ + static bool need_soft_key(); + + /** + * @brief Return viewmgr instance. + * + * @return viewmgr instance. + */ + static UiIfaceViewmgr* get_instance(); + +protected: + /** + * @brief This function is designed for finishing process of push transition. + * + * @param view A view which is finished pushing. + * + * @return @c true on success or @c false otherwise. + * + * @warning This function must be called when push transition is finished. + */ + bool push_view_finished(UiIfaceView *view); + + /** + * @brief This function is designed for finishing process for pop transition. + * + * @note If a new view is pushed. + * + * @param view A view which is finished popping. + * + * @return @c true on success or @c false otherwise. + * + * @warning This function must be called when push transition is finished. + */ + bool pop_view_finished(UiIfaceView *view); + + /** + * @brief Push a new view into this viewmgr. This function is used for when application switches a current view to a new one. + * + * @note Normally, the current view will be hidden by a new view. In default, when user calls this API, view will be switched to @p view instantly, + * only when viewmgr state is activated. Otherwise, the @p view will be shown later when viewmgr is activated. push_view() is designed for providing + * view transition effect. If you want push view instantly without any transition, you could use insert_view_before() or insert_view_after(). + * or use the view transition style function. + * If you want to pop the current view, the please use pop_view(). + * + * @param view A view to insert at the end of viewmgr view list. + * + * @return @p view, @c NULL when it fails to push a @p view. + * + * @see activated() + * @see insert_view_before() + * @see insert_view_after() + * @see pop_view() + * @see UiIfaceView::set_transition_style() + */ + virtual UiIfaceView *push_view(UiIfaceView *view); + + /** + * @brief Pop the top(last) view from this viewmgr view list. + * This function is used when application switches the current view back to the previous view. + * The top view will be removed from the view stack and then it will be deleted by the viewmgr. + * + * @note If the view is just one left, then viewmgr would be deactivated automatically since the ui application might be invalid anymore. Otherwise, + * the application will be terminated. It's up to system configuration. + * + * @return @c true on success or @c false otherwise. + * + * @see deactivate() + * @see push_view() + */ + virtual bool pop_view(); + + /** + * @brief Insert a view in this viewmgr view list. Specifically, insert a given @p view right before of the given view, @before. + * + * @param view A view to insert in the viewmgr view list. + * @param before A view that will be just inserted after @p view. If you pass @c NULL, @p view will be inserted at the front of the view list. + * + * @return @c true on success or @c false otherwise. + */ + bool insert_view_before(UiIfaceView *view, UiIfaceView *before); + + /** + * @brief Insert a view in this viewmgr view list. Specifically, insert a given @p view right after of the given view, @after. + * + * @param view A view to insert in the viewmgr view list. + * @param after A view that will be just inserted before the @p view. If you pass @c NULL, @p view will be inserted at the end of the view list. + * + * @return @c true on success or @c false otherwise. + */ + bool insert_view_after(UiIfaceView *view, UiIfaceView *after); + + /** + * @brief Remove the given view from this viewmgr view list. + * + * @param view A view to remove from the viewmgr view list. + * + * @return @c true on success or @c false otherwise. + * + * @see insert_view_before() + * @see insert_view_after() + * @see push_view() + */ + bool remove_view(UiIfaceView *view); + + /** + * @brief Return a view which is matched with the index @p idx. + * + * @param idx A index of the view which you are looking for. + * + * @return The view which index is matched with @p idx. + * If there were no views with index @p idx, @c NULL will be returned. + * + * @note You could use the index as the page numbers of the views. + * @warning the index number of views are variable since the view list is variable. + * + * @see get_view_index() + * @see get_view_count() + */ + UiIfaceView* get_view(unsigned int idx); + + /** + * @brief Return a view which is matched with the @p name. + * + * @note Every view have their names as their own identifiers. + * + * @param name The name of the view which you are looking for. + * + * @return The view which name is matched with @p name. + * If there were no views name matched, @c NULL will be returned. + * + * @see UiIfaceView::get_name(). + */ + UiIfaceView *get_view(const char *name); + + /** + * @brief Return a last(top) view. + * + * @return The view which is last view of the viewmgr view list. + */ + UiIfaceView *get_last_view(); + + ///Constructor. + UiIfaceViewmgr(); + + ///Destructor. + virtual ~UiIfaceViewmgr(); + +private: + _UI_DECLARE_PRIVATE_IMPL(UiIfaceViewmgr); + _UI_DISABLE_COPY_AND_ASSIGN(UiIfaceViewmgr); + _UI_DECLARE_FRIENDS(UiIfaceView); + _UI_DECLARE_FRIENDS(UiIfaceApp); +}; + +} + +#endif /* _UI_IFACE_VIEWMGR_H_ */ diff --git a/src/include/interface/ui_iface_app.h b/src/include/interface/ui_iface_app.h deleted file mode 100644 index b214fd9..0000000 --- a/src/include/interface/ui_iface_app.h +++ /dev/null @@ -1,153 +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_IFACE_APP_H_ -#define _UI_IFACE_APP_H_ - -namespace ui_viewmanager { - -class ui_iface_viewmgr; - -/** - * @class ui_iface_app - * - * @ingroup ui_viewmanager - * - * @brief ui_iface_app is designed for wrapping the application instance. This class hides unnecessary application settings but expose only basic functions - * such as initialization and run. Basically, it works on the application life-cycle. It has application life-cycle event interfaces such as create(), - * pause(), resume(), terminate(), etc so that users can handle those events for the their application concept. Also, It provides system event - * interfaces such as low_baterry(), low_meomory(), lang_changed(), region_changed() and so on. ui_iface_app create an unique ui_viewmgr instance - * internally, and manage its life. - */ -class ui_iface_app -{ -public: - /** - * @brief This is a constructor for initializing ui_iface_app. - * - * @param pkg The name of package. - * @param loale_dir The path of locale directory. - * @param viewmgr instance of ui_viewmgr. - */ - ui_iface_app(const char *pkg, const char *locale_dir, ui_iface_viewmgr *viewmgr); - - ///Destructor. - virtual ~ui_iface_app(); - - /** - * @brief Return the viewmgr instance. - * - * @return ui_iface_viewmgr instance. - */ - ui_iface_viewmgr *get_viewmgr(); - - /** - * @brief Return ui_iface_app instance. - * - * @return The instance of ui_iface_app. - */ - static ui_iface_app *get_instance(); - - /** - * @brief Application life-cycle start and add application event callback functions add. - * - * @note This is calling ui_app_main function to start application life-cycle start. - * and adding all of the functions for application events handling such as - * create, terminate, pause, resume, app_control, APP_EVENT_LOW_BATTERY, APP_EVENT_LOW_MEMORY - * APP_EVENT_DEVICE_ORIENTATION_CHANGED, APP_EVENT_LANGUAGE_CHANGED, APP_EVENT_REGION_FORMAT_CHANGED. - * Application can add those events using wrapping functions by viewmgr supported. - */ - virtual int run(int argc, char **argv); - -protected: - /** - * @brief Calling before the main event loop start. - * - * @note Take necessary actions like a Initialize UI resources and application data. - * - * @return If this function returns true, the application main loop starts. - * If this function returns false, the application terminates. - */ - virtual bool on_create(); - - /** - * @brief Calling before the main event loop finish. - * - * @note Release all resources here. - */ - virtual void on_terminate(); - - /** - * @brief Calling when application becomes invisible. - */ - virtual void on_pause(); - - /** - * @brief Calling when application becomes visible. - */ - virtual void on_resume(); - - /** - * @brief Calling when gets a launch request event. - * - * @param app_control_h The instance of app_control_h. - */ - virtual void on_control(app_control_h app_control); - - /** - * @brief Calling when device low battery. - * - * @param app_event_info_h The instance of app_event_info_h. - */ - virtual void on_low_battery(app_event_info_h event_info); - - /** - * @brief Calling when device low memory. - * - * @param app_event_info_h The instance of app_event_info_h. - */ - virtual void on_low_memory(app_event_info_h event_info); - - /** - * @brief Calling when device region changed. - * - * @param app_event_info_h The instance of app_event_info_h. - */ - virtual void on_region_changed(app_event_info_h event_info); - - /** - * @brief Calling when device orient changed. - * - * @param app_event_info_h The instance of app_event_info_h. - */ - virtual void on_orient_changed(app_event_info_h event_info); - - /** - * @brief Calling when language changed. - * - * @param app_event_info_h The instance of app_event_info_h. - */ - virtual void on_lang_changed(app_event_info_h event_info); - -private: - _UI_DECLARE_PRIVATE_IMPL(ui_iface_app); - _UI_DISABLE_COPY_AND_ASSIGN(ui_iface_app); - _UI_DECLARE_FRIENDS(ui_iface_view); -}; - -} - -#endif /* _UI_IFACE_APP_H_ */ diff --git a/src/include/interface/ui_iface_overlay.h b/src/include/interface/ui_iface_overlay.h deleted file mode 100644 index c14a20b..0000000 --- a/src/include/interface/ui_iface_overlay.h +++ /dev/null @@ -1,129 +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_IFACE_OVERLAY_H_ -#define _UI_IFACE_OVERLAY_H_ - -namespace ui_viewmanager -{ - -class ui_iface_view; - -/** - * @class ui_iface_overlay - * - * @ingroup ui_viewmanager - * - * @brief This is a base class to support overlay view which could be active on other ui_iface_view. An overlay is designed to be one subordinate of one - * ui_iface_view. The specific behaviors of this class are totally depended on the derived class but it must be communicated with ui_iface_view to work - * successfully. Fundamentally, overlay view provides simpler interfaces than ui_iface_view since most of the overlay views will be active temporarily. - * This class is inherited to ui_iface_rotatable class to handle view's rotation state. - */ -class ui_iface_overlay: public ui_iface_rotatable -{ -public: - /** - * @brief This is for replacing or setting a content of the view. - * - * @note @p content is a logical object that represents a view in your framework. The actual type of the content could be translated to any certain types. - * For instance, the type could be Evas_Object * in EFL and Layer * in Dali. - * - * @param content a new content. It allows @c NULL for canceling the previous content. - * - * @return @c true if it succeeds, @c false otherwise. - */ - virtual bool set_content(T content); - - /** - * @brief This is for unsetting a content of the view. - * - * @return A previous content. If it wasn't, return @c NULL. - */ - virtual T unset_content(); - - /** - * @brief The H/W back key event occurs on view. - * - * @note User can override this function to define application specific action when H/W back key - * event occurs. otherwise current view will be popped. - */ - virtual void on_back(); - - /** - * @brief Overlay activate. - * - * @note It makes overlay state as show. - * - * @return @c true if it succeeds, @c false otherwise. - * - * @see deactivate() - */ - virtual bool activate(); - - /** - * @brief Overlay deactivate. - * - * @note It makes overlay state as hide. - * - * @return @c true on success or @c false otherwise. - * - * @see activate() - */ - virtual bool deactivate(); - - /** - * @brief Return the active status of overlay. - * - * @return @c true if overlay is activated, @c false otherwise. - * - * @see activate() - * @see deactivate() - */ - virtual bool is_activated(); - - /** - * @brief Return a view which is matched with the overlay. - * - * @return The view which is matched with overlay. - */ - ui_iface_view *get_view(); - - /** - * @brief Return a content instance of this overlay. - * - * @return content of overlay. - */ - virtual T get_content(); - -protected: - /** - * @brief This is a constructor for initializing overlay. - * - * @param view The instance of ui_iface_view. - */ - ui_iface_overlay(ui_iface_view *view); - - ///Destructor. - virtual ~ui_iface_overlay(); - -private: - _UI_DECLARE_PRIVATE_IMPL(ui_iface_overlay); - _UI_DISABLE_COPY_AND_ASSIGN(ui_iface_overlay); -}; - -} - -#endif /* _UI_IFACE_OVERLAY_H_ */ diff --git a/src/include/interface/ui_iface_rotatable.h b/src/include/interface/ui_iface_rotatable.h deleted file mode 100644 index b3d0193..0000000 --- a/src/include/interface/ui_iface_rotatable.h +++ /dev/null @@ -1,77 +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_IFACE_ROTATABLE_H_ -#define _UI_IFACE_ROTATABLE_H_ - -namespace ui_viewmanager -{ - -/** - * @class ui_iface_rotatable - * - * @ingroup ui_viewmanager - * - * @brief This is an interface class to support rotation behavior of views (or overlay). This class just defines status such as rotate, portrait, landscape - * so the derived class must implement the behavior body in its concept. - */ -class ui_iface_rotatable -{ -protected: - /** - * @brief View portrait state. - * - * @note This state will be called when view rotation changed to portrait. - * - * @see on_landscpae() - * @see on_rotate() - */ - virtual void on_portrait() {} - - /** - * @brief View landscape state. - * - * @note This state will be called when view rotation changed to landscape. - * - * @see on_portrait() - * @see on_rotate() - */ - virtual void on_landscape() {} - - /** - * @brief View rotate changed. - * - * @note This state will be called when view rotation changed. - * - * @param degree Current view's degree. - * - * @see on_portrait() - * @see on_landscpae() - */ - virtual void on_rotate(int degree) {} - -public: - /** - * @brief Get current view's degree. - * - * @return Current rotation degree, -1 if it fails to get degree information. - */ - virtual int get_degree() { return 0; } -}; - -} - -#endif /* _UI_IFACE_ROTATABLE_H_ */ diff --git a/src/include/interface/ui_iface_types.h b/src/include/interface/ui_iface_types.h deleted file mode 100644 index db900c7..0000000 --- a/src/include/interface/ui_iface_types.h +++ /dev/null @@ -1,50 +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_IFACE_TYPES_H_ -#define _UI_IFACE_TYPES_H_ - -/** - * Possible values for indicator state. - */ -enum ui_view_indicator -{ - UI_VIEW_INDICATOR_UNKNOWN = 0, ///< Unknown state (Exceptional case) - UI_VIEW_INDICATOR_DEFAULT, ///< Opaque indicator - UI_VIEW_INDICATOR_OPTIMAL, ///< Transparent indicator - UI_VIEW_INDICATOR_OVERLAP, ///< Overlap indicator - UI_VIEW_INDICATOR_HIDE, ///< Indicator hide - UI_VIEW_INDICATOR_SHOW, ///< Indicator show - UI_VIEW_INDICATOR_LAST -}; -typedef enum ui_view_indicator ui_view_indicator; - -/** - * Possible values for view state. - */ -enum ui_view_state -{ - UI_VIEW_STATE_UNKNOWN = 0, ///< Unknown state (Exceptional case) - UI_VIEW_STATE_LOAD, ///< Load state - UI_VIEW_STATE_UNLOAD, ///< Unload state - UI_VIEW_STATE_ACTIVATE, ///< Activate state - UI_VIEW_STATE_DEACTIVATE, ///< Deactivate state - UI_VIEW_STATE_PAUSE, ///< Pause state - UI_VIEW_STATE_LAST -}; -typedef enum ui_view_state ui_view_state; - -#endif /* _UI_IFACE_TYPES_H_ */ diff --git a/src/include/interface/ui_iface_view.h b/src/include/interface/ui_iface_view.h deleted file mode 100644 index 1324431..0000000 --- a/src/include/interface/ui_iface_view.h +++ /dev/null @@ -1,299 +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_IFACE_VIEW_H_ -#define _UI_IFACE_VIEW_H_ - -namespace ui_viewmanager { - -class ui_iface_viewmgr; - -/** - * @class ui_iface_view - * - * @ingroup ui_viewmanager - * - * @brief This is a base class of view. A view must have one actual view content instance which represents a view for a current screen. - * The content type could be any types with regards to UI systems (ie, Eo*, Layer, Window...) A derived class must implement the view body based on the - * actual content in its UI system. This view will be belongs to a ui_iface_viewmgr instance and dominated its state by ui_iface_viewmgr. Basically, - * a view communicates with ui_iface_viewmgr to active cooperatively. This class is inherited to ui_iface_rotatable class to handle view's rotation - * state. Also, user can handle a view's life-cycle events with these -load, unload, activate, deactivate, pause, resume, destroy-. A view may have - * it's own show/hide transition styles. That means, it's available that views have different show/hide effects on demands. It's not mandatory but view - * should describe the transitions in this class. Please be full aware of view life-cycle to understand view's behavior. - * - * @warning When the transitions are finished, the view must to call ui_iface_viewmgr :: _push_finished(), ui_iface_viewmgr :: _pop_finished() in order that - * The ui_iface_viewmgr keeps the view states exactly. - */ -class ui_iface_view : public ui_iface_rotatable -{ -public: - /** - * @brief This is a constructor for initializing this view resources. - * - * @param name view name. - * - * @warning if you don't set a view name, you could not look up the view with its name. @see ui_viewmgr_view_get_by_name() - */ - ui_iface_view(const char *name = NULL); - - ///Destructor. - virtual ~ui_iface_view(); - - /** - * @brief Set transition style of a view. - * - * @note @p style is reserved for supporting various kinds of view transition effects. - * The actual behaviors with this transition style is up to your frameworks. Default value of the style is NULL. - * and "none" represents none transition. If you don't like give any transition effects to this view, you can pass "none" as @p style. - * - * @param style a transition style name. - * - * @return true if the given @c style is available, otherwise false. - * - * @warning When you override this member function, you should implement the logic to check the given style name is available or not. - * If your framework doesn't support any styles then just allow a @c NULL argument and return true. Otherwise return false. - */ - bool set_transition_style(const char *style); - - /** - * @brief Set content removable. - * - * @param removable if @p removable is @c true, content of this view will be removed on unload state. @c false otherwise. - * - * @warning You should not remove a view content manually on unload status if removable content is set. - */ - void set_removable_content(bool removable); - - /** - * @brief Set the indicator mode of the view. - * - * @param indicator The mode to set, one of #ui_view_indicator. - */ - void set_indicator(ui_view_indicator indicator); - - /** - * @brief Return a style name of this view. - * - * @return style name of view. - */ - const char *get_transition_style(); - - /** - * @brief Return a name of this view. - * - * @return name of view. - */ - const char *get_name(); - - /** - * @brief Return a content instance of this view. - * - * @return content of view. If no contents set yet, @c NULL. - */ - T get_content(); - - /** - * @brief Replace or set a content of the view. - * - * @note @p content is a logical object that represents a view in your framework. The actual type of the content could be translated to any certain types. - * For instance, the type could be Evas_Object * in EFL and Layer * in Dali. - * - * @param content a new content. It allows @c NULL for canceling the previous content. - * - * @return @c true if it succeeds, @c false otherwise. - */ - virtual bool set_content(T content); - - /** - * @brief Unset the view content. - * - * @return A previous content. If it wasn't, return @c NULL. - */ - virtual T unset_content(); - - /** - * @brief Return a state of this view. - * - * @return current state of view. - */ - ui_view_state get_state(); - - /** - * @brief Return a state of removable content. - * - * @return true if the view's content is removable, otherwise false. - */ - bool get_removable_content(); - - /** - * @brief Return the indicator mode of this view. - * - * @return indicator state of view. - */ - ui_view_indicator get_indicator(); - - /** - * @brief The H/W back key event occurs on view. - * - * @note User can override this function to define application specific action when H/W back key - * event occurs. otherwise current view will be popped. - */ - virtual void on_back(); - -protected: - /** - * @brief Toggle event block. - * - * @note This interface is designed for toggling touch event on view transition. - * ui_iface_viewmgr will call this interface for notifying event blocking toggling on transition time. - * - * @param block @c true, when blocking is enabled, otherwise @c false. - * - * @see get_event_block() - */ - virtual void set_event_block(bool block); - - /** - * @brief Return the state of event block. - * - * @return true if the event block enabled, otherwise false. - * - * @see set_event_block() - */ - bool get_event_block(); - - /** - * @brief View load state. - * - * @note A view of this state is moving onto the screen. Get ready for this view. Generally, you could prepare this view's content here and set them to - * this view. In the most cases, this on_load() will be triggered with this step. load -> deactivated -> activated. Tihs on_load() will be triggered - * only when view has not any content yet. - */ - virtual void on_load(); - - /** - * @brief View unload state. - * - * @note Remove resources (contents) with regards to this view for saving memory. Otherwise, you could keep those resources (contents) for later access. - * Removing resources might be better in point of performance view. It's up to your scenario. on_unload() will be triggered just right before - * the view is going to be deleted by popping or by somehow. Also, on_unload() will be triggered when this view is pushed behind other views. - */ - virtual void on_unload(); - - /** - * @brief View activate state. - * - * @note Generally, a view will be activated when show-transition is finished. From whatever its state, when the view comes on the screen, - * on_activate() will be triggered. In the most cases, on_activate() will be triggered with this step. load -> deactivate -> activate - */ - virtual void on_activate(); - - /** - * @brief View deactivate state. - * - * @note Get ready for unload. Hide transition may be triggered at this point. If the system blocks application running in some cases such as phone call, - * system notification, application switching ..., Deactivate state will be triggered. Also, when a view is going to be popped or destroyed, - * on_deactivate() will be triggered. Lastly, when a new view is pushed, so if it becomes invisible state by other views, on_deactivate() will be - * triggered also. - */ - virtual void on_deactivate(); - - /** - * @brief View pause state. - * - * @note Some UI controls such as Popup or a Menu popup usually blocks views. For those scenarios, this blocked view would be paused and shouldn't be - * interactive with users. However, still it would be visible in some way (ie, half transparency). For this, this Pause will be triggered. - * If the view is already deactivated or under the unload state, the pause won't be called. - */ - virtual void on_pause(); - - /** - * @brief View resume state. - * - * @note When a view is returns to the activate state from pause state, this on_resume() will be triggered. For instance, a Popup is dismissed. - */ - virtual void on_resume(); - - /** - * @brief View destroy state. - * - * @note When this view is on destroyed by popping or by somehow, destroy will be triggered. Most of the cases, you can free your personal resources for - * the view because this view instance will be totally freed at the end of destroy. Be aware that you must not request any view functions on this - * state. - */ - virtual void on_destroy(); - - /** - * @brief Low Memory Event - * - * @note This event function is responsible for saving data in the main memory to a persistent memory or storage to avoid data loss in case the Tizen - * platform Low Memory Killer kills your application to get more free memory. This event function must also release any cached data in the main - * memory to secure more free memory. - */ - virtual void on_low_memory(); - - /** - * @brief Low Battery Event - * - * @note This event function is responsible for saving data in the main memory to a persistent memory or storage to avoid data loss in case the power goes - * off completely. This event function must also stop heavy CPU consumption or power consumption activities to save the remaining power. - */ - virtual void on_low_battery(); - - /** - * @brief Region Changed Event - * - * @note This event function is responsible for refreshing the display into the new time zone. - */ - virtual void on_region_changed(const char *region); - - /** - * @brief Language Changed Event - * - * @note This event function is responsible for refreshing the display into the new language. - */ - virtual void on_language_changed(const char *language); - -private: - /** - * @brief Connect with given viewmgr. - * - * @param viewmgr The instance of viewmgr. - * - * @return @c true if it succeeds, @c false otherwise. - * - * @see get_viewmgr() - */ - bool set_viewmgr(ui_iface_viewmgr *viewmgr); - - /** - * @brief Return the viewmgr instance. - * - * @return ui_iface_viewmgr instance. - * - * @see set_viewmgr() - */ - ui_iface_viewmgr *get_viewmgr(); - - _UI_DECLARE_PRIVATE_IMPL(ui_iface_view); - _UI_DISABLE_COPY_AND_ASSIGN(ui_iface_view); - _UI_DECLARE_FRIENDS(ui_iface_viewmgr); - _UI_DECLARE_FRIENDS(ui_iface_app); -}; - -} - -#endif /* _UI_IFACE_VIEW_H_ */ diff --git a/src/include/interface/ui_iface_viewmanager.h b/src/include/interface/ui_iface_viewmanager.h deleted file mode 100644 index 07236ff..0000000 --- a/src/include/interface/ui_iface_viewmanager.h +++ /dev/null @@ -1,69 +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_IFACE_VIEWMANAGER_H_ -#define _UI_IFACE_VIEWMANAGER_H_ - -#include - -#define UI_EFL 1 - -#if UI_EFL - #include - typedef Evas_Object* T; -#elif UI_DALI -#endif - -#ifdef LOG_TAG -#undef LOG_TAG -#endif -#define LOG_TAG "UI_VIEWMGR" - -#define _UI_DECLARE_FRIENDS(A) \ - friend class A##_impl; \ - friend class A - -#define _UI_DECLARE_PRIVATE_IMPL(A) \ - class A##_impl *impl; \ - friend class A##_impl - -#define _UI_DISABLE_COPY_AND_ASSIGN(A) \ - A(const A&) = delete; \ - const A& operator=(const A&) = delete - -#ifdef __GNUC__ - #if __GNUC__ >= 4 - #ifndef EAPI - #define EAPI __attribute__ ((visibility("default"))) - #endif - #endif -#endif - - - - -#include -#include "ui_iface_types.h" -#include "ui_iface_rotatable.h" -#include "ui_iface_overlay.h" -#include "ui_iface_view.h" -#include "ui_iface_viewmgr.h" -#include "ui_iface_app.h" - -using namespace ui_viewmanager; - - -#endif /* UI_IFACE_VIEWMANAGER_H */ diff --git a/src/include/interface/ui_iface_viewmgr.h b/src/include/interface/ui_iface_viewmgr.h deleted file mode 100644 index 0efa710..0000000 --- a/src/include/interface/ui_iface_viewmgr.h +++ /dev/null @@ -1,256 +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_IFACE_VIEWMGR_H_ -#define _UI_IFACE_VIEWMGR_H_ - -namespace ui_viewmanager { - -class ui_iface_view; - -/** - * @class ui_iface_viewmgr - * - * @ingroup ui_viewmanager - * - * @brief This is a base class of viewmgr. One viewmgr represents a class which contains multiple views. - * A viewmgr manages not only views life-cycle but constructs basic infrastructures such as key events handling, transition effects, transient views, - * etc. This interface guides you a basic policy and behaviors of a view manager. Basically, View manager must have a default window internally. - * - * @warning viewmgr will remove all containing views when it's destroyed. - */ -class ui_iface_viewmgr -{ -public: - /** - * @brief Activate this view manager. - * - * @note viewmgr window and views will be shown once activate() is called. Usually this activate() should be called after applications set their all views - * on initialization time. - * - * @return @c true on success or @c false otherwise. - * - * @see deactivate() - */ - virtual bool activate(); - - /** - * @brief Deactivate this view manager. - * - * @note viewmgr window and views will be hidden once deactivate() is called. deactivate() behavior is up ui system, but usually it hides(unmap) - * current window in order that application go background. - * - * @return @c true success or @c false not. - * - * @see activate() - */ - virtual bool deactivate(); - - /** - * @brief Return the active status of viewmgr. - * - * @return @c true if viewmgr is activated, @c false otherwise. - * - * @see activate() - * @see deactivate() - */ - bool is_activated(); - - /** - * @brief Return the number of views which this viewmgr has. - * - * @return the count of views - */ - unsigned int get_view_count(); - - /** - * @brief Return a view index(page) number of the given view. - * You could use this function to query the given @p view list order. - * - * @param view A view to query the index. - * - * @return An index of the given @p view on success, otherwise, -1. - * - * @warning The index number of views are variable since the view list is variable. - */ - int get_view_index(const ui_iface_view *view); - - /** - * @brief Return whether soft key is required or not. - * - * @note Soft key is kind of like the software back button. It's used for product users to change current view to a previous view (pop). - * If a device doesn't have any hardware back buttons, Soft back key is necessary which means this function will return @c true. - * Some devices may needs software back key as well as hardware back key at the same time. That decision is up to product design. - * And soft_key initial value should read from the system configuration. - * - * @return @c true if soft key is required, @c false otherwise. - */ - static bool need_soft_key(); - - /** - * @brief Return viewmgr instance. - * - * @return viewmgr instance. - */ - static ui_iface_viewmgr* get_instance(); - -protected: - /** - * @brief This function is designed for finishing process of push transition. - * - * @param view A view which is finished pushing. - * - * @return @c true on success or @c false otherwise. - * - * @warning This function must be called when push transition is finished. - */ - bool push_view_finished(ui_iface_view *view); - - /** - * @brief This function is designed for finishing process for pop transition. - * - * @note If a new view is pushed. - * - * @param view A view which is finished popping. - * - * @return @c true on success or @c false otherwise. - * - * @warning This function must be called when push transition is finished. - */ - bool pop_view_finished(ui_iface_view *view); - - /** - * @brief Push a new view into this viewmgr. This function is used for when application switches a current view to a new one. - * - * @note Normally, the current view will be hidden by a new view. In default, when user calls this API, view will be switched to @p view instantly, - * only when viewmgr state is activated. Otherwise, the @p view will be shown later when viewmgr is activated. push_view() is designed for providing - * view transition effect. If you want push view instantly without any transition, you could use insert_view_before() or insert_view_after(). - * or use the view transition style function. - * If you want to pop the current view, the please use pop_view(). - * - * @param view A view to insert at the end of viewmgr view list. - * - * @return @p view, @c NULL when it fails to push a @p view. - * - * @see activated() - * @see insert_view_before() - * @see insert_view_after() - * @see pop_view() - * @see ui_iface_view::set_transition_style() - */ - virtual ui_iface_view *push_view(ui_iface_view *view); - - /** - * @brief Pop the top(last) view from this viewmgr view list. - * This function is used when application switches the current view back to the previous view. - * The top view will be removed from the view stack and then it will be deleted by the viewmgr. - * - * @note If the view is just one left, then viewmgr would be deactivated automatically since the ui application might be invalid anymore. Otherwise, - * the application will be terminated. It's up to system configuration. - * - * @return @c true on success or @c false otherwise. - * - * @see deactivate() - * @see push_view() - */ - virtual bool pop_view(); - - /** - * @brief Insert a view in this viewmgr view list. Specifically, insert a given @p view right before of the given view, @before. - * - * @param view A view to insert in the viewmgr view list. - * @param before A view that will be just inserted after @p view. If you pass @c NULL, @p view will be inserted at the front of the view list. - * - * @return @c true on success or @c false otherwise. - */ - bool insert_view_before(ui_iface_view *view, ui_iface_view *before); - - /** - * @brief Insert a view in this viewmgr view list. Specifically, insert a given @p view right after of the given view, @after. - * - * @param view A view to insert in the viewmgr view list. - * @param after A view that will be just inserted before the @p view. If you pass @c NULL, @p view will be inserted at the end of the view list. - * - * @return @c true on success or @c false otherwise. - */ - bool insert_view_after(ui_iface_view *view, ui_iface_view *after); - - /** - * @brief Remove the given view from this viewmgr view list. - * - * @param view A view to remove from the viewmgr view list. - * - * @return @c true on success or @c false otherwise. - * - * @see insert_view_before() - * @see insert_view_after() - * @see push_view() - */ - bool remove_view(ui_iface_view *view); - - /** - * @brief Return a view which is matched with the index @p idx. - * - * @param idx A index of the view which you are looking for. - * - * @return The view which index is matched with @p idx. - * If there were no views with index @p idx, @c NULL will be returned. - * - * @note You could use the index as the page numbers of the views. - * @warning the index number of views are variable since the view list is variable. - * - * @see get_view_index() - * @see get_view_count() - */ - ui_iface_view* get_view(unsigned int idx); - - /** - * @brief Return a view which is matched with the @p name. - * - * @note Every view have their names as their own identifiers. - * - * @param name The name of the view which you are looking for. - * - * @return The view which name is matched with @p name. - * If there were no views name matched, @c NULL will be returned. - * - * @see ui_iface_view::get_name(). - */ - ui_iface_view *get_view(const char *name); - - /** - * @brief Return a last(top) view. - * - * @return The view which is last view of the viewmgr view list. - */ - ui_iface_view *get_last_view(); - - ///Constructor. - ui_iface_viewmgr(); - - ///Destructor. - virtual ~ui_iface_viewmgr(); - -private: - _UI_DECLARE_PRIVATE_IMPL(ui_iface_viewmgr); - _UI_DISABLE_COPY_AND_ASSIGN(ui_iface_viewmgr); - _UI_DECLARE_FRIENDS(ui_iface_view); - _UI_DECLARE_FRIENDS(ui_iface_app); -}; - -} - -#endif /* _UI_IFACE_VIEWMGR_H_ */ diff --git a/src/include/ui_viewmanager.h b/src/include/ui_viewmanager.h index 06b6d8a..bc75150 100644 --- a/src/include/ui_viewmanager.h +++ b/src/include/ui_viewmanager.h @@ -15,13 +15,4 @@ * */ -#ifndef _UI_VIEWMANAGER_H_ -#define _UI_VIEWMANAGER_H_ - -#ifdef TARGET_LANG_CPLUS - #include "efl/mobile/ui_mobile_viewmanager.h" -#else - #include "efl/mobile/c/ui_mobile_viewmanager.h" -#endif - -#endif /* _UI_VIEWMANAGER_H_ */ +#include "efl/mobile/c/ui_mobile_viewmanager.h" diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 31ca9ae..21d0506 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -1,38 +1,38 @@ IF("${TARGET_LANGUAGE}" STREQUAL "c++") SET(SRCS - interface/ui_iface_overlay.cpp - interface/ui_iface_view.cpp - interface/ui_iface_viewmgr.cpp - interface/ui_iface_app.cpp - efl/ui_base_view.cpp - efl/ui_base_viewmgr.cpp - efl/ui_base_key_listener.cpp - efl/ui_base_overlay.cpp - efl/mobile/ui_app.cpp - efl/mobile/ui_menu.cpp - efl/mobile/ui_popup.cpp - efl/mobile/ui_view.cpp - efl/mobile/ui_standard_view.cpp - efl/mobile/ui_key_listener.cpp - efl/mobile/ui_viewmgr.cpp + interface/UiIfaceOverlay.cpp + interface/UiIfaceView.cpp + interface/UiIfaceViewmgr.cpp + interface/UiIfaceApp.cpp + efl/UiBaseView.cpp + efl/UiBaseViewmgr.cpp + efl/UiBaseKeyListener.cpp + efl/UiBaseOverlay.cpp + efl/mobile/UiApp.cpp + efl/mobile/UiMenu.cpp + efl/mobile/UiPopup.cpp + efl/mobile/UiView.cpp + efl/mobile/UiStandardView.cpp + efl/mobile/UiKeyListener.cpp + efl/mobile/UiViewmgr.cpp ) ELSE() SET(SRCS - interface/ui_iface_overlay.cpp - interface/ui_iface_view.cpp - interface/ui_iface_viewmgr.cpp - interface/ui_iface_app.cpp - efl/ui_base_view.cpp - efl/ui_base_viewmgr.cpp - efl/ui_base_key_listener.cpp - efl/ui_base_overlay.cpp - efl/mobile/ui_app.cpp - efl/mobile/ui_menu.cpp - efl/mobile/ui_popup.cpp - efl/mobile/ui_view.cpp - efl/mobile/ui_standard_view.cpp - efl/mobile/ui_key_listener.cpp - efl/mobile/ui_viewmgr.cpp + interface/UiIfaceOverlay.cpp + interface/UiIfaceView.cpp + interface/UiIfaceViewmgr.cpp + interface/UiIfaceApp.cpp + efl/UiBaseView.cpp + efl/UiBaseViewmgr.cpp + efl/UiBaseKeyListener.cpp + efl/UiBaseOverlay.cpp + efl/mobile/UiApp.cpp + efl/mobile/UiMenu.cpp + efl/mobile/UiPopup.cpp + efl/mobile/UiView.cpp + efl/mobile/UiStandardView.cpp + efl/mobile/UiKeyListener.cpp + efl/mobile/UiViewmgr.cpp efl/mobile/c/ui_application.cpp efl/mobile/c/ui_menu.cpp efl/mobile/c/ui_popup.cpp diff --git a/src/lib/efl/UiBaseKeyListener.cpp b/src/lib/efl/UiBaseKeyListener.cpp new file mode 100644 index 0000000..b88e1b9 --- /dev/null +++ b/src/lib/efl/UiBaseKeyListener.cpp @@ -0,0 +1,161 @@ +/* + * 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/UiBaseViewManager.h" + +/***********************************************************************************************/ +/* Internal class Implementation */ +/***********************************************************************************************/ +namespace efl_viewmanager +{ +class UiBaseKeyListenerImpl +{ +protected: + UiBaseKeyListener *key_listener; + UiBaseViewmgr *viewmgr; + Evas_Object *key_grabber; + +public: + UiBaseKeyListenerImpl(UiBaseKeyListener *key_listener, UiBaseViewmgr *viewmgr); + ~UiBaseKeyListenerImpl() {} + + bool init(); + bool term(); + void event_proc(Evas_Event_Key_Down *ev); + UiBaseViewmgr *get_viewmgr() { return this->viewmgr; } + Evas_Object *get_keygrab_obj() { return this->key_grabber; } +}; +} + +static const char *KEY_BACK = "XF86Back"; +static const char *KEY_BACK2 = "XF86Stop"; + +static void key_grab_rect_key_up_cb(UiBaseKeyListenerImpl *key_listener, Evas_Event_Key_Down *ev) +{ + key_listener->event_proc(ev); +} + +UiBaseKeyListenerImpl::UiBaseKeyListenerImpl(UiBaseKeyListener *key_listener, UiBaseViewmgr *viewmgr) + : key_listener(key_listener), viewmgr(viewmgr), key_grabber(NULL) +{ +} + +void UiBaseKeyListenerImpl::event_proc(Evas_Event_Key_Down *ev) +{ + //Only if view manager is activated + UiBaseViewmgr *viewmgr = this->key_listener->get_viewmgr(); + if (!viewmgr->is_activated()) return; + + //Get Top View + UiBaseView *view = viewmgr->get_last_view(); + if (!view) return; + + this->key_listener->extend_event_proc(view, ev); + + if (strcmp(ev->keyname, KEY_BACK) && strcmp(ev->keyname, KEY_BACK2)) return; + + view->on_back(); +} + +bool UiBaseKeyListenerImpl::term() +{ + evas_object_del(this->key_grabber); + return true; +} + +bool UiBaseKeyListenerImpl::init() +{ + if (!this->viewmgr) + { + LOGE("No view manager??"); + return false; + } + + Evas *e = evas_object_evas_get(this->viewmgr->get_window()); + if (!e) + { + LOGE("Failed to get Evas from window"); + return false; + } + + Evas_Object *key_grab_rect = evas_object_rectangle_add(e); + if (!key_grab_rect) + { + LOGE("Failed to create a key grabber rectangle"); + return false; + } + + evas_object_event_callback_add(key_grab_rect, EVAS_CALLBACK_KEY_UP, [](void *data, Evas *e, Evas_Object *obj, void *event_info) -> void + { + Evas_Event_Key_Down *ev = static_cast(event_info); + UiBaseKeyListenerImpl *key_listener = static_cast(data); + key_grab_rect_key_up_cb(key_listener, ev); + }, this); + + if (!evas_object_key_grab(key_grab_rect, KEY_BACK, 0, 0, EINA_FALSE)) + { + LOGE("Failed to grab BACK KEY(%s)\n", KEY_BACK); + evas_object_del(key_grab_rect); + return false; + } + + if (!evas_object_key_grab(key_grab_rect, KEY_BACK2, 0, 0, EINA_FALSE)) + { + LOGE("Failed to grab BACK KEY(%s)\n", KEY_BACK2); + evas_object_del(key_grab_rect); + return false; + } + + this->key_grabber = key_grab_rect; + + return true; +} + + +/***********************************************************************************************/ +/* External class Implementation */ +/***********************************************************************************************/ + +UiBaseKeyListener::UiBaseKeyListener(UiBaseViewmgr *viewmgr) +{ + this->impl = new UiBaseKeyListenerImpl(this, viewmgr); +} + +UiBaseKeyListener::~UiBaseKeyListener() +{ + delete(this->impl); +} + +bool UiBaseKeyListener::term() +{ + return this->impl->term(); +} + +bool UiBaseKeyListener::init() +{ + return this->impl->init(); +} + +Evas_Object *UiBaseKeyListener::get_keygrab_obj() +{ + return this->impl->get_keygrab_obj(); +} + + +UiBaseViewmgr *UiBaseKeyListener::get_viewmgr() +{ + return this->impl->get_viewmgr(); +} diff --git a/src/lib/efl/UiBaseOverlay.cpp b/src/lib/efl/UiBaseOverlay.cpp new file mode 100644 index 0000000..1465af6 --- /dev/null +++ b/src/lib/efl/UiBaseOverlay.cpp @@ -0,0 +1,26 @@ +/* + * 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/UiBaseViewManager.h" + +UiBaseOverlay::UiBaseOverlay(UiBaseView *view) + : UiIfaceOverlay(view) +{ +} + +UiBaseOverlay::~UiBaseOverlay() +{ +} diff --git a/src/lib/efl/UiBaseView.cpp b/src/lib/efl/UiBaseView.cpp new file mode 100644 index 0000000..6c87a0e --- /dev/null +++ b/src/lib/efl/UiBaseView.cpp @@ -0,0 +1,142 @@ +/* + * 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/UiBaseViewManager.h" + + +/***********************************************************************************************/ +/* Internal class Implementation */ +/***********************************************************************************************/ +namespace efl_viewmanager +{ +class UiBaseViewImpl; +} + +/***********************************************************************************************/ +/* External class Implementation */ +/***********************************************************************************************/ + +static void content_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + UiBaseView *view = static_cast(data); + view->unset_content(); +} + +UiBaseView::UiBaseView(const char *name) + : UiIfaceView(name) +{ +} + +UiBaseView::~UiBaseView() +{ +} + +bool UiBaseView::set_content(Evas_Object *content) +{ + Evas_Object *pcontent = this->unset_content(); + if (pcontent) + { + evas_object_del(pcontent); + } + if (content) + { + evas_object_event_callback_add(content, EVAS_CALLBACK_DEL, content_del_cb, this); + UiIfaceView::set_content(content); + } + return true; +} + +Evas_Object *UiBaseView::unset_content() +{ + Evas_Object *obj = UiIfaceView::unset_content(); + if (obj) + { + evas_object_event_callback_del(obj, EVAS_CALLBACK_DEL, content_del_cb); + evas_object_hide(obj); + } + return obj; +} + +Evas_Object *UiBaseView::get_base() +{ + UiBaseViewmgr *viewmgr = UI_BASE_VIEWMGR; + if (!viewmgr) + { + return NULL; + } + return viewmgr->get_base(); +} + +Evas_Object *UiBaseView ::get_parent() +{ + UiBaseViewmgr *viewmgr = UI_BASE_VIEWMGR; + if (!viewmgr) + { + LOGE("Failed to get a viewmgr"); + return NULL; + } + return viewmgr->get_base(); +} + +void UiBaseView::set_indicator(UiViewIndicator indicator) +{ + if (this->get_indicator() == indicator) return; + + UiIfaceView::set_indicator(indicator); + + UiBaseViewmgr *viewmgr = UI_BASE_VIEWMGR; + if (!viewmgr) + { + LOGE("Failed to get a viewmgr"); + return; + } + + if (!viewmgr->is_activated()) return; + + if (viewmgr->get_last_view() != this) return; + + viewmgr->set_indicator(indicator); +} + +void UiBaseView::on_rotate(int degree) +{ +} + +void UiBaseView::on_portrait() +{ +} + +void UiBaseView::on_landscape() +{ +} + +void UiBaseView::set_event_block(bool block) +{ + UiIfaceView::set_event_block(block); + evas_object_freeze_events_set(this->get_content(), block); +} + +int UiBaseView::get_degree() +{ + UiBaseViewmgr *viewmgr = UI_BASE_VIEWMGR; + if (!viewmgr) + { + LOGE("Failed to get a viewmgr"); + return -1; + } + return elm_win_rotation_get(viewmgr->get_window()); +} + diff --git a/src/lib/efl/UiBaseViewmgr.cpp b/src/lib/efl/UiBaseViewmgr.cpp new file mode 100644 index 0000000..7bb8f2e --- /dev/null +++ b/src/lib/efl/UiBaseViewmgr.cpp @@ -0,0 +1,544 @@ +/* + * 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 +#include "../../include/efl/UiBaseViewManager.h" + +using namespace std; + +/***********************************************************************************************/ +/* Internal class Implementation */ +/***********************************************************************************************/ +namespace efl_viewmanager +{ + +class UiBaseViewmgrImpl +{ + friend class UiBaseViewmgr; + +private: + UiBaseViewmgr *viewmgr; + Elm_Win *win; //This is acting like a base object of viewmgr. + Elm_Conformant *conform; //Conformant for viewmgr. + Elm_Scroller *scroller; //Scroller for viewmgr. + Elm_Layout *layout; //Viewmgr's base layout. + UiBaseKeyListener *key_listener; //HW Key Handler such as "BACK" key... + UiViewIndicator indicator; //Mode of indicator. + string transition_style; //Current transition effect style name + map effect_map; //Map for effect layouts. + + Elm_Layout *set_transition_layout(string transition_style); + + bool create_conformant(Elm_Win *win); + bool create_scroller(Elm_Conformant *conform); + bool create_base_layout(Elm_Scroller *scroller, const char *style); + bool set_indicator(UiViewIndicator indicator); + void activate_top_view(); + bool init(); + bool term(); + +public: + UiBaseViewmgrImpl(UiBaseViewmgr *viewmgr, const char *pkg, UiBaseKeyListener *key_listener); + ~UiBaseViewmgrImpl(); + + bool activate(); + bool deactivate(); + UiBaseView *push_view(UiBaseView *view); + bool pop_view(); + bool insert_view_before(UiBaseView *view, UiBaseView *before); + bool insert_view_after(UiBaseView *view, UiBaseView *after); + + Evas_Object *get_base() + { + return this->layout; + } + Elm_Win *get_window() + { + return this->win; + } + Elm_Conformant *get_conformant() + { + return this->conform; + } +}; + +} + +bool UiBaseViewmgrImpl::create_base_layout(Elm_Scroller *scroller, const char *style) +{ + char edj_path[PATH_MAX]; + char group_name[128]; + + Elm_Layout *layout = elm_layout_add(scroller); + if (!layout) return false; + + snprintf(group_name, sizeof(group_name), "transition/%s", style); + snprintf(edj_path, sizeof(edj_path), "%s/ui-viewmgr.edj", EDJ_PATH); + elm_layout_file_set(layout, edj_path, group_name); + evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_content_set(scroller, layout); + + //Push Finished Event + elm_layout_signal_callback_add(layout, "push,finished", "viewmgr", + [](void *data, Evas_Object *obj, const char *emission, const char *source) -> void + { + UiBaseViewmgr *viewmgr = static_cast(data); + UiBaseView *pview = viewmgr->get_view(viewmgr->get_view_count() - 2); + UiBaseView *view = viewmgr->get_last_view(); + if (pview) viewmgr->push_view_finished(pview); + if (view) viewmgr->push_view_finished(view); + }, + this->viewmgr); + + //Pop Finished Event + elm_layout_signal_callback_add(layout, "pop,finished", "viewmgr", + [](void *data, Evas_Object *obj, const char *emission, const char *source) -> void + { + UiBaseViewmgr *viewmgr = static_cast(data); + UiBaseView *pview = viewmgr->get_view(viewmgr->get_view_count() - 2); + UiBaseView *view = viewmgr->get_last_view(); + if (pview) viewmgr->pop_view_finished(pview); + if (view) viewmgr->pop_view_finished(view); + }, + this->viewmgr); + + this->layout = layout; + + return true; +} + +Elm_Layout *UiBaseViewmgrImpl::set_transition_layout(string transition_style) +{ + Elm_Layout *effect_layout = NULL; + Elm_Layout *pcontent; + + pcontent = elm_object_part_content_unset(this->get_base(), "pcontent"); + if (pcontent) evas_object_hide(pcontent); + elm_object_part_content_unset(this->get_base(), "content"); + + if (transition_style.compare(this->transition_style) == 0) return this->layout; + + if (effect_map.size()) effect_layout = effect_map.find(transition_style)->second; + + //Scroller content change to current effect layout and change to hide prev layout. + Elm_Layout *playout = elm_object_part_content_unset(this->scroller, NULL); + evas_object_hide(playout); + + if (!effect_layout) + { + //Create and add effect_layouts in map here. + //FIXME: If we have to support many effects, this logic should be changed. + effect_map.insert(pair("default", this->layout)); + this->create_base_layout(this->scroller, transition_style.c_str()); + effect_map.insert(pair(transition_style, this->layout)); + } else { + elm_object_content_set(this->scroller, effect_layout); + + this->layout = effect_layout; + } + + this->transition_style = transition_style; + + return this->layout; +} + +void UiBaseViewmgrImpl::activate_top_view() +{ + Evas_Object *pcontent = elm_object_part_content_unset(this->get_base(), "content"); + if (pcontent) evas_object_hide(pcontent); + + UiBaseView *view = this->viewmgr->get_last_view(); + + //In case of UiBaseView, it doesn't have any base form. It uses viewmgr base instead. + Evas_Object *content; + if (view->get_base() == this->get_base()) + { + content = view->get_content(); + } else { + content = view->get_base(); + } + + elm_object_part_content_set(this->get_base(), "content", content); + + this->set_indicator(view->get_indicator()); +} + +//FIXME: How to deal with indicator in other UI framework? Dali? Volt? +//Is it possible make this interface common? +bool UiBaseViewmgrImpl::set_indicator(UiViewIndicator indicator) +{ + if (this->indicator == indicator) return false; + this->indicator = indicator; + + Elm_Win *window = this->get_window(); + Elm_Conformant *conform = this->get_conformant(); + + switch (indicator) + { + case UI_VIEW_INDICATOR_DEFAULT: + elm_win_indicator_opacity_set(window, ELM_WIN_INDICATOR_OPAQUE); + elm_win_indicator_mode_set(window, ELM_WIN_INDICATOR_SHOW); + /* Unset if you set the Indicator BG */ + evas_object_del(elm_object_part_content_get(conform, "elm.swallow.indicator_bg")); + elm_object_signal_emit(conform, "elm,state,indicator,nooverlap", "elm"); + break; + case UI_VIEW_INDICATOR_OPTIMAL: + elm_win_indicator_mode_set(window, ELM_WIN_INDICATOR_SHOW); + elm_win_indicator_opacity_set(window, ELM_WIN_INDICATOR_TRANSPARENT); + break; + case UI_VIEW_INDICATOR_OVERLAP: + elm_win_indicator_mode_set(window, ELM_WIN_INDICATOR_SHOW); + elm_object_signal_emit(conform, "elm,state,indicator,overlap", "elm"); + break; + default: + elm_win_indicator_mode_set(window, ELM_WIN_INDICATOR_HIDE); + break; + } + return true; +} + +bool UiBaseViewmgrImpl::create_conformant(Elm_Win *win) +{ + Elm_Conformant *conform = elm_conformant_add(win); + if (!conform) return false; + + evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, conform); + elm_win_conformant_set(win, EINA_TRUE); + evas_object_show(conform); + + this->conform = conform; + + return true; +} + +bool UiBaseViewmgrImpl::create_scroller(Elm_Conformant *conform) +{ + Elm_Scroller *scroller = elm_scroller_add(conform); + if (!scroller) return false; + + elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_AUTO); + evas_object_size_hint_weight_set(scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(scroller, EVAS_HINT_FILL, EVAS_HINT_FILL); + + elm_object_content_set(conform, scroller); + + this->scroller = scroller; + + return true; +} + +UiBaseViewmgrImpl::UiBaseViewmgrImpl(UiBaseViewmgr *viewmgr, const char *pkg, UiBaseKeyListener *key_listener) + : viewmgr(viewmgr), key_listener(key_listener), transition_style("default") +{ + if (!pkg) + { + LOGE("Invalid package name"); + return; + } + + //Window + this->win = elm_win_util_standard_add(pkg, pkg); + + if (!this->win) + { + LOGE("Failed to create a window (%s)", pkg); + return; + } + + //FIXME: Make a method? to set available rotation degree. + //Set window rotation + if (elm_win_wm_rotation_supported_get(this->win)) + { + int rots[4] = + { 0, 90, 180, 270 }; + elm_win_wm_rotation_available_rotations_set(this->win, (const int *) (&rots), 4); + } + evas_object_smart_callback_add(this->win, "wm,rotation,changed", + [](void *data, Evas_Object *obj, void *event_info) -> void + { + int rot = elm_win_rotation_get(obj); + + UiBaseViewmgr *viewmgr = static_cast(data); + UiBaseView *view = viewmgr->get_last_view(); + view->on_rotate(rot); + + //FIXME: Change this configurable? + if (rot == 0 || rot == 180) view->on_portrait(); + else view->on_landscape(); + } + , this->viewmgr); + //Window is requested to delete. + evas_object_smart_callback_add(this->win, "delete,request", + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UiBaseViewmgr *viewmgr = static_cast(data); + delete(viewmgr); + }, + this->viewmgr); + + //FIXME: Make conformant configurable? + if (!this->create_conformant(this->win)) + { + LOGE("Failed to create a conformant (%s)", pkg); + return; + } + + if (!this->create_scroller(this->conform)) + { + LOGE("Failed to create a scroller (%s)", pkg); + return; + } + + if (!this->create_base_layout(this->scroller, "default")) + { + LOGE("Failed to create a base layout (%s)", pkg); + return; + } + + //Set Indicator properties + elm_win_indicator_mode_set(this->win, ELM_WIN_INDICATOR_SHOW); + elm_win_indicator_opacity_set(this->win, ELM_WIN_INDICATOR_OPAQUE); + + elm_win_autodel_set(this->win, EINA_TRUE); +} + +UiBaseViewmgrImpl::~UiBaseViewmgrImpl() +{ + delete(this->key_listener); +} + +bool UiBaseViewmgrImpl::init() +{ + return this->key_listener->init(); +} + +bool UiBaseViewmgrImpl::term() +{ + return this->key_listener->term(); +} + +bool UiBaseViewmgrImpl::activate() +{ + this->activate_top_view(); + evas_object_show(this->win); + + return true; +} + +bool UiBaseViewmgrImpl::deactivate() +{ + //FIXME: based on the profile, we should app to go behind or terminate. + if (true) + { + evas_object_lower(this->win); + } else { + delete(this->viewmgr); + } + + return true; +} + +bool UiBaseViewmgrImpl::pop_view() +{ + UiBaseView *pview = this->viewmgr->get_view(this->viewmgr->get_view_count() - 2); + UiBaseView *view = this->viewmgr->get_last_view(); + + //In case, if view doesn't have any transition effects. + if (!strcmp(view->get_transition_style(), "none")) + { + this->viewmgr->pop_view_finished(pview); + this->viewmgr->pop_view_finished(view); + this->activate_top_view(); + return true; + } + + //Choose an effect layout. + Elm_Layout *effect = this->set_transition_layout(view->get_transition_style()); + if (!effect) { + LOGE("invalid effect transition style?! = %s", view->get_transition_style()); + this->viewmgr->pop_view_finished(pview); + this->viewmgr->pop_view_finished(view); + this->activate_top_view(); + return true; + } + + //Trigger Effects. + Evas_Object *prv = this->get_base() == pview->get_base() ? pview->get_content() : pview->get_base(); + elm_layout_content_set(effect, "content", prv); + + Evas_Object *cur = this->get_base() == view->get_base() ? view->get_content() : view->get_base(); + elm_layout_content_set(effect, "pcontent", cur); + + elm_layout_signal_emit(effect, "view,pop", "viewmgr"); + + this->set_indicator(pview->get_indicator()); + + return true; +} + +UiBaseView * UiBaseViewmgrImpl::push_view(UiBaseView *view) +{ + if (!this->viewmgr->is_activated()) return view; + + //In case, if viewmgr has one view, we skip effect. + if (this->viewmgr->get_view_count() == 1) { + this->activate_top_view(); + this->viewmgr->push_view_finished(view); + return view; + } + + UiBaseView *pview = this->viewmgr->get_view(this->viewmgr->get_view_count() - 2); + + //In case, if view doesn't have transition effect + if (!strcmp(view->get_transition_style(), "none")) { + this->activate_top_view(); + this->viewmgr->push_view_finished(pview); + this->viewmgr->push_view_finished(view); + return view; + } + + //Choose an effect layout. + Elm_Layout *effect = this->set_transition_layout(view->get_transition_style()); + if (!effect) { + LOGE("invalid effect transition style?! = %s", view->get_transition_style()); + this->activate_top_view(); + this->viewmgr->push_view_finished(pview); + this->viewmgr->push_view_finished(view); + return view; + } + + //Trigger Effects. + Evas_Object *prv = this->get_base() == pview->get_base() ? pview->get_content() : pview->get_base(); + elm_layout_content_set(effect, "pcontent", prv); + + Evas_Object *cur = this->get_base() == view->get_base() ? view->get_content() : view->get_base(); + elm_layout_content_set(effect, "content", cur); + + elm_layout_signal_emit(effect, "view,push", "viewmgr"); + + this->set_indicator(view->get_indicator()); + + return view; +} + +/***********************************************************************************************/ +/* External class Implementation */ +/***********************************************************************************************/ + +UiBaseViewmgr::UiBaseViewmgr(const char *pkg, UiBaseKeyListener *key_listener) + : UiIfaceViewmgr() +{ + this->impl = new UiBaseViewmgrImpl(this, pkg, key_listener); + this->impl->init(); +} + +UiBaseViewmgr::UiBaseViewmgr(const char *pkg) + : UiBaseViewmgr(pkg, new UiBaseKeyListener(this)) +{ +} + +UiBaseViewmgr::~UiBaseViewmgr() +{ + this->impl->term(); + delete(this->impl); + ui_app_exit(); +} + +bool UiBaseViewmgr::activate() +{ + if (!UiIfaceViewmgr::activate()) return false; + this->impl->activate(); + + return true; +} + +bool UiBaseViewmgr::deactivate() +{ + if (!UiIfaceViewmgr::deactivate()) return false; + this->impl->deactivate(); + + return true; +} + +bool UiBaseViewmgr::pop_view() +{ + if (this->get_view_count() == 1) + { + this->deactivate(); + return true; + } + + if(!UiIfaceViewmgr::pop_view()) + { + return false; + } + + return this->impl->pop_view(); +} + +UiBaseView * UiBaseViewmgr::push_view(UiBaseView *view) +{ + UiIfaceViewmgr::push_view(view); + + return this->impl->push_view(view); +} + +bool UiBaseViewmgr::insert_view_before(UiBaseView *view, UiBaseView *before) +{ + return UiIfaceViewmgr::insert_view_before(view, before); +} + +bool UiBaseViewmgr::insert_view_after(UiBaseView *view, UiBaseView *after) +{ + return UiIfaceViewmgr::insert_view_after(view, after); +} + +UiBaseView *UiBaseViewmgr::get_view(unsigned int idx) +{ + return dynamic_cast(UiIfaceViewmgr::get_view(idx)); +} + +UiBaseView *UiBaseViewmgr::get_view(const char *name) +{ + return dynamic_cast(UiIfaceViewmgr::get_view(name)); +} + +UiBaseView *UiBaseViewmgr::get_last_view() +{ + return dynamic_cast(UiIfaceViewmgr::get_last_view()); +} + +Evas_Object *UiBaseViewmgr::get_base() +{ + return this->impl->get_base(); +} +Elm_Win *UiBaseViewmgr::get_window() +{ + return this->impl->get_window(); +} +Elm_Conformant *UiBaseViewmgr::get_conformant() +{ + return this->impl->get_conformant(); +} + +bool UiBaseViewmgr::set_indicator(UiViewIndicator indicator) +{ + return this->impl->set_indicator(indicator); +} diff --git a/src/lib/efl/mobile/UiApp.cpp b/src/lib/efl/mobile/UiApp.cpp new file mode 100644 index 0000000..ae632bb --- /dev/null +++ b/src/lib/efl/mobile/UiApp.cpp @@ -0,0 +1,44 @@ +/* + * 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/UiMobileViewManager.h" + +/***********************************************************************************************/ +/* Internal class Implementation */ +/***********************************************************************************************/ + +/***********************************************************************************************/ +/* External class Implementation */ +/***********************************************************************************************/ + +UiApp::UiApp(const char *pkg, const char *locale_dir) + : UiIfaceApp(pkg, locale_dir, new UiViewmgr(pkg)) +{ +} + +UiApp::~UiApp() +{ +} + +UiViewmgr *UiApp::get_viewmgr() +{ + return dynamic_cast(UiIfaceApp::get_viewmgr()); +} + +UiApp *UiApp::get_instance() +{ + return dynamic_cast(UiIfaceApp::get_instance()); +} diff --git a/src/lib/efl/mobile/UiKeyListener.cpp b/src/lib/efl/mobile/UiKeyListener.cpp new file mode 100644 index 0000000..1d55c29 --- /dev/null +++ b/src/lib/efl/mobile/UiKeyListener.cpp @@ -0,0 +1,52 @@ +/* + * 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/UiMobileViewManager.h" + +static const char *KEY_MENU = "XF86Menu"; +static const char *KEY_MENU2 = "XF86Send"; + +UiKeyListener::UiKeyListener(UiViewmgr *viewmgr) + : UiBaseKeyListener(viewmgr) +{ +} + +void UiKeyListener::extend_event_proc(UiBaseView *view, Evas_Event_Key_Down *ev) +{ + if (strcmp(ev->keyname, KEY_MENU) && strcmp(ev->keyname, KEY_MENU2)) return; + UiView *v = dynamic_cast(view); + UiMenu *menu = v->on_menu_pre(); + if (!menu) return; + v->on_menu(menu); + v->on_menu_post(); +} + +bool UiKeyListener::init() +{ + if (!UiBaseKeyListener::init()) return false; + if (!evas_object_key_grab(this->get_keygrab_obj(), KEY_MENU, 0, 0, EINA_FALSE)) + { + LOGE("Failed to grab MENU KEY(%s)\n", KEY_MENU); + return false; + } + + if (!evas_object_key_grab(this->get_keygrab_obj(), KEY_MENU2, 0, 0, EINA_FALSE)) + { + LOGE("Failed to grab MENU KEY(%s)\n", KEY_MENU2); + return false; + } + return true; +} diff --git a/src/lib/efl/mobile/UiMenu.cpp b/src/lib/efl/mobile/UiMenu.cpp new file mode 100644 index 0000000..9f0d427 --- /dev/null +++ b/src/lib/efl/mobile/UiMenu.cpp @@ -0,0 +1,165 @@ +/* + * 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/UiMobileViewManager.h" + +static void ctxpopup_dismissed_cb(void *data, Evas_Object *obj, void *event_info) +{ + evas_object_hide(obj); +} + +static void ctxpopup_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + UiMenu *menu = static_cast(data); + menu->unset_content(); +} + +static bool update_menu(UiMenu *menu) +{ + Elm_Win *win = menu->get_base(); + if (!win) return false; + + Elm_Ctxpopup *ctxpopup = menu->get_content(); + if (!ctxpopup) return false; + + /* We convince the top widget is a window */ + Evas_Coord w, h; + elm_win_screen_size_get(win, NULL, NULL, &w, &h); + int rot = elm_win_rotation_get(win); + + switch (rot) + { + case 0: + case 180: + evas_object_move(ctxpopup, (w / 2), h); + break; + case 90: + case 270: + evas_object_move(ctxpopup, (h / 2), w); + break; + } + + evas_object_show(ctxpopup); + + return true; +} + +static void win_resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + UiMenu *menu = static_cast(data); + if (!menu->is_activated()) return; + update_menu(menu); +} + +UiMenu::UiMenu(UiView *view) + : UiBaseOverlay(view) +{ + Elm_Win *win = this->get_window(); + evas_object_event_callback_add(win, EVAS_CALLBACK_RESIZE, win_resize_cb, this); +} + +UiMenu::~UiMenu() +{ + Elm_Win *win = this->get_window(); + if (win) evas_object_event_callback_del(win, EVAS_CALLBACK_RESIZE, win_resize_cb); + Elm_Ctxpopup *ctxpopup = this->unset_content(); + evas_object_del(ctxpopup); +} + +Elm_Win *UiMenu::get_window() +{ + UiViewmgr *viewmgr = UI_VIEWMGR; + if (!viewmgr) + { + LOGE("Viewmgr is null?? menu(%p)", this); + return NULL; + } + + return viewmgr->get_window(); +} + +bool UiMenu::deactivate() +{ + Elm_Ctxpopup *ctxpopup = this->get_content(); + if (!ctxpopup) + { + LOGE("Content is not set! = UiMenu(%p)", this); + return false; + } + + elm_ctxpopup_dismiss(ctxpopup); + dynamic_cast(this->get_view())->on_resume(); + + return true; +} + +bool UiMenu::activate() +{ + bool ret = update_menu(this); + if (ret) dynamic_cast(this->get_view())->on_pause(); + return ret; +} + +bool UiMenu::set_content(Elm_Ctxpopup *ctxpopup) +{ + Elm_Ctxpopup *prev = this->unset_content(); + evas_object_del(prev); + + if (!ctxpopup) return true; + + if (strcmp(evas_object_type_get(ctxpopup), "elm_ctxpopup")) + { + LOGE("Menu widget is not a ctxpopup!"); + return false; + } + + elm_object_style_set(ctxpopup, "more/default"); + elm_ctxpopup_auto_hide_disabled_set(ctxpopup, EINA_TRUE); + evas_object_smart_callback_add(ctxpopup, "dismissed", ctxpopup_dismissed_cb, NULL); + evas_object_event_callback_add(ctxpopup, EVAS_CALLBACK_DEL, ctxpopup_del_cb, this); + + UiBaseOverlay::set_content(ctxpopup); + + return true; +} + +bool UiMenu::is_activated() +{ + Elm_Ctxpopup *ctxpopup = this->get_content(); + if (!ctxpopup) return false; + return evas_object_visible_get(ctxpopup); +} + +Elm_Ctxpopup *UiMenu::unset_content() +{ + Elm_Ctxpopup *ctxpopup = UiBaseOverlay::unset_content(); + if (!ctxpopup) return NULL; + + evas_object_smart_callback_del(ctxpopup, "dismissed", ctxpopup_dismissed_cb); + evas_object_event_callback_del(ctxpopup, EVAS_CALLBACK_DEL, ctxpopup_del_cb); + + return ctxpopup; +} + +Evas_Object *UiMenu::get_base() +{ + return this->get_window(); +} + +int UiMenu::get_degree() +{ + return this->get_view()->get_degree(); +} diff --git a/src/lib/efl/mobile/UiPopup.cpp b/src/lib/efl/mobile/UiPopup.cpp new file mode 100644 index 0000000..8ac03a5 --- /dev/null +++ b/src/lib/efl/mobile/UiPopup.cpp @@ -0,0 +1,137 @@ +/* + * 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/UiMobileViewManager.h" + +static bool update_popup(UiPopup *popup) +{ + Elm_Win *win = popup->get_base(); + if (!win) return false; + + Elm_Popup *_popup = popup->get_content(); + if (!_popup) return false; + + evas_object_show(_popup); + + return true; +} + +static void popup_dismissed_cb(void *data, Evas_Object *obj, void *event_info) +{ + evas_object_hide(obj); +} + +static void popup_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + UiPopup *popup = static_cast(data); + popup->unset_content(); +} + +UiPopup::UiPopup(UiView *view) + : UiBaseOverlay(view) +{ + view->connect_popup(this); +} + +UiPopup::~UiPopup() +{ + dynamic_cast(this->get_view())->disconnect_popup(this); + Elm_Popup *popup = this->unset_content(); + evas_object_del(popup); +} + +Elm_Win *UiPopup::get_window() +{ + UiViewmgr *viewmgr = UI_VIEWMGR; + if (!viewmgr) + { + LOGE("Viewmgr is null?? menu(%p)", this); + return NULL; + } + return viewmgr->get_window(); +} + +bool UiPopup::deactivate() +{ + Elm_Popup *popup = this->get_content(); + if (!popup) + { + LOGE("Content is not set! = UiPopup(%p)", this); + return false; + } + + elm_popup_dismiss(popup); + dynamic_cast(this->get_view())->on_resume(); + + return true; +} + +bool UiPopup::activate() +{ + bool ret = update_popup(this); + if (ret) dynamic_cast(this->get_view())->on_pause(); + return ret; +} + +bool UiPopup::set_content(Elm_Popup *popup) +{ + Elm_Popup *prev = this->unset_content(); + evas_object_del(prev); + + if (!popup) return true; + + if (strcmp(evas_object_type_get(popup), "elm_popup")) + { + LOGE("Menu widget is not a popup!"); + return false; + } + + elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0); + evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, popup_del_cb, this); + evas_object_smart_callback_add(popup, "dismissed", popup_dismissed_cb, this); + + UiBaseOverlay::set_content(popup); + + return true; +} + +bool UiPopup::is_activated() +{ + Elm_Popup *popup = this->get_content(); + if (!popup) return false; + return evas_object_visible_get(popup); +} + +Elm_Popup *UiPopup::unset_content() +{ + Elm_Popup *popup = UiBaseOverlay::unset_content(); + if (!popup) return NULL; + + evas_object_event_callback_del(popup, EVAS_CALLBACK_DEL, popup_del_cb); + evas_object_smart_callback_del(popup, "dismissed", popup_dismissed_cb); + + return popup; +} + +Evas_Object *UiPopup::get_base() +{ + return this->get_window(); +} + +int UiPopup::get_degree() +{ + return this->get_view()->get_degree(); +} diff --git a/src/lib/efl/mobile/UiStandardView.cpp b/src/lib/efl/mobile/UiStandardView.cpp new file mode 100644 index 0000000..d1c81d5 --- /dev/null +++ b/src/lib/efl/mobile/UiStandardView.cpp @@ -0,0 +1,543 @@ +/* + * 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/UiMobileViewManager.h" + +/***********************************************************************************************/ +/* Internal class Implementation */ +/***********************************************************************************************/ + +namespace efl_viewmanager +{ + +class UiStandardViewImpl +{ + friend class UiStandardView; + +private: + UiStandardView *view; + Elm_Layout *layout; //Base layout for view + Elm_Toolbar *toolbar; //Toolbar + Elm_Button *title_left_btn; //Title left button + Elm_Button *title_right_btn; //Title right button + + bool create_layout(); + bool destroy_layout(); + +public: + UiStandardViewImpl(UiStandardView *view); + ~UiStandardViewImpl(); + + bool set_content(Evas_Object *content, const char *title = NULL); + bool set_content(Evas_Object *content, const char *title, const char *subtitle, Elm_Button *title_left_btn, Elm_Button *title_right_btn); + bool set_title_badge(const char *text); + bool set_subtitle(const char *text); + bool set_title_left_btn(Elm_Button *title_left_btn); + bool set_title_right_btn(Elm_Button *title_right_btn); + bool set_title(const char *text); + bool set_toolbar(Elm_Toolbar *toolbar); + bool set_title_visible(bool visible, bool anim); + void unset_content(); + Elm_Button *unset_title_left_btn(); + Elm_Button *unset_title_right_btn(); + Elm_Toolbar *unset_toolbar(); + Evas_Object *get_base(); + + Elm_Button *get_title_left_btn() + { + return this->title_left_btn; + } + + Elm_Button *get_title_right_btn() + { + return this->title_right_btn; + } + + Elm_Toolbar *get_toolbar() + { + return this->toolbar; + } +}; + +} + +#define DEFAULT_GROUP "tizen_view/default" + +#define LAYOUT_VALIDATE() if (!layout) \ + { \ + LOGE("Layout is invalid! UiStandardView(%p)", this); \ + return false; \ + } + +static void title_left_btn_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + UiStandardView *view = static_cast(data); + view->unset_title_left_btn(); +} + +static void title_right_btn_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + UiStandardView *view = static_cast(data); + view->unset_title_right_btn(); +} + +static void toolbar_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + UiStandardView *view = static_cast(data); + view->unset_toolbar(); +} + +bool UiStandardViewImpl::destroy_layout() +{ + if (!this->layout) return false; + evas_object_del(this->layout); + this->layout = NULL; + + return true; +} + +bool UiStandardViewImpl::create_layout() +{ + if (this->layout) return false; + + Elm_Layout *layout = elm_layout_add(this->view->get_parent()); + LAYOUT_VALIDATE(); + + char buf[PATH_MAX]; + snprintf(buf, sizeof(buf), "%s/ui-viewmgr.edj", EDJ_PATH); + + if (!elm_layout_file_set(layout, buf, DEFAULT_GROUP)) + { + LOGE("Failed to set file = UiStandardView(%p), path(%s), group(%s)", this, buf, DEFAULT_GROUP); + evas_object_del(layout); + return false; + } + evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL); + + if (this->view->get_content()) + { + elm_object_part_content_set(layout, "elm.swallow.content", this->view->get_content()); + } + + //Set software back key, if it's needed + UiViewmgr *viewmgr = UI_VIEWMGR; + if (viewmgr && viewmgr->need_soft_key()) + { + Elm_Button *prev_btn = elm_button_add(layout); + + if (!prev_btn) + { + LOGE("Failed to create a button = UiStandardView(%p)", this); + } else { + evas_object_smart_callback_add(prev_btn, "clicked", [](void *data, Evas_Object *obj, void *event_info) -> void + { + UiViewmgr *viewmgr = static_cast(data); + viewmgr->pop_view(); + }, viewmgr); + + elm_object_style_set(prev_btn, "tizen_view/prev_btn"); + elm_object_part_content_set(layout, "elm.swallow.prev_btn", prev_btn); + elm_object_signal_emit(layout, "elm,state,prev_btn,show", "viewmgr"); + } + } + + this->layout = layout; + + return true; +} + +UiStandardViewImpl::UiStandardViewImpl(UiStandardView *view) + : view(view), layout(NULL), toolbar(NULL), title_left_btn(NULL), title_right_btn(NULL) +{ +} + +UiStandardViewImpl::~UiStandardViewImpl() +{ + destroy_layout(); +} + +bool UiStandardViewImpl::set_content(Evas_Object *content, const char *title) +{ + Elm_Layout *layout = this->get_base(); + LAYOUT_VALIDATE(); + + elm_object_part_content_set(layout, "elm.swallow.content", content); + if (content) + { + elm_object_signal_emit(layout, "elm.state,elm.swallow.content,show", "viewmgr"); + } else { + elm_object_signal_emit(layout, "elm.state,elm.swallow.content,hide", "viewmgr"); + } + + this->set_title(title); + + return true; +} + +bool UiStandardViewImpl::set_subtitle(const char *text) +{ + Elm_Layout *layout = this->get_base(); + LAYOUT_VALIDATE(); + + elm_object_part_text_set(layout, "elm.text.subtitle", text); + if (text) elm_object_signal_emit(layout, "elm,state,subtitle,show", "viewmgr"); + else elm_object_signal_emit(layout, "elm,state,subtitle,hide", "viewmgr"); + + return true; +} + +bool UiStandardViewImpl::set_title_left_btn(Elm_Button *title_left_btn) +{ + Elm_Layout *layout = this->get_base(); + LAYOUT_VALIDATE(); + + //FIXME: inside of the unset_title_left_btn, it will send a title_left_btn,hide signal. + //But right after it needs to send a show signal again if new title_left_btn is valid. + //We don't need to send a hide signal in this case. + Elm_Button *pbtn = this->unset_title_left_btn(); + evas_object_del(pbtn); + + this->title_left_btn = title_left_btn; + if (!title_left_btn) return true; + + elm_object_style_set(title_left_btn, "tizen_view/title_left"); + elm_object_part_content_set(layout, "title_left_btn", title_left_btn); + elm_object_signal_emit(layout, "elm,state,title_left_btn,show", "viewmgr"); + evas_object_event_callback_add(title_left_btn, EVAS_CALLBACK_DEL, title_left_btn_del_cb, this->view); + + return true; +} + +bool UiStandardViewImpl::set_title_right_btn(Elm_Button *title_right_btn) +{ + Elm_Layout *layout = this->get_base(); + LAYOUT_VALIDATE(); + + //FIXME: inside of the unset_title_right_btn, it will send a title_right_btn,hide signal. + //But right after it needs to send a show signal again if new title_right_btn is valid. + //We don't need to send a hide signal in this case. + Elm_Button *pbtn = this->unset_title_right_btn(); + evas_object_del(pbtn); + + this->title_right_btn = title_right_btn; + if (!title_right_btn) return true; + + elm_object_style_set(title_right_btn, "tizen_view/title_right"); + elm_object_part_content_set(layout, "title_right_btn", title_right_btn); + elm_object_signal_emit(layout, "elm,state,title_right_btn,show", "viewmgr"); + evas_object_event_callback_add(title_right_btn, EVAS_CALLBACK_DEL, title_right_btn_del_cb, this->view); + + return true; +} + +bool UiStandardViewImpl::set_title_badge(const char *text) +{ + Elm_Layout *layout = this->get_base(); + LAYOUT_VALIDATE(); + + elm_object_part_text_set(layout, "title_badge", text); + if (text) elm_object_signal_emit(layout, "elm,state,title_badge,show", "viewmgr"); + else elm_object_signal_emit(layout, "elm,state,title_badge,hide", "viewmgr"); + + return true; +} + +bool UiStandardViewImpl::set_title(const char *text) +{ + Elm_Layout *layout = this->get_base(); + LAYOUT_VALIDATE(); + + elm_object_part_text_set(layout, "elm.text.title", text); + if (text) elm_object_signal_emit(layout, "elm,state,title,show", "viewmgr"); + else elm_object_signal_emit(layout, "elm,state,title,hide", "viewmgr"); + + return true; +} + +bool UiStandardViewImpl::set_toolbar(Elm_Toolbar *toolbar) +{ + Elm_Layout *layout = this->get_base(); + LAYOUT_VALIDATE(); + + //FIXME: inside of the unset_toolbar, it will send a toolbar,hide signal. + //But right after it needs to send a show signal again if new toolbar is valid. + //We don't need to send a hide signal in this case. + Elm_Toolbar *ptoolbar = this->unset_toolbar(); + evas_object_del(ptoolbar); + + this->toolbar = toolbar; + if (!toolbar) return true; + + //FIXME: eeeek. check style?? :( + if (!strcmp(elm_object_style_get(toolbar), "navigationbar")) + { + elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_SCROLL); + elm_toolbar_align_set(toolbar, 0); + } else { + elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_EXPAND); + } + elm_toolbar_transverse_expanded_set(toolbar, EINA_TRUE); + + //FIXME: It can be deleted when the application want to handle this property. + // Some of application may want to select one of toolbar item when view activated. + elm_toolbar_select_mode_set(toolbar, ELM_OBJECT_SELECT_MODE_ALWAYS); + + elm_object_part_content_set(layout, "toolbar", toolbar); + elm_object_signal_emit(layout, "elm,state,toolbar,show", "viewmgr"); + evas_object_event_callback_add(toolbar, EVAS_CALLBACK_DEL, toolbar_del_cb, this->view); + + return true; +} + +void UiStandardViewImpl::unset_content() +{ + Elm_Layout *layout = this->get_base(); + if (!layout) + { + LOGE("Layout is invalid! UiStandardView(%p)", this); + return; + } + elm_object_part_content_unset(layout, "elm.swallow.content"); + elm_object_signal_emit(layout, "elm.state,elm.swallow.content,hide", "viewmgr"); +} + +Elm_Button *UiStandardViewImpl::unset_title_left_btn() +{ + Elm_Button *btn = this->title_left_btn; + if (!btn) return NULL; + + Elm_Layout *layout = this->get_base(); + if (!layout) + { + LOGE("Layout is invalid! UiStandardView(%p)", this); + return btn; + } + + elm_object_part_content_unset(layout, "title_left_btn"); + elm_object_signal_emit(layout, "elm,state,title_left_btn,hide", "viewmgr"); + evas_object_event_callback_del(btn, EVAS_CALLBACK_DEL, title_left_btn_del_cb); + evas_object_hide(btn); + this->title_left_btn = NULL; + + return btn; +} + +Elm_Button *UiStandardViewImpl::unset_title_right_btn() +{ + Elm_Button *btn = this->title_right_btn; + if (!btn) return NULL; + + Elm_Layout *layout = this->get_base(); + if (!layout) + { + LOGE("Layout is invalid! UiStandardView(%p)", this); + return btn; + } + + elm_object_part_content_unset(layout, "title_right_btn"); + elm_object_signal_emit(layout, "elm,state,title_right_btn,hide", "viewmgr"); + evas_object_event_callback_del(btn, EVAS_CALLBACK_DEL, title_right_btn_del_cb); + evas_object_hide(btn); + this->title_right_btn = NULL; + + return btn; +} + +Elm_Toolbar *UiStandardViewImpl::unset_toolbar() +{ + Elm_Toolbar *toolbar = this->toolbar; + if (!toolbar) return NULL; + + Elm_Layout *layout = this->get_base(); + if (!layout) + { + LOGE("Layout is invalid! UiStandardView(%p)", this); + return toolbar; + } + + elm_object_part_content_unset(layout, "toolbar"); + elm_object_signal_emit(layout, "elm,state,toolbar,hide", "viewmgr"); + evas_object_event_callback_del(toolbar, EVAS_CALLBACK_DEL, toolbar_del_cb); + evas_object_hide(toolbar); + this->toolbar = NULL; + + return toolbar; +} + +Evas_Object *UiStandardViewImpl::get_base() +{ + if (!this->layout) + { + this->create_layout(); + } + return this->layout; +} + +bool UiStandardViewImpl::set_title_visible(bool visible, bool anim) +{ + //FIXME: save visible, anim value. they can be used in layout created time. + Elm_Layout *layout = this->get_base(); + if (!layout) + { + LOGE("Layout is invalid! UiStandardView(%p)", this); + return false; + } + + if (visible) + { + if (anim) elm_object_signal_emit(layout, "elm,state,title,show,anim", "viewmgr"); + else elm_object_signal_emit(layout, "elm,state,title,show", "viewmgr"); + } else { + if (anim) elm_object_signal_emit(layout, "elm,state,title,hide,anim", "viewmgr"); + else elm_object_signal_emit(layout, "elm,state,title,hide", "viewmgr"); + } + + return true; +} + +/***********************************************************************************************/ +/* External class Implementation */ +/***********************************************************************************************/ + +UiStandardView::UiStandardView(const char *name) + : UiView(name) +{ + this->impl = new UiStandardViewImpl(this); +} + +UiStandardView::~UiStandardView() +{ + delete(this->impl); +} + +void UiStandardView::on_load() +{ + UiView::on_load(); + + Elm_Layout *layout = this->get_base(); + evas_object_show(layout); +} + +void UiStandardView::on_unload() +{ + UiView::on_unload(); + + Elm_Layout *layout = this->get_base(); + evas_object_hide(layout); +} + +bool UiStandardView::set_content(Evas_Object *content, const char *title) +{ + UiView::set_content(content); + return this->impl->set_content(content, title); +} + +bool UiStandardView::set_subtitle(const char *text) +{ + return this->impl->set_subtitle(text); +} + +bool UiStandardView::set_title_left_btn(Elm_Button *title_left_btn) +{ + return this->impl->set_title_left_btn(title_left_btn); +} + +bool UiStandardView::set_title_right_btn(Elm_Button *title_right_btn) +{ + return this->impl->set_title_right_btn(title_right_btn); +} + +bool UiStandardView::set_title_badge(const char *text) +{ + return this->impl->set_title_badge(text); +} + +bool UiStandardView::set_title(const char *text) +{ + return this->impl->set_title(text); +} + +bool UiStandardView::set_content(Evas_Object *content, const char *title, const char *subtitle, Elm_Button *title_left_btn, Elm_Button *title_right_btn) +{ + if (!this->set_content(content, title)) return false; + if (!this->set_subtitle(subtitle)) return false; + if (!this->set_title_left_btn(title_left_btn)) return false; + if (!this->set_title_right_btn(title_right_btn)) return false; + + return true; +} + +bool UiStandardView::set_toolbar(Elm_Toolbar *toolbar) +{ + return this->impl->set_toolbar(toolbar); +} + +void UiStandardView::set_event_block(bool block) +{ + UiView::set_event_block(block); + evas_object_freeze_events_set(this->get_base(), block); +} + +Evas_Object *UiStandardView::unset_content() +{ + Evas_Object *pcontent = UiView::unset_content(); + if (!pcontent) return NULL; + + this->impl->unset_content(); + + return pcontent; +} + +Elm_Button *UiStandardView::unset_title_left_btn() +{ + return this->impl->unset_title_left_btn(); +} + +Elm_Button *UiStandardView::unset_title_right_btn() +{ + return this->impl->unset_title_right_btn(); +} + +Elm_Toolbar *UiStandardView::unset_toolbar() +{ + return this->impl->unset_toolbar(); +} + +Evas_Object *UiStandardView::get_base() +{ + return this->impl->get_base(); +} + +bool UiStandardView::set_title_visible(bool visible, bool anim) +{ + return this->impl->set_title_visible(visible, anim); +} + +Elm_Button *UiStandardView::get_title_left_btn() +{ + return this->impl->get_title_left_btn(); +} + +Elm_Button *UiStandardView::get_title_right_btn() +{ + return this->impl->get_title_right_btn(); +} + +Elm_Toolbar *UiStandardView::get_toolbar() +{ + return this->impl->get_toolbar(); +} diff --git a/src/lib/efl/mobile/UiView.cpp b/src/lib/efl/mobile/UiView.cpp new file mode 100644 index 0000000..ad7b6d8 --- /dev/null +++ b/src/lib/efl/mobile/UiView.cpp @@ -0,0 +1,234 @@ +/* + * 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 "../../../include/efl/mobile/UiMobileViewManager.h" + +/***********************************************************************************************/ +/* Internal class Implementation */ +/***********************************************************************************************/ + +using namespace std; + +namespace efl_viewmanager +{ + +class UiViewImpl +{ + friend class UiView; + +private: + UiView *view; + UiMenu *menu; + list popup_list; + + void connect_popup(UiPopup *popup); + void disconnect_popup(UiPopup *popup); + bool deactivate_popup(bool top_one); + +protected: + UiMenu *on_menu_pre(); + void on_menu_post(); + void on_rotate(int degree); + void on_portrait(); + void on_landscape(); + bool on_back(); + +public: + UiViewImpl(UiView *view); + ~UiViewImpl(); + + const UiMenu *get_menu() + { + return this->menu; + } +}; + +} + +typedef list::reverse_iterator popup_ritr; + +void UiViewImpl::connect_popup(UiPopup *popup) +{ + this->popup_list.push_back(popup); +} + +void UiViewImpl::disconnect_popup(UiPopup *popup) +{ + this->popup_list.remove(popup); +} + +bool UiViewImpl::deactivate_popup(bool top_one) +{ + for (popup_ritr it = this->popup_list.rbegin(); it != this->popup_list.rend(); it++) + { + UiPopup *popup = *it; + if (!popup->is_activated()) continue; + popup->on_back(); + //deactivate only one top one? or all popups? + if (top_one) return true; + } + return false; +} + +bool UiViewImpl::on_back() +{ + //If any popup is activated, deactivate the popup first. + if (this->deactivate_popup(true)) + { + return false; + } + + if (this->menu) + { + if (this->menu->is_activated()) + { + this->menu->on_back(); + return false; + } + } + return true; +} + +UiViewImpl::UiViewImpl(UiView *view) + : view(view), menu(NULL) +{ +} + +UiViewImpl::~UiViewImpl() +{ + if (menu) delete (this->menu); +} + +UiMenu *UiViewImpl::on_menu_pre() +{ + if (!this->menu) + { + this->menu = new UiMenu(this->view); + } + + if (this->menu->is_activated()) + { + this->menu->deactivate(); + return NULL; + } + + return this->menu; +} + +void UiViewImpl::on_menu_post() +{ + if (!this->menu) return; + this->menu->activate(); +} + +void UiViewImpl::on_rotate(int degree) +{ + if (!this->menu) return; + if (!this->menu->is_activated()) return; + this->menu->on_rotate(degree); +} + +void UiViewImpl::on_portrait() +{ + if (!this->menu) return; + if (!this->menu->is_activated()) return; + this->menu->on_portrait(); +} + +void UiViewImpl::on_landscape() +{ + if (!this->menu) return; + if (!this->menu->is_activated()) return; + this->menu->on_landscape(); +} + +/***********************************************************************************************/ +/* External class Implementation */ +/***********************************************************************************************/ + +void UiView::connect_popup(UiPopup *popup) +{ + this->impl->connect_popup(popup); +} + +void UiView::disconnect_popup(UiPopup *popup) +{ + this->impl->disconnect_popup(popup); +} + +void UiView::on_deactivate() +{ + this->impl->deactivate_popup(false); + UiBaseView::on_deactivate(); +} + +void UiView::on_back() +{ + if (!this->impl->on_back()) return; + UiBaseView::on_back(); +} + +UiView::UiView(const char *name) + : UiBaseView(name) +{ + this->impl = new UiViewImpl(this); +} + +UiView::~UiView() +{ + delete(this->impl); +} + +UiMenu *UiView::on_menu_pre() +{ + return this->impl->on_menu_pre(); +} + +void UiView::on_menu(UiMenu *menu) +{ +} + +void UiView::on_menu_post() +{ + this->impl->on_menu_post(); +} + +void UiView::on_rotate(int degree) +{ + //FIXME: see how to handle on_menu() + UiBaseView::on_rotate(degree); + this->impl->on_rotate(degree); +} + +void UiView::on_portrait() +{ + //FIXME: see how to handle on_menu() + UiBaseView::on_portrait(); + this->impl->on_portrait(); +} + +void UiView::on_landscape() +{ + //FIXME: see how to handle on_menu() + UiBaseView::on_landscape(); + this->impl->on_landscape(); +} + +const UiMenu *UiView::get_menu() +{ + return this->impl->get_menu(); +} diff --git a/src/lib/efl/mobile/UiViewmgr.cpp b/src/lib/efl/mobile/UiViewmgr.cpp new file mode 100644 index 0000000..4c90722 --- /dev/null +++ b/src/lib/efl/mobile/UiViewmgr.cpp @@ -0,0 +1,39 @@ +/* + * 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/UiMobileViewManager.h" + +/***********************************************************************************************/ +/* Internal class Implementation */ +/***********************************************************************************************/ +namespace efl_viewmanager +{ + +class UiViewmgrImpl; + +} + +/***********************************************************************************************/ +/* External class Implementation */ +/***********************************************************************************************/ +UiViewmgr::UiViewmgr(const char *pkg) + : UiBaseViewmgr(pkg, new UiKeyListener(this)) +{ +} + +UiViewmgr::~UiViewmgr() +{ +} diff --git a/src/lib/efl/mobile/c/ui_application.cpp b/src/lib/efl/mobile/c/ui_application.cpp index 8f8b821..13ca668 100644 --- a/src/lib/efl/mobile/c/ui_application.cpp +++ b/src/lib/efl/mobile/c/ui_application.cpp @@ -3,7 +3,7 @@ using namespace efl_viewmanager; -class ui_app_capi : public ui_app +class ui_app_capi : public UiApp { public: ui_app_lifecycle_callback_s capi_lifecycle_callback; @@ -11,7 +11,7 @@ public: bool on_create() { - if (!ui_app::on_create()) return false; + if (!UiApp::on_create()) return false; if (!this->capi_lifecycle_callback.create) return false; return this->capi_lifecycle_callback.create(this->data); @@ -19,7 +19,7 @@ public: void on_terminate() { - ui_app::on_terminate(); + UiApp::on_terminate(); if (!this->capi_lifecycle_callback.terminate) return; this->capi_lifecycle_callback.terminate(this->data); @@ -27,7 +27,7 @@ public: void on_pause() { - ui_app::on_pause(); + UiApp::on_pause(); if (!this->capi_lifecycle_callback.pause) return; this->capi_lifecycle_callback.pause(this->data); @@ -35,7 +35,7 @@ public: void on_resume() { - ui_app::on_resume(); + UiApp::on_resume(); if (!this->capi_lifecycle_callback.resume) return; this->capi_lifecycle_callback.resume(this->data); @@ -43,14 +43,14 @@ public: void on_control(app_control_h app_control) { - ui_app::on_control(app_control); + UiApp::on_control(app_control); if (!this->capi_lifecycle_callback.app_control) return; this->capi_lifecycle_callback.app_control(app_control, this->data); } ui_app_capi(const char *pkg, const char *locale_dir) - : ui_app(pkg, locale_dir), data(NULL) + : UiApp(pkg, locale_dir), data(NULL) { } @@ -67,7 +67,7 @@ public: this->data = user_data; - return ui_app::run(argc, argv); + return UiApp::run(argc, argv); } }; diff --git a/src/lib/efl/mobile/ui_app.cpp b/src/lib/efl/mobile/ui_app.cpp deleted file mode 100644 index 6ff5157..0000000 --- a/src/lib/efl/mobile/ui_app.cpp +++ /dev/null @@ -1,44 +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_mobile_viewmanager.h" - -/***********************************************************************************************/ -/* Internal class Implementation */ -/***********************************************************************************************/ - -/***********************************************************************************************/ -/* External class Implementation */ -/***********************************************************************************************/ - -ui_app::ui_app(const char *pkg, const char *locale_dir) - : ui_iface_app(pkg, locale_dir, new ui_viewmgr(pkg)) -{ -} - -ui_app::~ui_app() -{ -} - -ui_viewmgr *ui_app::get_viewmgr() -{ - return dynamic_cast(ui_iface_app::get_viewmgr()); -} - -ui_app *ui_app::get_instance() -{ - return dynamic_cast(ui_iface_app::get_instance()); -} diff --git a/src/lib/efl/mobile/ui_key_listener.cpp b/src/lib/efl/mobile/ui_key_listener.cpp deleted file mode 100644 index fe1849a..0000000 --- a/src/lib/efl/mobile/ui_key_listener.cpp +++ /dev/null @@ -1,52 +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_mobile_viewmanager.h" - -static const char *KEY_MENU = "XF86Menu"; -static const char *KEY_MENU2 = "XF86Send"; - -ui_key_listener::ui_key_listener(ui_viewmgr *viewmgr) - : ui_base_key_listener(viewmgr) -{ -} - -void ui_key_listener::extend_event_proc(ui_base_view *view, Evas_Event_Key_Down *ev) -{ - if (strcmp(ev->keyname, KEY_MENU) && strcmp(ev->keyname, KEY_MENU2)) return; - ui_view *v = dynamic_cast(view); - ui_menu *menu = v->on_menu_pre(); - if (!menu) return; - v->on_menu(menu); - v->on_menu_post(); -} - -bool ui_key_listener::init() -{ - if (!ui_base_key_listener::init()) return false; - if (!evas_object_key_grab(this->get_keygrab_obj(), KEY_MENU, 0, 0, EINA_FALSE)) - { - LOGE("Failed to grab MENU KEY(%s)\n", KEY_MENU); - return false; - } - - if (!evas_object_key_grab(this->get_keygrab_obj(), KEY_MENU2, 0, 0, EINA_FALSE)) - { - LOGE("Failed to grab MENU KEY(%s)\n", KEY_MENU2); - return false; - } - return true; -} diff --git a/src/lib/efl/mobile/ui_menu.cpp b/src/lib/efl/mobile/ui_menu.cpp deleted file mode 100644 index 7b69bc9..0000000 --- a/src/lib/efl/mobile/ui_menu.cpp +++ /dev/null @@ -1,165 +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_mobile_viewmanager.h" - -static void ctxpopup_dismissed_cb(void *data, Evas_Object *obj, void *event_info) -{ - evas_object_hide(obj); -} - -static void ctxpopup_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - ui_menu *menu = static_cast(data); - menu->unset_content(); -} - -static bool update_menu(ui_menu *menu) -{ - Elm_Win *win = menu->get_base(); - if (!win) return false; - - Elm_Ctxpopup *ctxpopup = menu->get_content(); - if (!ctxpopup) return false; - - /* We convince the top widget is a window */ - Evas_Coord w, h; - elm_win_screen_size_get(win, NULL, NULL, &w, &h); - int rot = elm_win_rotation_get(win); - - switch (rot) - { - case 0: - case 180: - evas_object_move(ctxpopup, (w / 2), h); - break; - case 90: - case 270: - evas_object_move(ctxpopup, (h / 2), w); - break; - } - - evas_object_show(ctxpopup); - - return true; -} - -static void win_resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - ui_menu *menu = static_cast(data); - if (!menu->is_activated()) return; - update_menu(menu); -} - -ui_menu::ui_menu(ui_view *view) - : ui_base_overlay(view) -{ - Elm_Win *win = this->get_window(); - evas_object_event_callback_add(win, EVAS_CALLBACK_RESIZE, win_resize_cb, this); -} - -ui_menu::~ui_menu() -{ - Elm_Win *win = this->get_window(); - if (win) evas_object_event_callback_del(win, EVAS_CALLBACK_RESIZE, win_resize_cb); - Elm_Ctxpopup *ctxpopup = this->unset_content(); - evas_object_del(ctxpopup); -} - -Elm_Win *ui_menu::get_window() -{ - ui_viewmgr *viewmgr = UI_VIEWMGR; - if (!viewmgr) - { - LOGE("Viewmgr is null?? menu(%p)", this); - return NULL; - } - - return viewmgr->get_window(); -} - -bool ui_menu::deactivate() -{ - Elm_Ctxpopup *ctxpopup = this->get_content(); - if (!ctxpopup) - { - LOGE("Content is not set! = ui_menu(%p)", this); - return false; - } - - elm_ctxpopup_dismiss(ctxpopup); - dynamic_cast(this->get_view())->on_resume(); - - return true; -} - -bool ui_menu::activate() -{ - bool ret = update_menu(this); - if (ret) dynamic_cast(this->get_view())->on_pause(); - return ret; -} - -bool ui_menu::set_content(Elm_Ctxpopup *ctxpopup) -{ - Elm_Ctxpopup *prev = this->unset_content(); - evas_object_del(prev); - - if (!ctxpopup) return true; - - if (strcmp(evas_object_type_get(ctxpopup), "elm_ctxpopup")) - { - LOGE("Menu widget is not a ctxpopup!"); - return false; - } - - elm_object_style_set(ctxpopup, "more/default"); - elm_ctxpopup_auto_hide_disabled_set(ctxpopup, EINA_TRUE); - evas_object_smart_callback_add(ctxpopup, "dismissed", ctxpopup_dismissed_cb, NULL); - evas_object_event_callback_add(ctxpopup, EVAS_CALLBACK_DEL, ctxpopup_del_cb, this); - - ui_base_overlay::set_content(ctxpopup); - - return true; -} - -bool ui_menu::is_activated() -{ - Elm_Ctxpopup *ctxpopup = this->get_content(); - if (!ctxpopup) return false; - return evas_object_visible_get(ctxpopup); -} - -Elm_Ctxpopup *ui_menu::unset_content() -{ - Elm_Ctxpopup *ctxpopup = ui_base_overlay::unset_content(); - if (!ctxpopup) return NULL; - - evas_object_smart_callback_del(ctxpopup, "dismissed", ctxpopup_dismissed_cb); - evas_object_event_callback_del(ctxpopup, EVAS_CALLBACK_DEL, ctxpopup_del_cb); - - return ctxpopup; -} - -Evas_Object *ui_menu::get_base() -{ - return this->get_window(); -} - -int ui_menu::get_degree() -{ - return this->get_view()->get_degree(); -} diff --git a/src/lib/efl/mobile/ui_popup.cpp b/src/lib/efl/mobile/ui_popup.cpp deleted file mode 100644 index 822be93..0000000 --- a/src/lib/efl/mobile/ui_popup.cpp +++ /dev/null @@ -1,137 +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_mobile_viewmanager.h" - -static bool update_popup(ui_popup *popup) -{ - Elm_Win *win = popup->get_base(); - if (!win) return false; - - Elm_Popup *_popup = popup->get_content(); - if (!_popup) return false; - - evas_object_show(_popup); - - return true; -} - -static void popup_dismissed_cb(void *data, Evas_Object *obj, void *event_info) -{ - evas_object_hide(obj); -} - -static void popup_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - ui_popup *popup = static_cast(data); - popup->unset_content(); -} - -ui_popup::ui_popup(ui_view *view) - : ui_base_overlay(view) -{ - view->connect_popup(this); -} - -ui_popup::~ui_popup() -{ - dynamic_cast(this->get_view())->disconnect_popup(this); - Elm_Popup *popup = this->unset_content(); - evas_object_del(popup); -} - -Elm_Win *ui_popup::get_window() -{ - ui_viewmgr *viewmgr = UI_VIEWMGR; - if (!viewmgr) - { - LOGE("Viewmgr is null?? menu(%p)", this); - return NULL; - } - return viewmgr->get_window(); -} - -bool ui_popup::deactivate() -{ - Elm_Popup *popup = this->get_content(); - if (!popup) - { - LOGE("Content is not set! = ui_popup(%p)", this); - return false; - } - - elm_popup_dismiss(popup); - dynamic_cast(this->get_view())->on_resume(); - - return true; -} - -bool ui_popup::activate() -{ - bool ret = update_popup(this); - if (ret) dynamic_cast(this->get_view())->on_pause(); - return ret; -} - -bool ui_popup::set_content(Elm_Popup *popup) -{ - Elm_Popup *prev = this->unset_content(); - evas_object_del(prev); - - if (!popup) return true; - - if (strcmp(evas_object_type_get(popup), "elm_popup")) - { - LOGE("Menu widget is not a popup!"); - return false; - } - - elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0); - evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, popup_del_cb, this); - evas_object_smart_callback_add(popup, "dismissed", popup_dismissed_cb, this); - - ui_base_overlay::set_content(popup); - - return true; -} - -bool ui_popup::is_activated() -{ - Elm_Popup *popup = this->get_content(); - if (!popup) return false; - return evas_object_visible_get(popup); -} - -Elm_Popup *ui_popup::unset_content() -{ - Elm_Popup *popup = ui_base_overlay::unset_content(); - if (!popup) return NULL; - - evas_object_event_callback_del(popup, EVAS_CALLBACK_DEL, popup_del_cb); - evas_object_smart_callback_del(popup, "dismissed", popup_dismissed_cb); - - return popup; -} - -Evas_Object *ui_popup::get_base() -{ - return this->get_window(); -} - -int ui_popup::get_degree() -{ - return this->get_view()->get_degree(); -} diff --git a/src/lib/efl/mobile/ui_standard_view.cpp b/src/lib/efl/mobile/ui_standard_view.cpp deleted file mode 100644 index b530fa6..0000000 --- a/src/lib/efl/mobile/ui_standard_view.cpp +++ /dev/null @@ -1,543 +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_mobile_viewmanager.h" - -/***********************************************************************************************/ -/* Internal class Implementation */ -/***********************************************************************************************/ - -namespace efl_viewmanager -{ - -class ui_standard_view_impl -{ - friend class ui_standard_view; - -private: - ui_standard_view *view; - Elm_Layout *layout; //Base layout for view - Elm_Toolbar *toolbar; //Toolbar - Elm_Button *title_left_btn; //Title left button - Elm_Button *title_right_btn; //Title right button - - bool create_layout(); - bool destroy_layout(); - -public: - ui_standard_view_impl(ui_standard_view *view); - ~ui_standard_view_impl(); - - bool set_content(Evas_Object *content, const char *title = NULL); - bool set_content(Evas_Object *content, const char *title, const char *subtitle, Elm_Button *title_left_btn, Elm_Button *title_right_btn); - bool set_title_badge(const char *text); - bool set_subtitle(const char *text); - bool set_title_left_btn(Elm_Button *title_left_btn); - bool set_title_right_btn(Elm_Button *title_right_btn); - bool set_title(const char *text); - bool set_toolbar(Elm_Toolbar *toolbar); - bool set_title_visible(bool visible, bool anim); - void unset_content(); - Elm_Button *unset_title_left_btn(); - Elm_Button *unset_title_right_btn(); - Elm_Toolbar *unset_toolbar(); - Evas_Object *get_base(); - - Elm_Button *get_title_left_btn() - { - return this->title_left_btn; - } - - Elm_Button *get_title_right_btn() - { - return this->title_right_btn; - } - - Elm_Toolbar *get_toolbar() - { - return this->toolbar; - } -}; - -} - -#define DEFAULT_GROUP "tizen_view/default" - -#define LAYOUT_VALIDATE() if (!layout) \ - { \ - LOGE("Layout is invalid! ui_standard_view(%p)", this); \ - return false; \ - } - -static void title_left_btn_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - ui_standard_view *view = static_cast(data); - view->unset_title_left_btn(); -} - -static void title_right_btn_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - ui_standard_view *view = static_cast(data); - view->unset_title_right_btn(); -} - -static void toolbar_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - ui_standard_view *view = static_cast(data); - view->unset_toolbar(); -} - -bool ui_standard_view_impl::destroy_layout() -{ - if (!this->layout) return false; - evas_object_del(this->layout); - this->layout = NULL; - - return true; -} - -bool ui_standard_view_impl::create_layout() -{ - if (this->layout) return false; - - Elm_Layout *layout = elm_layout_add(this->view->get_parent()); - LAYOUT_VALIDATE(); - - char buf[PATH_MAX]; - snprintf(buf, sizeof(buf), "%s/ui-viewmgr.edj", EDJ_PATH); - - if (!elm_layout_file_set(layout, buf, DEFAULT_GROUP)) - { - LOGE("Failed to set file = ui_standard_view(%p), path(%s), group(%s)", this, buf, DEFAULT_GROUP); - evas_object_del(layout); - return false; - } - evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL); - - if (this->view->get_content()) - { - elm_object_part_content_set(layout, "elm.swallow.content", this->view->get_content()); - } - - //Set software back key, if it's needed - ui_viewmgr *viewmgr = UI_VIEWMGR; - if (viewmgr && viewmgr->need_soft_key()) - { - Elm_Button *prev_btn = elm_button_add(layout); - - if (!prev_btn) - { - LOGE("Failed to create a button = ui_standard_view(%p)", this); - } else { - evas_object_smart_callback_add(prev_btn, "clicked", [](void *data, Evas_Object *obj, void *event_info) -> void - { - ui_viewmgr *viewmgr = static_cast(data); - viewmgr->pop_view(); - }, viewmgr); - - elm_object_style_set(prev_btn, "tizen_view/prev_btn"); - elm_object_part_content_set(layout, "elm.swallow.prev_btn", prev_btn); - elm_object_signal_emit(layout, "elm,state,prev_btn,show", "viewmgr"); - } - } - - this->layout = layout; - - return true; -} - -ui_standard_view_impl::ui_standard_view_impl(ui_standard_view *view) - : view(view), layout(NULL), toolbar(NULL), title_left_btn(NULL), title_right_btn(NULL) -{ -} - -ui_standard_view_impl::~ui_standard_view_impl() -{ - destroy_layout(); -} - -bool ui_standard_view_impl::set_content(Evas_Object *content, const char *title) -{ - Elm_Layout *layout = this->get_base(); - LAYOUT_VALIDATE(); - - elm_object_part_content_set(layout, "elm.swallow.content", content); - if (content) - { - elm_object_signal_emit(layout, "elm.state,elm.swallow.content,show", "viewmgr"); - } else { - elm_object_signal_emit(layout, "elm.state,elm.swallow.content,hide", "viewmgr"); - } - - this->set_title(title); - - return true; -} - -bool ui_standard_view_impl::set_subtitle(const char *text) -{ - Elm_Layout *layout = this->get_base(); - LAYOUT_VALIDATE(); - - elm_object_part_text_set(layout, "elm.text.subtitle", text); - if (text) elm_object_signal_emit(layout, "elm,state,subtitle,show", "viewmgr"); - else elm_object_signal_emit(layout, "elm,state,subtitle,hide", "viewmgr"); - - return true; -} - -bool ui_standard_view_impl::set_title_left_btn(Elm_Button *title_left_btn) -{ - Elm_Layout *layout = this->get_base(); - LAYOUT_VALIDATE(); - - //FIXME: inside of the unset_title_left_btn, it will send a title_left_btn,hide signal. - //But right after it needs to send a show signal again if new title_left_btn is valid. - //We don't need to send a hide signal in this case. - Elm_Button *pbtn = this->unset_title_left_btn(); - evas_object_del(pbtn); - - this->title_left_btn = title_left_btn; - if (!title_left_btn) return true; - - elm_object_style_set(title_left_btn, "tizen_view/title_left"); - elm_object_part_content_set(layout, "title_left_btn", title_left_btn); - elm_object_signal_emit(layout, "elm,state,title_left_btn,show", "viewmgr"); - evas_object_event_callback_add(title_left_btn, EVAS_CALLBACK_DEL, title_left_btn_del_cb, this->view); - - return true; -} - -bool ui_standard_view_impl::set_title_right_btn(Elm_Button *title_right_btn) -{ - Elm_Layout *layout = this->get_base(); - LAYOUT_VALIDATE(); - - //FIXME: inside of the unset_title_right_btn, it will send a title_right_btn,hide signal. - //But right after it needs to send a show signal again if new title_right_btn is valid. - //We don't need to send a hide signal in this case. - Elm_Button *pbtn = this->unset_title_right_btn(); - evas_object_del(pbtn); - - this->title_right_btn = title_right_btn; - if (!title_right_btn) return true; - - elm_object_style_set(title_right_btn, "tizen_view/title_right"); - elm_object_part_content_set(layout, "title_right_btn", title_right_btn); - elm_object_signal_emit(layout, "elm,state,title_right_btn,show", "viewmgr"); - evas_object_event_callback_add(title_right_btn, EVAS_CALLBACK_DEL, title_right_btn_del_cb, this->view); - - return true; -} - -bool ui_standard_view_impl::set_title_badge(const char *text) -{ - Elm_Layout *layout = this->get_base(); - LAYOUT_VALIDATE(); - - elm_object_part_text_set(layout, "title_badge", text); - if (text) elm_object_signal_emit(layout, "elm,state,title_badge,show", "viewmgr"); - else elm_object_signal_emit(layout, "elm,state,title_badge,hide", "viewmgr"); - - return true; -} - -bool ui_standard_view_impl::set_title(const char *text) -{ - Elm_Layout *layout = this->get_base(); - LAYOUT_VALIDATE(); - - elm_object_part_text_set(layout, "elm.text.title", text); - if (text) elm_object_signal_emit(layout, "elm,state,title,show", "viewmgr"); - else elm_object_signal_emit(layout, "elm,state,title,hide", "viewmgr"); - - return true; -} - -bool ui_standard_view_impl::set_toolbar(Elm_Toolbar *toolbar) -{ - Elm_Layout *layout = this->get_base(); - LAYOUT_VALIDATE(); - - //FIXME: inside of the unset_toolbar, it will send a toolbar,hide signal. - //But right after it needs to send a show signal again if new toolbar is valid. - //We don't need to send a hide signal in this case. - Elm_Toolbar *ptoolbar = this->unset_toolbar(); - evas_object_del(ptoolbar); - - this->toolbar = toolbar; - if (!toolbar) return true; - - //FIXME: eeeek. check style?? :( - if (!strcmp(elm_object_style_get(toolbar), "navigationbar")) - { - elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_SCROLL); - elm_toolbar_align_set(toolbar, 0); - } else { - elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_EXPAND); - } - elm_toolbar_transverse_expanded_set(toolbar, EINA_TRUE); - - //FIXME: It can be deleted when the application want to handle this property. - // Some of application may want to select one of toolbar item when view activated. - elm_toolbar_select_mode_set(toolbar, ELM_OBJECT_SELECT_MODE_ALWAYS); - - elm_object_part_content_set(layout, "toolbar", toolbar); - elm_object_signal_emit(layout, "elm,state,toolbar,show", "viewmgr"); - evas_object_event_callback_add(toolbar, EVAS_CALLBACK_DEL, toolbar_del_cb, this->view); - - return true; -} - -void ui_standard_view_impl::unset_content() -{ - Elm_Layout *layout = this->get_base(); - if (!layout) - { - LOGE("Layout is invalid! ui_standard_view(%p)", this); - return; - } - elm_object_part_content_unset(layout, "elm.swallow.content"); - elm_object_signal_emit(layout, "elm.state,elm.swallow.content,hide", "viewmgr"); -} - -Elm_Button *ui_standard_view_impl::unset_title_left_btn() -{ - Elm_Button *btn = this->title_left_btn; - if (!btn) return NULL; - - Elm_Layout *layout = this->get_base(); - if (!layout) - { - LOGE("Layout is invalid! ui_standard_view(%p)", this); - return btn; - } - - elm_object_part_content_unset(layout, "title_left_btn"); - elm_object_signal_emit(layout, "elm,state,title_left_btn,hide", "viewmgr"); - evas_object_event_callback_del(btn, EVAS_CALLBACK_DEL, title_left_btn_del_cb); - evas_object_hide(btn); - this->title_left_btn = NULL; - - return btn; -} - -Elm_Button *ui_standard_view_impl::unset_title_right_btn() -{ - Elm_Button *btn = this->title_right_btn; - if (!btn) return NULL; - - Elm_Layout *layout = this->get_base(); - if (!layout) - { - LOGE("Layout is invalid! ui_standard_view(%p)", this); - return btn; - } - - elm_object_part_content_unset(layout, "title_right_btn"); - elm_object_signal_emit(layout, "elm,state,title_right_btn,hide", "viewmgr"); - evas_object_event_callback_del(btn, EVAS_CALLBACK_DEL, title_right_btn_del_cb); - evas_object_hide(btn); - this->title_right_btn = NULL; - - return btn; -} - -Elm_Toolbar *ui_standard_view_impl::unset_toolbar() -{ - Elm_Toolbar *toolbar = this->toolbar; - if (!toolbar) return NULL; - - Elm_Layout *layout = this->get_base(); - if (!layout) - { - LOGE("Layout is invalid! ui_standard_view(%p)", this); - return toolbar; - } - - elm_object_part_content_unset(layout, "toolbar"); - elm_object_signal_emit(layout, "elm,state,toolbar,hide", "viewmgr"); - evas_object_event_callback_del(toolbar, EVAS_CALLBACK_DEL, toolbar_del_cb); - evas_object_hide(toolbar); - this->toolbar = NULL; - - return toolbar; -} - -Evas_Object *ui_standard_view_impl::get_base() -{ - if (!this->layout) - { - this->create_layout(); - } - return this->layout; -} - -bool ui_standard_view_impl::set_title_visible(bool visible, bool anim) -{ - //FIXME: save visible, anim value. they can be used in layout created time. - Elm_Layout *layout = this->get_base(); - if (!layout) - { - LOGE("Layout is invalid! ui_standard_view(%p)", this); - return false; - } - - if (visible) - { - if (anim) elm_object_signal_emit(layout, "elm,state,title,show,anim", "viewmgr"); - else elm_object_signal_emit(layout, "elm,state,title,show", "viewmgr"); - } else { - if (anim) elm_object_signal_emit(layout, "elm,state,title,hide,anim", "viewmgr"); - else elm_object_signal_emit(layout, "elm,state,title,hide", "viewmgr"); - } - - return true; -} - -/***********************************************************************************************/ -/* External class Implementation */ -/***********************************************************************************************/ - -ui_standard_view::ui_standard_view(const char *name) - : ui_view(name) -{ - this->impl = new ui_standard_view_impl(this); -} - -ui_standard_view::~ui_standard_view() -{ - delete(this->impl); -} - -void ui_standard_view::on_load() -{ - ui_view::on_load(); - - Elm_Layout *layout = this->get_base(); - evas_object_show(layout); -} - -void ui_standard_view::on_unload() -{ - ui_view::on_unload(); - - Elm_Layout *layout = this->get_base(); - evas_object_hide(layout); -} - -bool ui_standard_view::set_content(Evas_Object *content, const char *title) -{ - ui_view::set_content(content); - return this->impl->set_content(content, title); -} - -bool ui_standard_view::set_subtitle(const char *text) -{ - return this->impl->set_subtitle(text); -} - -bool ui_standard_view::set_title_left_btn(Elm_Button *title_left_btn) -{ - return this->impl->set_title_left_btn(title_left_btn); -} - -bool ui_standard_view::set_title_right_btn(Elm_Button *title_right_btn) -{ - return this->impl->set_title_right_btn(title_right_btn); -} - -bool ui_standard_view::set_title_badge(const char *text) -{ - return this->impl->set_title_badge(text); -} - -bool ui_standard_view::set_title(const char *text) -{ - return this->impl->set_title(text); -} - -bool ui_standard_view::set_content(Evas_Object *content, const char *title, const char *subtitle, Elm_Button *title_left_btn, Elm_Button *title_right_btn) -{ - if (!this->set_content(content, title)) return false; - if (!this->set_subtitle(subtitle)) return false; - if (!this->set_title_left_btn(title_left_btn)) return false; - if (!this->set_title_right_btn(title_right_btn)) return false; - - return true; -} - -bool ui_standard_view::set_toolbar(Elm_Toolbar *toolbar) -{ - return this->impl->set_toolbar(toolbar); -} - -void ui_standard_view::set_event_block(bool block) -{ - ui_view::set_event_block(block); - evas_object_freeze_events_set(this->get_base(), block); -} - -Evas_Object *ui_standard_view::unset_content() -{ - Evas_Object *pcontent = ui_view::unset_content(); - if (!pcontent) return NULL; - - this->impl->unset_content(); - - return pcontent; -} - -Elm_Button *ui_standard_view::unset_title_left_btn() -{ - return this->impl->unset_title_left_btn(); -} - -Elm_Button *ui_standard_view::unset_title_right_btn() -{ - return this->impl->unset_title_right_btn(); -} - -Elm_Toolbar *ui_standard_view::unset_toolbar() -{ - return this->impl->unset_toolbar(); -} - -Evas_Object *ui_standard_view::get_base() -{ - return this->impl->get_base(); -} - -bool ui_standard_view::set_title_visible(bool visible, bool anim) -{ - return this->impl->set_title_visible(visible, anim); -} - -Elm_Button *ui_standard_view::get_title_left_btn() -{ - return this->impl->get_title_left_btn(); -} - -Elm_Button *ui_standard_view::get_title_right_btn() -{ - return this->impl->get_title_right_btn(); -} - -Elm_Toolbar *ui_standard_view::get_toolbar() -{ - return this->impl->get_toolbar(); -} diff --git a/src/lib/efl/mobile/ui_view.cpp b/src/lib/efl/mobile/ui_view.cpp deleted file mode 100644 index 6bbd8a2..0000000 --- a/src/lib/efl/mobile/ui_view.cpp +++ /dev/null @@ -1,234 +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 "../../../include/efl/mobile/ui_mobile_viewmanager.h" - -/***********************************************************************************************/ -/* Internal class Implementation */ -/***********************************************************************************************/ - -using namespace std; - -namespace efl_viewmanager -{ - -class ui_view_impl -{ - friend class ui_view; - -private: - ui_view *view; - ui_menu *menu; - list popup_list; - - void connect_popup(ui_popup *popup); - void disconnect_popup(ui_popup *popup); - bool deactivate_popup(bool top_one); - -protected: - ui_menu *on_menu_pre(); - void on_menu_post(); - void on_rotate(int degree); - void on_portrait(); - void on_landscape(); - bool on_back(); - -public: - ui_view_impl(ui_view *view); - ~ui_view_impl(); - - const ui_menu *get_menu() - { - return this->menu; - } -}; - -} - -typedef list::reverse_iterator popup_ritr; - -void ui_view_impl::connect_popup(ui_popup *popup) -{ - this->popup_list.push_back(popup); -} - -void ui_view_impl::disconnect_popup(ui_popup *popup) -{ - this->popup_list.remove(popup); -} - -bool ui_view_impl::deactivate_popup(bool top_one) -{ - for (popup_ritr it = this->popup_list.rbegin(); it != this->popup_list.rend(); it++) - { - ui_popup *popup = *it; - if (!popup->is_activated()) continue; - popup->on_back(); - //deactivate only one top one? or all popups? - if (top_one) return true; - } - return false; -} - -bool ui_view_impl::on_back() -{ - //If any popup is activated, deactivate the popup first. - if (this->deactivate_popup(true)) - { - return false; - } - - if (this->menu) - { - if (this->menu->is_activated()) - { - this->menu->on_back(); - return false; - } - } - return true; -} - -ui_view_impl::ui_view_impl(ui_view *view) - : view(view), menu(NULL) -{ -} - -ui_view_impl::~ui_view_impl() -{ - if (menu) delete (this->menu); -} - -ui_menu *ui_view_impl::on_menu_pre() -{ - if (!this->menu) - { - this->menu = new ui_menu(this->view); - } - - if (this->menu->is_activated()) - { - this->menu->deactivate(); - return NULL; - } - - return this->menu; -} - -void ui_view_impl::on_menu_post() -{ - if (!this->menu) return; - this->menu->activate(); -} - -void ui_view_impl::on_rotate(int degree) -{ - if (!this->menu) return; - if (!this->menu->is_activated()) return; - this->menu->on_rotate(degree); -} - -void ui_view_impl::on_portrait() -{ - if (!this->menu) return; - if (!this->menu->is_activated()) return; - this->menu->on_portrait(); -} - -void ui_view_impl::on_landscape() -{ - if (!this->menu) return; - if (!this->menu->is_activated()) return; - this->menu->on_landscape(); -} - -/***********************************************************************************************/ -/* External class Implementation */ -/***********************************************************************************************/ - -void ui_view::connect_popup(ui_popup *popup) -{ - this->impl->connect_popup(popup); -} - -void ui_view::disconnect_popup(ui_popup *popup) -{ - this->impl->disconnect_popup(popup); -} - -void ui_view::on_deactivate() -{ - this->impl->deactivate_popup(false); - ui_base_view::on_deactivate(); -} - -void ui_view::on_back() -{ - if (!this->impl->on_back()) return; - ui_base_view::on_back(); -} - -ui_view::ui_view(const char *name) - : ui_base_view(name) -{ - this->impl = new ui_view_impl(this); -} - -ui_view::~ui_view() -{ - delete(this->impl); -} - -ui_menu *ui_view::on_menu_pre() -{ - return this->impl->on_menu_pre(); -} - -void ui_view::on_menu(ui_menu *menu) -{ -} - -void ui_view::on_menu_post() -{ - this->impl->on_menu_post(); -} - -void ui_view::on_rotate(int degree) -{ - //FIXME: see how to handle on_menu() - ui_base_view::on_rotate(degree); - this->impl->on_rotate(degree); -} - -void ui_view::on_portrait() -{ - //FIXME: see how to handle on_menu() - ui_base_view::on_portrait(); - this->impl->on_portrait(); -} - -void ui_view::on_landscape() -{ - //FIXME: see how to handle on_menu() - ui_base_view::on_landscape(); - this->impl->on_landscape(); -} - -const ui_menu *ui_view::get_menu() -{ - return this->impl->get_menu(); -} diff --git a/src/lib/efl/mobile/ui_viewmgr.cpp b/src/lib/efl/mobile/ui_viewmgr.cpp deleted file mode 100644 index 6a44384..0000000 --- a/src/lib/efl/mobile/ui_viewmgr.cpp +++ /dev/null @@ -1,39 +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_mobile_viewmanager.h" - -/***********************************************************************************************/ -/* Internal class Implementation */ -/***********************************************************************************************/ -namespace efl_viewmanager -{ - -class ui_viewmgr_impl; - -} - -/***********************************************************************************************/ -/* External class Implementation */ -/***********************************************************************************************/ -ui_viewmgr::ui_viewmgr(const char *pkg) - : ui_base_viewmgr(pkg, new ui_key_listener(this)) -{ -} - -ui_viewmgr::~ui_viewmgr() -{ -} diff --git a/src/lib/efl/ui_base_key_listener.cpp b/src/lib/efl/ui_base_key_listener.cpp deleted file mode 100644 index f5a88d4..0000000 --- a/src/lib/efl/ui_base_key_listener.cpp +++ /dev/null @@ -1,161 +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_base_viewmanager.h" - -/***********************************************************************************************/ -/* Internal class Implementation */ -/***********************************************************************************************/ -namespace efl_viewmanager -{ -class ui_base_key_listener_impl -{ -protected: - ui_base_key_listener *key_listener; - ui_base_viewmgr *viewmgr; - Evas_Object *key_grabber; - -public: - ui_base_key_listener_impl(ui_base_key_listener *key_listener, ui_base_viewmgr *viewmgr); - ~ui_base_key_listener_impl() {} - - bool init(); - bool term(); - void event_proc(Evas_Event_Key_Down *ev); - ui_base_viewmgr *get_viewmgr() { return this->viewmgr; } - Evas_Object *get_keygrab_obj() { return this->key_grabber; } -}; -} - -static const char *KEY_BACK = "XF86Back"; -static const char *KEY_BACK2 = "XF86Stop"; - -static void key_grab_rect_key_up_cb(ui_base_key_listener_impl *key_listener, Evas_Event_Key_Down *ev) -{ - key_listener->event_proc(ev); -} - -ui_base_key_listener_impl::ui_base_key_listener_impl(ui_base_key_listener *key_listener, ui_base_viewmgr *viewmgr) - : key_listener(key_listener), viewmgr(viewmgr), key_grabber(NULL) -{ -} - -void ui_base_key_listener_impl::event_proc(Evas_Event_Key_Down *ev) -{ - //Only if view manager is activated - ui_base_viewmgr *viewmgr = this->key_listener->get_viewmgr(); - if (!viewmgr->is_activated()) return; - - //Get Top View - ui_base_view *view = viewmgr->get_last_view(); - if (!view) return; - - this->key_listener->extend_event_proc(view, ev); - - if (strcmp(ev->keyname, KEY_BACK) && strcmp(ev->keyname, KEY_BACK2)) return; - - view->on_back(); -} - -bool ui_base_key_listener_impl::term() -{ - evas_object_del(this->key_grabber); - return true; -} - -bool ui_base_key_listener_impl::init() -{ - if (!this->viewmgr) - { - LOGE("No view manager??"); - return false; - } - - Evas *e = evas_object_evas_get(this->viewmgr->get_window()); - if (!e) - { - LOGE("Failed to get Evas from window"); - return false; - } - - Evas_Object *key_grab_rect = evas_object_rectangle_add(e); - if (!key_grab_rect) - { - LOGE("Failed to create a key grabber rectangle"); - return false; - } - - evas_object_event_callback_add(key_grab_rect, EVAS_CALLBACK_KEY_UP, [](void *data, Evas *e, Evas_Object *obj, void *event_info) -> void - { - Evas_Event_Key_Down *ev = static_cast(event_info); - ui_base_key_listener_impl *key_listener = static_cast(data); - key_grab_rect_key_up_cb(key_listener, ev); - }, this); - - if (!evas_object_key_grab(key_grab_rect, KEY_BACK, 0, 0, EINA_FALSE)) - { - LOGE("Failed to grab BACK KEY(%s)\n", KEY_BACK); - evas_object_del(key_grab_rect); - return false; - } - - if (!evas_object_key_grab(key_grab_rect, KEY_BACK2, 0, 0, EINA_FALSE)) - { - LOGE("Failed to grab BACK KEY(%s)\n", KEY_BACK2); - evas_object_del(key_grab_rect); - return false; - } - - this->key_grabber = key_grab_rect; - - return true; -} - - -/***********************************************************************************************/ -/* External class Implementation */ -/***********************************************************************************************/ - -ui_base_key_listener::ui_base_key_listener(ui_base_viewmgr *viewmgr) -{ - this->impl = new ui_base_key_listener_impl(this, viewmgr); -} - -ui_base_key_listener::~ui_base_key_listener() -{ - delete(this->impl); -} - -bool ui_base_key_listener::term() -{ - return this->impl->term(); -} - -bool ui_base_key_listener::init() -{ - return this->impl->init(); -} - -Evas_Object *ui_base_key_listener::get_keygrab_obj() -{ - return this->impl->get_keygrab_obj(); -} - - -ui_base_viewmgr *ui_base_key_listener::get_viewmgr() -{ - return this->impl->get_viewmgr(); -} diff --git a/src/lib/efl/ui_base_overlay.cpp b/src/lib/efl/ui_base_overlay.cpp deleted file mode 100644 index fc117e9..0000000 --- a/src/lib/efl/ui_base_overlay.cpp +++ /dev/null @@ -1,26 +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_base_viewmanager.h" - -ui_base_overlay::ui_base_overlay(ui_base_view *view) - : ui_iface_overlay(view) -{ -} - -ui_base_overlay::~ui_base_overlay() -{ -} diff --git a/src/lib/efl/ui_base_view.cpp b/src/lib/efl/ui_base_view.cpp deleted file mode 100644 index b5f8759..0000000 --- a/src/lib/efl/ui_base_view.cpp +++ /dev/null @@ -1,142 +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_base_viewmanager.h" - - -/***********************************************************************************************/ -/* Internal class Implementation */ -/***********************************************************************************************/ -namespace efl_viewmanager -{ -class ui_base_view_impl; -} - -/***********************************************************************************************/ -/* External class Implementation */ -/***********************************************************************************************/ - -static void content_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - ui_base_view *view = static_cast(data); - view->unset_content(); -} - -ui_base_view::ui_base_view(const char *name) - : ui_iface_view(name) -{ -} - -ui_base_view::~ui_base_view() -{ -} - -bool ui_base_view::set_content(Evas_Object *content) -{ - Evas_Object *pcontent = this->unset_content(); - if (pcontent) - { - evas_object_del(pcontent); - } - if (content) - { - evas_object_event_callback_add(content, EVAS_CALLBACK_DEL, content_del_cb, this); - ui_iface_view::set_content(content); - } - return true; -} - -Evas_Object *ui_base_view::unset_content() -{ - Evas_Object *obj = ui_iface_view::unset_content(); - if (obj) - { - evas_object_event_callback_del(obj, EVAS_CALLBACK_DEL, content_del_cb); - evas_object_hide(obj); - } - return obj; -} - -Evas_Object *ui_base_view::get_base() -{ - ui_base_viewmgr *viewmgr = UI_BASE_VIEWMGR; - if (!viewmgr) - { - return NULL; - } - return viewmgr->get_base(); -} - -Evas_Object *ui_base_view ::get_parent() -{ - ui_base_viewmgr *viewmgr = UI_BASE_VIEWMGR; - if (!viewmgr) - { - LOGE("Failed to get a viewmgr"); - return NULL; - } - return viewmgr->get_base(); -} - -void ui_base_view::set_indicator(ui_view_indicator indicator) -{ - if (this->get_indicator() == indicator) return; - - ui_iface_view::set_indicator(indicator); - - ui_base_viewmgr *viewmgr = UI_BASE_VIEWMGR; - if (!viewmgr) - { - LOGE("Failed to get a viewmgr"); - return; - } - - if (!viewmgr->is_activated()) return; - - if (viewmgr->get_last_view() != this) return; - - viewmgr->set_indicator(indicator); -} - -void ui_base_view::on_rotate(int degree) -{ -} - -void ui_base_view::on_portrait() -{ -} - -void ui_base_view::on_landscape() -{ -} - -void ui_base_view::set_event_block(bool block) -{ - ui_iface_view::set_event_block(block); - evas_object_freeze_events_set(this->get_content(), block); -} - -int ui_base_view::get_degree() -{ - ui_base_viewmgr *viewmgr = UI_BASE_VIEWMGR; - if (!viewmgr) - { - LOGE("Failed to get a viewmgr"); - return -1; - } - return elm_win_rotation_get(viewmgr->get_window()); -} - diff --git a/src/lib/efl/ui_base_viewmgr.cpp b/src/lib/efl/ui_base_viewmgr.cpp deleted file mode 100644 index 10d6b63..0000000 --- a/src/lib/efl/ui_base_viewmgr.cpp +++ /dev/null @@ -1,544 +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 -#include "../../include/efl/ui_base_viewmanager.h" - -using namespace std; - -/***********************************************************************************************/ -/* Internal class Implementation */ -/***********************************************************************************************/ -namespace efl_viewmanager -{ - -class ui_base_viewmgr_impl -{ - friend class ui_base_viewmgr; - -private: - ui_base_viewmgr *viewmgr; - Elm_Win *win; //This is acting like a base object of viewmgr. - Elm_Conformant *conform; //Conformant for viewmgr. - Elm_Scroller *scroller; //Scroller for viewmgr. - Elm_Layout *layout; //Viewmgr's base layout. - ui_base_key_listener *key_listener; //HW Key Handler such as "BACK" key... - ui_view_indicator indicator; //Mode of indicator. - string transition_style; //Current transition effect style name - map effect_map; //Map for effect layouts. - - Elm_Layout *set_transition_layout(string transition_style); - - bool create_conformant(Elm_Win *win); - bool create_scroller(Elm_Conformant *conform); - bool create_base_layout(Elm_Scroller *scroller, const char *style); - bool set_indicator(ui_view_indicator indicator); - void activate_top_view(); - bool init(); - bool term(); - -public: - ui_base_viewmgr_impl(ui_base_viewmgr *viewmgr, const char *pkg, ui_base_key_listener *key_listener); - ~ui_base_viewmgr_impl(); - - bool activate(); - bool deactivate(); - ui_base_view *push_view(ui_base_view *view); - bool pop_view(); - bool insert_view_before(ui_base_view *view, ui_base_view *before); - bool insert_view_after(ui_base_view *view, ui_base_view *after); - - Evas_Object *get_base() - { - return this->layout; - } - Elm_Win *get_window() - { - return this->win; - } - Elm_Conformant *get_conformant() - { - return this->conform; - } -}; - -} - -bool ui_base_viewmgr_impl::create_base_layout(Elm_Scroller *scroller, const char *style) -{ - char edj_path[PATH_MAX]; - char group_name[128]; - - Elm_Layout *layout = elm_layout_add(scroller); - if (!layout) return false; - - snprintf(group_name, sizeof(group_name), "transition/%s", style); - snprintf(edj_path, sizeof(edj_path), "%s/ui-viewmgr.edj", EDJ_PATH); - elm_layout_file_set(layout, edj_path, group_name); - evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_object_content_set(scroller, layout); - - //Push Finished Event - elm_layout_signal_callback_add(layout, "push,finished", "viewmgr", - [](void *data, Evas_Object *obj, const char *emission, const char *source) -> void - { - ui_base_viewmgr *viewmgr = static_cast(data); - ui_base_view *pview = viewmgr->get_view(viewmgr->get_view_count() - 2); - ui_base_view *view = viewmgr->get_last_view(); - if (pview) viewmgr->push_view_finished(pview); - if (view) viewmgr->push_view_finished(view); - }, - this->viewmgr); - - //Pop Finished Event - elm_layout_signal_callback_add(layout, "pop,finished", "viewmgr", - [](void *data, Evas_Object *obj, const char *emission, const char *source) -> void - { - ui_base_viewmgr *viewmgr = static_cast(data); - ui_base_view *pview = viewmgr->get_view(viewmgr->get_view_count() - 2); - ui_base_view *view = viewmgr->get_last_view(); - if (pview) viewmgr->pop_view_finished(pview); - if (view) viewmgr->pop_view_finished(view); - }, - this->viewmgr); - - this->layout = layout; - - return true; -} - -Elm_Layout *ui_base_viewmgr_impl::set_transition_layout(string transition_style) -{ - Elm_Layout *effect_layout = NULL; - Elm_Layout *pcontent; - - pcontent = elm_object_part_content_unset(this->get_base(), "pcontent"); - if (pcontent) evas_object_hide(pcontent); - elm_object_part_content_unset(this->get_base(), "content"); - - if (transition_style.compare(this->transition_style) == 0) return this->layout; - - if (effect_map.size()) effect_layout = effect_map.find(transition_style)->second; - - //Scroller content change to current effect layout and change to hide prev layout. - Elm_Layout *playout = elm_object_part_content_unset(this->scroller, NULL); - evas_object_hide(playout); - - if (!effect_layout) - { - //Create and add effect_layouts in map here. - //FIXME: If we have to support many effects, this logic should be changed. - effect_map.insert(pair("default", this->layout)); - this->create_base_layout(this->scroller, transition_style.c_str()); - effect_map.insert(pair(transition_style, this->layout)); - } else { - elm_object_content_set(this->scroller, effect_layout); - - this->layout = effect_layout; - } - - this->transition_style = transition_style; - - return this->layout; -} - -void ui_base_viewmgr_impl::activate_top_view() -{ - Evas_Object *pcontent = elm_object_part_content_unset(this->get_base(), "content"); - if (pcontent) evas_object_hide(pcontent); - - ui_base_view *view = this->viewmgr->get_last_view(); - - //In case of ui_base_view, it doesn't have any base form. It uses viewmgr base instead. - Evas_Object *content; - if (view->get_base() == this->get_base()) - { - content = view->get_content(); - } else { - content = view->get_base(); - } - - elm_object_part_content_set(this->get_base(), "content", content); - - this->set_indicator(view->get_indicator()); -} - -//FIXME: How to deal with indicator in other UI framework? Dali? Volt? -//Is it possible make this interface common? -bool ui_base_viewmgr_impl::set_indicator(ui_view_indicator indicator) -{ - if (this->indicator == indicator) return false; - this->indicator = indicator; - - Elm_Win *window = this->get_window(); - Elm_Conformant *conform = this->get_conformant(); - - switch (indicator) - { - case UI_VIEW_INDICATOR_DEFAULT: - elm_win_indicator_opacity_set(window, ELM_WIN_INDICATOR_OPAQUE); - elm_win_indicator_mode_set(window, ELM_WIN_INDICATOR_SHOW); - /* Unset if you set the Indicator BG */ - evas_object_del(elm_object_part_content_get(conform, "elm.swallow.indicator_bg")); - elm_object_signal_emit(conform, "elm,state,indicator,nooverlap", "elm"); - break; - case UI_VIEW_INDICATOR_OPTIMAL: - elm_win_indicator_mode_set(window, ELM_WIN_INDICATOR_SHOW); - elm_win_indicator_opacity_set(window, ELM_WIN_INDICATOR_TRANSPARENT); - break; - case UI_VIEW_INDICATOR_OVERLAP: - elm_win_indicator_mode_set(window, ELM_WIN_INDICATOR_SHOW); - elm_object_signal_emit(conform, "elm,state,indicator,overlap", "elm"); - break; - default: - elm_win_indicator_mode_set(window, ELM_WIN_INDICATOR_HIDE); - break; - } - return true; -} - -bool ui_base_viewmgr_impl::create_conformant(Elm_Win *win) -{ - Elm_Conformant *conform = elm_conformant_add(win); - if (!conform) return false; - - evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_win_resize_object_add(win, conform); - elm_win_conformant_set(win, EINA_TRUE); - evas_object_show(conform); - - this->conform = conform; - - return true; -} - -bool ui_base_viewmgr_impl::create_scroller(Elm_Conformant *conform) -{ - Elm_Scroller *scroller = elm_scroller_add(conform); - if (!scroller) return false; - - elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_AUTO); - evas_object_size_hint_weight_set(scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(scroller, EVAS_HINT_FILL, EVAS_HINT_FILL); - - elm_object_content_set(conform, scroller); - - this->scroller = scroller; - - return true; -} - -ui_base_viewmgr_impl::ui_base_viewmgr_impl(ui_base_viewmgr *viewmgr, const char *pkg, ui_base_key_listener *key_listener) - : viewmgr(viewmgr), key_listener(key_listener), transition_style("default") -{ - if (!pkg) - { - LOGE("Invalid package name"); - return; - } - - //Window - this->win = elm_win_util_standard_add(pkg, pkg); - - if (!this->win) - { - LOGE("Failed to create a window (%s)", pkg); - return; - } - - //FIXME: Make a method? to set available rotation degree. - //Set window rotation - if (elm_win_wm_rotation_supported_get(this->win)) - { - int rots[4] = - { 0, 90, 180, 270 }; - elm_win_wm_rotation_available_rotations_set(this->win, (const int *) (&rots), 4); - } - evas_object_smart_callback_add(this->win, "wm,rotation,changed", - [](void *data, Evas_Object *obj, void *event_info) -> void - { - int rot = elm_win_rotation_get(obj); - - ui_base_viewmgr *viewmgr = static_cast(data); - ui_base_view *view = viewmgr->get_last_view(); - view->on_rotate(rot); - - //FIXME: Change this configurable? - if (rot == 0 || rot == 180) view->on_portrait(); - else view->on_landscape(); - } - , this->viewmgr); - //Window is requested to delete. - evas_object_smart_callback_add(this->win, "delete,request", - [](void *data, Evas_Object *obj, void *event_info) -> void - { - ui_base_viewmgr *viewmgr = static_cast(data); - delete(viewmgr); - }, - this->viewmgr); - - //FIXME: Make conformant configurable? - if (!this->create_conformant(this->win)) - { - LOGE("Failed to create a conformant (%s)", pkg); - return; - } - - if (!this->create_scroller(this->conform)) - { - LOGE("Failed to create a scroller (%s)", pkg); - return; - } - - if (!this->create_base_layout(this->scroller, "default")) - { - LOGE("Failed to create a base layout (%s)", pkg); - return; - } - - //Set Indicator properties - elm_win_indicator_mode_set(this->win, ELM_WIN_INDICATOR_SHOW); - elm_win_indicator_opacity_set(this->win, ELM_WIN_INDICATOR_OPAQUE); - - elm_win_autodel_set(this->win, EINA_TRUE); -} - -ui_base_viewmgr_impl::~ui_base_viewmgr_impl() -{ - delete(this->key_listener); -} - -bool ui_base_viewmgr_impl::init() -{ - return this->key_listener->init(); -} - -bool ui_base_viewmgr_impl::term() -{ - return this->key_listener->term(); -} - -bool ui_base_viewmgr_impl::activate() -{ - this->activate_top_view(); - evas_object_show(this->win); - - return true; -} - -bool ui_base_viewmgr_impl::deactivate() -{ - //FIXME: based on the profile, we should app to go behind or terminate. - if (true) - { - evas_object_lower(this->win); - } else { - delete(this->viewmgr); - } - - return true; -} - -bool ui_base_viewmgr_impl::pop_view() -{ - ui_base_view *pview = this->viewmgr->get_view(this->viewmgr->get_view_count() - 2); - ui_base_view *view = this->viewmgr->get_last_view(); - - //In case, if view doesn't have any transition effects. - if (!strcmp(view->get_transition_style(), "none")) - { - this->viewmgr->pop_view_finished(pview); - this->viewmgr->pop_view_finished(view); - this->activate_top_view(); - return true; - } - - //Choose an effect layout. - Elm_Layout *effect = this->set_transition_layout(view->get_transition_style()); - if (!effect) { - LOGE("invalid effect transition style?! = %s", view->get_transition_style()); - this->viewmgr->pop_view_finished(pview); - this->viewmgr->pop_view_finished(view); - this->activate_top_view(); - return true; - } - - //Trigger Effects. - Evas_Object *prv = this->get_base() == pview->get_base() ? pview->get_content() : pview->get_base(); - elm_layout_content_set(effect, "content", prv); - - Evas_Object *cur = this->get_base() == view->get_base() ? view->get_content() : view->get_base(); - elm_layout_content_set(effect, "pcontent", cur); - - elm_layout_signal_emit(effect, "view,pop", "viewmgr"); - - this->set_indicator(pview->get_indicator()); - - return true; -} - -ui_base_view * ui_base_viewmgr_impl::push_view(ui_base_view *view) -{ - if (!this->viewmgr->is_activated()) return view; - - //In case, if viewmgr has one view, we skip effect. - if (this->viewmgr->get_view_count() == 1) { - this->activate_top_view(); - this->viewmgr->push_view_finished(view); - return view; - } - - ui_base_view *pview = this->viewmgr->get_view(this->viewmgr->get_view_count() - 2); - - //In case, if view doesn't have transition effect - if (!strcmp(view->get_transition_style(), "none")) { - this->activate_top_view(); - this->viewmgr->push_view_finished(pview); - this->viewmgr->push_view_finished(view); - return view; - } - - //Choose an effect layout. - Elm_Layout *effect = this->set_transition_layout(view->get_transition_style()); - if (!effect) { - LOGE("invalid effect transition style?! = %s", view->get_transition_style()); - this->activate_top_view(); - this->viewmgr->push_view_finished(pview); - this->viewmgr->push_view_finished(view); - return view; - } - - //Trigger Effects. - Evas_Object *prv = this->get_base() == pview->get_base() ? pview->get_content() : pview->get_base(); - elm_layout_content_set(effect, "pcontent", prv); - - Evas_Object *cur = this->get_base() == view->get_base() ? view->get_content() : view->get_base(); - elm_layout_content_set(effect, "content", cur); - - elm_layout_signal_emit(effect, "view,push", "viewmgr"); - - this->set_indicator(view->get_indicator()); - - return view; -} - -/***********************************************************************************************/ -/* External class Implementation */ -/***********************************************************************************************/ - -ui_base_viewmgr::ui_base_viewmgr(const char *pkg, ui_base_key_listener *key_listener) - : ui_iface_viewmgr() -{ - this->impl = new ui_base_viewmgr_impl(this, pkg, key_listener); - this->impl->init(); -} - -ui_base_viewmgr::ui_base_viewmgr(const char *pkg) - : ui_base_viewmgr(pkg, new ui_base_key_listener(this)) -{ -} - -ui_base_viewmgr::~ui_base_viewmgr() -{ - this->impl->term(); - delete(this->impl); - ui_app_exit(); -} - -bool ui_base_viewmgr::activate() -{ - if (!ui_iface_viewmgr::activate()) return false; - this->impl->activate(); - - return true; -} - -bool ui_base_viewmgr::deactivate() -{ - if (!ui_iface_viewmgr::deactivate()) return false; - this->impl->deactivate(); - - return true; -} - -bool ui_base_viewmgr::pop_view() -{ - if (this->get_view_count() == 1) - { - this->deactivate(); - return true; - } - - if(!ui_iface_viewmgr::pop_view()) - { - return false; - } - - return this->impl->pop_view(); -} - -ui_base_view * ui_base_viewmgr::push_view(ui_base_view *view) -{ - ui_iface_viewmgr::push_view(view); - - return this->impl->push_view(view); -} - -bool ui_base_viewmgr::insert_view_before(ui_base_view *view, ui_base_view *before) -{ - return ui_iface_viewmgr::insert_view_before(view, before); -} - -bool ui_base_viewmgr::insert_view_after(ui_base_view *view, ui_base_view *after) -{ - return ui_iface_viewmgr::insert_view_after(view, after); -} - -ui_base_view *ui_base_viewmgr::get_view(unsigned int idx) -{ - return dynamic_cast(ui_iface_viewmgr::get_view(idx)); -} - -ui_base_view *ui_base_viewmgr::get_view(const char *name) -{ - return dynamic_cast(ui_iface_viewmgr::get_view(name)); -} - -ui_base_view *ui_base_viewmgr::get_last_view() -{ - return dynamic_cast(ui_iface_viewmgr::get_last_view()); -} - -Evas_Object *ui_base_viewmgr::get_base() -{ - return this->impl->get_base(); -} -Elm_Win *ui_base_viewmgr::get_window() -{ - return this->impl->get_window(); -} -Elm_Conformant *ui_base_viewmgr::get_conformant() -{ - return this->impl->get_conformant(); -} - -bool ui_base_viewmgr::set_indicator(ui_view_indicator indicator) -{ - return this->impl->set_indicator(indicator); -} diff --git a/src/lib/interface/UiIfaceApp.cpp b/src/lib/interface/UiIfaceApp.cpp new file mode 100644 index 0000000..4acd0ac --- /dev/null +++ b/src/lib/interface/UiIfaceApp.cpp @@ -0,0 +1,325 @@ +/* + * 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 "../../include/interface/UiIfaceViewManager.h" + +/***********************************************************************************************/ +/* Internal class Implementation */ +/***********************************************************************************************/ +namespace ui_viewmanager +{ + +class UiIfaceAppImpl +{ +public: + friend class UiIfaceApp; + + UiIfaceApp *app; + UiIfaceViewmgr *viewmgr; + Eina_Stringshare *pkg; + Eina_Stringshare *locale_dir; + + UiIfaceAppImpl(UiIfaceApp *app, const char *pkg, const char *locale_dir, UiIfaceViewmgr* viewmgr); + ~UiIfaceAppImpl(); + + int run(int argc, char **argv); + + bool init(); + bool on_create(); + void on_terminate(); + void on_pause(); + void on_resume(); + void on_control(app_control_h app_control); + + void on_low_battery(app_event_info_h event_info); + void on_low_memory(app_event_info_h event_info); + void on_region_changed(app_event_info_h event_info); + void on_orient_changed(app_event_info_h event_info); + void on_lang_changed(app_event_info_h event_info); +}; + +} + +static bool app_create(void *data) +{ + UiIfaceAppImpl *app = static_cast(data); + return app->on_create(); +} + +static void app_terminate(void *data) +{ + UiIfaceAppImpl *app = static_cast(data); + app->on_terminate(); +} + +static void app_pause(void *data) +{ + UiIfaceAppImpl *app = static_cast(data); + app->on_pause(); +} + +static void app_resume(void *data) +{ + UiIfaceAppImpl *app = static_cast(data); + app->on_resume(); +} + +static void app_control(app_control_s *app_control, void *data) +{ + UiIfaceAppImpl *app = static_cast(data); + app->on_control(app_control); +} + +static void ui_app_lang_changed(app_event_info_h event_info, void *data) +{ + UiIfaceAppImpl *app = static_cast(data); + app->on_lang_changed(event_info); +} + +static void ui_app_orient_changed(app_event_info_h event_info, void *data) +{ + UiIfaceAppImpl *app = static_cast(data); + app->on_orient_changed(event_info); +} + +static void ui_app_region_changed(app_event_info_h event_info, void *data) +{ + UiIfaceAppImpl *app = static_cast(data); + app->on_region_changed(event_info); +} + +static void ui_app_low_battery(app_event_info_h event_info, void *data) +{ + UiIfaceAppImpl *app = static_cast(data); + app->on_low_battery(event_info); +} + +static void ui_app_low_memory(app_event_info_h event_info, void *data) +{ + UiIfaceAppImpl *app = static_cast(data); + app->on_low_memory(event_info); +} + +bool UiIfaceAppImpl::init() +{ + /* Bind package locale file */ + bindtextdomain(this->pkg, this->locale_dir); + textdomain(this->pkg); + + return true; +} + +UiIfaceAppImpl::UiIfaceAppImpl(UiIfaceApp *app, const char *pkg, const char *locale_dir, UiIfaceViewmgr *viewmgr) + : app(app), viewmgr(viewmgr) +{ + this->pkg = eina_stringshare_add(pkg); + this->locale_dir = eina_stringshare_add(locale_dir); +} + +int UiIfaceAppImpl::run(int argc, char **argv) +{ + ui_app_lifecycle_callback_s event_callback = { 0, }; + app_event_handler_h handlers[5] = { NULL, }; + + event_callback.create = app_create; + event_callback.terminate = app_terminate; + event_callback.pause = app_pause; + event_callback.resume = app_resume; + event_callback.app_control = app_control; + + ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, this); + ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, this); + ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, this); + ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, this); + ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, this); + + int ret = ui_app_main(argc, argv, &event_callback, this); + + if (ret != APP_ERROR_NONE) + { + LOGE("ui_app_main() is failed. err = %d", ret); + } + + return ret; +} + +UiIfaceAppImpl::~UiIfaceAppImpl() +{ + delete (this->viewmgr); + eina_stringshare_del(this->pkg); + eina_stringshare_del(this->locale_dir); +} + +void UiIfaceAppImpl::on_lang_changed(app_event_info_h event_info) +{ + this->app->on_lang_changed(event_info); +} + +void UiIfaceAppImpl::on_low_memory(app_event_info_h event_info) +{ + this->app->on_low_memory(event_info); +} + +void UiIfaceAppImpl::on_low_battery(app_event_info_h event_info) +{ + this->app->on_low_battery(event_info); +} + +void UiIfaceAppImpl::on_region_changed(app_event_info_h event_info) +{ + this->app->on_region_changed(event_info); +} + +void UiIfaceAppImpl::on_orient_changed(app_event_info_h event_info) +{ + this->app->on_orient_changed(event_info); +} + +bool UiIfaceAppImpl::on_create() +{ + return this->app->on_create(); +} + +void UiIfaceAppImpl::on_pause() +{ + this->app->on_pause(); +} + +void UiIfaceAppImpl::on_resume() +{ + this->app->on_resume(); +} + +void UiIfaceAppImpl::on_control(app_control_h app_control) +{ + this->app->on_control(app_control); +} + +void UiIfaceAppImpl::on_terminate() +{ + this->app->on_terminate(); +} + +/***********************************************************************************************/ +/* External class Implementation */ +/***********************************************************************************************/ + +static UiIfaceApp *inst = NULL; + +void UiIfaceApp::on_lang_changed(app_event_info_h event_info) +{ + char *language = NULL; + int ret = app_event_get_language(event_info, &language); + if (ret != APP_ERROR_NONE) { + dlog_print(DLOG_ERROR, LOG_TAG, "app_event_get_language() failed. Err = %d.", ret); + return; + } + + if (language != NULL) { + elm_language_set(language); + UiIfaceView *view = this->impl->viewmgr->get_last_view(); + view->on_language_changed(language); + free(language); + } +} + +void UiIfaceApp::on_low_memory(app_event_info_h event_info) +{ + UiIfaceView *view = this->impl->viewmgr->get_last_view(); + view->on_low_memory(); +} + +void UiIfaceApp::on_low_battery(app_event_info_h event_info) +{ + UiIfaceView *view = this->impl->viewmgr->get_last_view(); + view->on_low_battery(); +} + +void UiIfaceApp::on_region_changed(app_event_info_h event_info) +{ + char *region = NULL; + int ret = app_event_get_region_format(event_info, ®ion); + if (ret != APP_ERROR_NONE) { + dlog_print(DLOG_ERROR, LOG_TAG, "model_app_event_get_region_format() failed. Err = %d", ret); + return; + } + + UiIfaceView *view = this->impl->viewmgr->get_last_view(); + view->on_region_changed(region); +} + +void UiIfaceApp::on_orient_changed(app_event_info_h event_info) +{ +} + +bool UiIfaceApp::on_create() +{ + return this->impl->init(); +} + +void UiIfaceApp::on_pause() +{ + this->impl->viewmgr->deactivate(); +} + +void UiIfaceApp::on_resume() +{ +// this->impl->viewmgr->activate(); +} + +void UiIfaceApp::on_control(app_control_h app_control) +{ + /* Handle the launch request. */ + this->impl->viewmgr->activate(); +} + +void UiIfaceApp::on_terminate() +{ + delete(this); +} + +UiIfaceApp::UiIfaceApp(const char *pkg, const char *locale_dir, UiIfaceViewmgr *viewmgr) +{ + if (inst) + { + LOGE("You created UiIfaceApp multiple times!!"); + } + inst = this; + + this->impl = new UiIfaceAppImpl(this, pkg, locale_dir, viewmgr); +} + +int UiIfaceApp::run(int argc, char **argv) +{ + return this->impl->run(argc, argv); +} + +UiIfaceApp::~UiIfaceApp() +{ + delete (this->impl); + inst = NULL; +} + +UiIfaceViewmgr *UiIfaceApp::get_viewmgr() +{ + return this->impl->viewmgr; +} + +UiIfaceApp *UiIfaceApp::get_instance() +{ + return inst; +} diff --git a/src/lib/interface/UiIfaceOverlay.cpp b/src/lib/interface/UiIfaceOverlay.cpp new file mode 100644 index 0000000..4d4f3d1 --- /dev/null +++ b/src/lib/interface/UiIfaceOverlay.cpp @@ -0,0 +1,132 @@ +/* + * 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/UiIfaceViewManager.h" + + +/***********************************************************************************************/ +/* Internal class Implementation */ +/***********************************************************************************************/ +namespace ui_viewmanager +{ + +class UiIfaceOverlayImpl +{ + friend class UiIfaceOverlay; + +private: + UiIfaceOverlay *overlay; + UiIfaceView *view; + T content; + +public: + bool set_content(T content); + T unset_content(); + UiIfaceView *get_view(); + T get_content(); + + UiIfaceOverlayImpl(UiIfaceOverlay *overlay, UiIfaceView *view); + ~UiIfaceOverlayImpl(); +}; + +} + +UiIfaceOverlayImpl::UiIfaceOverlayImpl(UiIfaceOverlay *overlay, UiIfaceView *view) + : overlay(overlay), view(view), content(NULL) +{ +} + +UiIfaceOverlayImpl::~UiIfaceOverlayImpl() +{ +} + +bool UiIfaceOverlayImpl::set_content(T content) +{ + this->content = content; + return true; +} + +T UiIfaceOverlayImpl::unset_content() +{ + T prev = this->content; + this->content = NULL; + return prev; +} + +T UiIfaceOverlayImpl::get_content() +{ + return this->content; +} + +UiIfaceView *UiIfaceOverlayImpl::get_view() +{ + return this->view; +} + + +/***********************************************************************************************/ +/* External class Implementation */ +/***********************************************************************************************/ +UiIfaceOverlay::UiIfaceOverlay(UiIfaceView *view) +{ + this->impl = new UiIfaceOverlayImpl(this, view); +} + +UiIfaceOverlay::~UiIfaceOverlay() +{ + delete(this->impl); +} + +bool UiIfaceOverlay::set_content(T content) +{ + return this->impl->set_content(content); +} + +T UiIfaceOverlay::unset_content() +{ + return this->impl->unset_content(); +} + +T UiIfaceOverlay::get_content() +{ + return this->impl->get_content(); +} + +UiIfaceView *UiIfaceOverlay::get_view() +{ + return this->impl->get_view(); +} + +void UiIfaceOverlay::on_back() +{ + this->deactivate(); +} + +bool UiIfaceOverlay::activate() +{ + return true; +} + +bool UiIfaceOverlay::deactivate() +{ + return true; +} + +bool UiIfaceOverlay::is_activated() +{ + return true; +} diff --git a/src/lib/interface/UiIfaceView.cpp b/src/lib/interface/UiIfaceView.cpp new file mode 100644 index 0000000..fb4a1ca --- /dev/null +++ b/src/lib/interface/UiIfaceView.cpp @@ -0,0 +1,353 @@ +/* + * 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/UiIfaceViewManager.h" + +#include + +using namespace std; + +/***********************************************************************************************/ +/* Internal class Implementation */ +/***********************************************************************************************/ +namespace ui_viewmanager +{ + +class UiIfaceViewImpl +{ + friend class UiIfaceViewmgrImpl; + friend class UiIfaceView; + +private: + UiIfaceView *view; + T content; ///< A content instance for a screen as a view. + string name; ///< View name. + string transition_style; ///< View transition style name. + UiIfaceViewmgr *viewmgr; ///< Viewmgr which this view belongs to. + UiViewState state; ///< View state. + UiViewIndicator indicator; ///< View indicator mode. + bool event_block; ///< State of event block. + bool removable_content; ///< When this value is true, view removes it's content internally on unload state. + +public: + void set_event_block(bool block); + void on_load(); + void on_unload(); + void on_activate(); + void on_deactivate(); + void on_pause(); + void on_resume(); + void on_destroy(); + bool get_event_block(); + bool set_content(T content); + T unset_content(); + + UiIfaceViewImpl(UiIfaceView *view, const char *name); + ~UiIfaceViewImpl(); + + bool set_transition_style(const char *style); + void set_removable_content(bool removable); + void set_indicator(UiViewIndicator indicator); + const char *get_transition_style(); + const char *get_name(); + T get_content(); + UiViewState get_state(); + bool get_removable_content(); + UiViewIndicator get_indicator(); + void on_back(); +}; + +} + +bool UiIfaceViewImpl::get_event_block() +{ + return this->event_block; +} + +void UiIfaceViewImpl::set_event_block(bool block) +{ + this->event_block = block; +} + +void UiIfaceViewImpl::on_load() +{ + this->state = UI_VIEW_STATE_LOAD; +} + +void UiIfaceViewImpl::on_unload() +{ + this->state = UI_VIEW_STATE_UNLOAD; + if (this->get_removable_content()) + { + this->set_content(NULL); + return; + } +} + +void UiIfaceViewImpl::on_activate() +{ + this->state = UI_VIEW_STATE_ACTIVATE; +} + +void UiIfaceViewImpl::on_deactivate() +{ + this->state = UI_VIEW_STATE_DEACTIVATE; +} + +void UiIfaceViewImpl::on_pause() +{ + this->state = UI_VIEW_STATE_PAUSE; +} + +void UiIfaceViewImpl::on_resume() +{ + this->state = UI_VIEW_STATE_ACTIVATE; +} + +void UiIfaceViewImpl::on_destroy() +{ +} + +UiIfaceViewImpl::UiIfaceViewImpl(UiIfaceView *view, const char *name) + : view(view), 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; +} + +UiIfaceViewImpl::~UiIfaceViewImpl() +{ + this->viewmgr->remove_view(this->view); +} + +bool UiIfaceViewImpl::set_content(T content) +{ + this->content = content; + return true; +} + +T UiIfaceViewImpl::unset_content() +{ + T prev = this->content; + this->content = NULL; + return prev; +} + +bool UiIfaceViewImpl::set_transition_style(const char *style) +{ + this->transition_style.assign(style); + return true; +} + +void UiIfaceViewImpl::set_removable_content(bool removable) +{ + this->removable_content = removable; + + //FIXME: If this api is called on unload state? should we remove content right now? +} + +void UiIfaceViewImpl::set_indicator(UiViewIndicator indicator) +{ + this->indicator = indicator; +} + +const char *UiIfaceViewImpl::get_transition_style() +{ + return this->transition_style.c_str(); +} + +const char *UiIfaceViewImpl::get_name() +{ + return this->name.c_str(); +} + +T UiIfaceViewImpl::get_content() +{ + return this->content; +} + +UiViewState UiIfaceViewImpl::get_state() +{ + return this->state; +} + +bool UiIfaceViewImpl::get_removable_content() +{ + return this->removable_content; +} + +UiViewIndicator UiIfaceViewImpl::get_indicator() +{ + return this->indicator; +} + +void UiIfaceViewImpl::on_back() +{ + UiIfaceViewmgr *viewmgr = this->viewmgr; + if (!viewmgr) + { + LOGE("Failed to get a viewmgr, view =%p", this); + return; + } + viewmgr->pop_view(); +} + +/***********************************************************************************************/ +/* External class Implementation */ +/***********************************************************************************************/ + +bool UiIfaceView::get_event_block() +{ + return this->impl->get_event_block(); +} + +void UiIfaceView::set_event_block(bool block) +{ + this->impl->set_event_block(block); +} + +void UiIfaceView::on_load() +{ + this->impl->on_load(); +} + +void UiIfaceView::on_unload() +{ + this->impl->on_unload(); +} + +void UiIfaceView::on_activate() +{ + this->impl->on_activate(); +} + +void UiIfaceView::on_deactivate() +{ + this->impl->on_deactivate(); +} + +void UiIfaceView::on_pause() +{ + this->impl->on_pause(); +} + +void UiIfaceView::on_resume() +{ + this->impl->on_resume(); +} + +void UiIfaceView::on_destroy() +{ + this->impl->on_destroy(); +} + +UiIfaceView::UiIfaceView(const char *name) +{ + this->impl = new UiIfaceViewImpl(this, name); +} + +UiIfaceView::~UiIfaceView() +{ + delete(this->impl); +} + +bool UiIfaceView::set_content(T content) +{ + return this->impl->set_content(content); +} + +T UiIfaceView::unset_content() +{ + return this->impl->unset_content(); +} + +bool UiIfaceView::set_transition_style(const char *style) +{ + return this->impl->set_transition_style(style); +} + +void UiIfaceView::set_removable_content(bool removable) +{ + this->impl->set_removable_content(removable); +} + +void UiIfaceView::set_indicator(UiViewIndicator indicator) +{ + this->impl->set_indicator(indicator); +} + +const char *UiIfaceView::get_transition_style() +{ + return this->impl->get_transition_style(); +} + +const char *UiIfaceView::get_name() +{ + return this->impl->get_name(); +} + +T UiIfaceView::get_content() +{ + return this->impl->get_content(); +} + +UiViewState UiIfaceView::get_state() +{ + return this->impl->get_state(); +} + +bool UiIfaceView::get_removable_content() +{ + return this->impl->get_removable_content(); +} + +UiViewIndicator UiIfaceView::get_indicator() +{ + return this->impl->get_indicator(); +} + +void UiIfaceView::on_back() +{ + this->impl->on_back(); +} + +bool UiIfaceView::set_viewmgr(UiIfaceViewmgr *viewmgr) +{ + this->impl->viewmgr = viewmgr; + return true; +} + +UiIfaceViewmgr *UiIfaceView::get_viewmgr() +{ + return this->impl->viewmgr; +} + +void UiIfaceView::on_low_memory() +{ +} + +void UiIfaceView::on_low_battery() +{ +} + +void UiIfaceView::on_region_changed(const char *region) +{ +} + +void UiIfaceView::on_language_changed(const char *language) +{ +} diff --git a/src/lib/interface/UiIfaceViewmgr.cpp b/src/lib/interface/UiIfaceViewmgr.cpp new file mode 100644 index 0000000..af349a0 --- /dev/null +++ b/src/lib/interface/UiIfaceViewmgr.cpp @@ -0,0 +1,563 @@ +/* + * 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 +#include "../../include/interface/UiIfaceViewManager.h" + +using namespace std; + +/***********************************************************************************************/ +/* Internal class Implementation */ +/***********************************************************************************************/ +namespace ui_viewmanager +{ + +class UiIfaceViewmgrImpl +{ + friend class UiIfaceViewImpl; + friend class UiIfaceViewmgr; + +private: + static UiIfaceViewmgr *inst; + static bool soft_key; //If system doesn't support HW back key, then this value is @c true. + static bool event_block; //Event block on view transition. This value should be configurable by system. + list view_list; //View list. + bool activated; //Activated status of this viewmgr. + bool destroying; //True, if viewmgr is on destroying. + +public: + bool connect_view(UiIfaceView *view); + bool disconnect_view(UiIfaceView *view); + void set_event_block(UiIfaceView *view, bool block); + + bool push_view_finished(UiIfaceView *view); + bool pop_view_finished(UiIfaceView *view); + UiIfaceView *push_view(UiIfaceView *view); + bool pop_view(); + bool insert_view_before(UiIfaceView *view, UiIfaceView *before); + bool insert_view_after(UiIfaceView *view, UiIfaceView *after); + bool remove_view(UiIfaceView *view); + UiIfaceView* get_view(unsigned int idx); + UiIfaceView *get_view(const char *name); + UiIfaceView *get_last_view(); + int get_view_index(const UiIfaceView *view); + + UiIfaceViewmgrImpl(UiIfaceViewmgr *viewmgr); + ~UiIfaceViewmgrImpl(); + + bool activate(); + bool deactivate(); + bool is_activated(); + unsigned int get_view_count(); + static bool need_soft_key(); + static UiIfaceViewmgr* get_instance(); +}; + +} + +UiIfaceViewmgr* UiIfaceViewmgrImpl::inst = NULL; +//FIXME: Read system profile to decide whether support software key or not. +bool UiIfaceViewmgrImpl::soft_key = true; +//FIXME: Read system profile to decide whether support event block or not. +bool UiIfaceViewmgrImpl::event_block = true; + +#define VIEW_ITR list::iterator +#define VIEW_RITR list::reverse_iterator + +bool UiIfaceViewmgrImpl::insert_view_after(UiIfaceView *view, UiIfaceView *after) +{ + VIEW_ITR it; + + if (!view) + { + LOGE("invalid view argument. view(NULL)"); + return false; + } + + if (!this->connect_view(view)) + { + LOGE("connect view failed"); + return false; + } + + if (this->view_list.size() > 0) + { + for (it = this->view_list.begin(); it != this->view_list.end(); it++) + { + if (after == *it) + { + //If the after is a last item of list. + //view has to push now. + if (it == this->view_list.end()) + this->push_view(view); + else + this->view_list.insert(++it, view); + + return true; + } + } + } + + //If there is no matching after view with current list. + //also in case of after is NULL. + this->push_view(view); + + return true; +} + +bool UiIfaceViewmgrImpl::need_soft_key() +{ + return UiIfaceViewmgrImpl::soft_key; +} + +bool UiIfaceViewmgrImpl::connect_view(UiIfaceView *view) +{ + //TODO: Perform this only in debug mode? + //Check whether the same name of this view is already existed in this viewmgr? + int name_len = strlen(view->get_name()); + const char *name = view->get_name(); + + for (VIEW_ITR it = this->view_list.begin(); it != this->view_list.end(); it++) + { + UiIfaceView *view = *it; + const char *view_name = view->get_name(); + if (!view_name) continue; + int view_name_len = strlen(view_name); + + //Got you! + if ((view_name_len == name_len) && !strcmp(name, view_name)) + { + LOGE("the same name of UiIfaceView(%p) is already in this UiIfaceViewmgr(%p)", view, this); + return false; + } + } + + return view->set_viewmgr(this->get_instance()); +} + +bool UiIfaceViewmgrImpl::disconnect_view(UiIfaceView *view) +{ + if (!view->get_viewmgr()) return false; + view->set_viewmgr(NULL); + return true; +} + +void UiIfaceViewmgrImpl::set_event_block(UiIfaceView *view, bool block) +{ + if (!UiIfaceViewmgrImpl::event_block) return; + view->set_event_block(block); +} + +bool UiIfaceViewmgrImpl::push_view_finished(UiIfaceView *view) +{ + UiIfaceView *last = this->view_list.back(); + + //The previous view has been pushed. This should be unload. + if (last != view) + { + view->on_unload(); + return true; + } + + //A new view has been pushed. This should be activate. + view->on_activate(); + this->set_event_block(view, false); + + return true; +} + +bool UiIfaceViewmgrImpl::pop_view_finished(UiIfaceView *view) +{ + UiIfaceView *last = this->view_list.back(); + + //This view has been popped. It should be destroyed. + if (last == view) + { + view->on_unload(); + view->on_destroy(); + delete (view); + return true; + } + + //The previous view has been popped. It should become activate. + view->on_activate(); + this->set_event_block(view, false); + + return true; +} + +UiIfaceViewmgrImpl::UiIfaceViewmgrImpl(UiIfaceViewmgr* viewmgr) + : activated(false), destroying(false) +{ + UiIfaceViewmgrImpl::inst = viewmgr; +} + +UiIfaceViewmgrImpl::~UiIfaceViewmgrImpl() +{ + //Terminate views + this->destroying = EINA_TRUE; + for (VIEW_RITR ritr = this->view_list.rbegin(); ritr != this->view_list.rend(); ritr++) + { + UiIfaceView *view = *ritr; + if ((view->get_state() != UI_VIEW_STATE_DEACTIVATE) && + (view->get_state() != UI_VIEW_STATE_UNLOAD)) + { + view->on_deactivate(); + } + if (view->get_state() != UI_VIEW_STATE_UNLOAD) + { + view->on_unload(); + } + view->on_destroy(); + delete (view); + } + this->destroying = EINA_FALSE; + + ui_app_exit(); + + UiIfaceViewmgrImpl::inst = NULL; +} + +UiIfaceView *UiIfaceViewmgrImpl::push_view(UiIfaceView *view) +{ + if (!view) + { + LOGE("invalid view argument. view(NULL)"); + return NULL; + } + + if (!this->connect_view(view)) + { + LOGE("connect view failed"); + return NULL; + } + + UiIfaceView *pview; + + //Previous view + if (this->view_list.size() > 0) + { + pview = this->view_list.back(); + pview->on_deactivate(); + this->set_event_block(pview, true); + } + + this->view_list.push_back(view); + + //If view manager is not activated yet, don't load view. + if (!this->is_activated()) return view; + + view->on_load(); + view->on_deactivate(); + + if (this->view_list.size() != 1) + { + this->set_event_block(view, true); + } + + return view; +} + +bool UiIfaceViewmgrImpl::pop_view() +{ + //last page to be popped. + UiIfaceView*view = this->view_list.back(); + + if (view->get_event_block()) + { + return false; + } + + //FIXME: No more view? + if (this->get_view_count() == 0) + { + LOGE("No Views. Can't pop anymore!"); + return false; + } + + //This is the last page. + if (this->get_view_count() == 1) + { + //destroy viewmgr? + UiIfaceView*view = this->view_list.back(); + view->on_deactivate(); + view->on_unload(); + view->on_destroy(); + delete(view); + + return true; + } + + view->on_deactivate(); + this->set_event_block(view, true); + + //Below object has to be used in child class... + //Make this getter method? or define instance? + //previous page is to be an active page. + auto nx = prev(this->view_list.end(), 2); + UiIfaceView*pview = *nx; + pview->on_load(); + pview->on_deactivate(); + this->set_event_block(pview, true); + + return true; +} + +bool UiIfaceViewmgrImpl::insert_view_before(UiIfaceView *view, UiIfaceView *before) +{ + VIEW_ITR it; + + if (!view) + { + LOGE("invalid view argument. view(NULL)"); + return false; + } + + if (!this->connect_view(view)) + { + LOGE("connect view failed"); + return false; + } + + if (this->view_list.size() > 0) + { + for (it = this->view_list.begin(); it != this->view_list.end(); it++) + { + if (before == *it) + { + this->view_list.insert(it, view); + + return true; + } + } + } + + //If there is no matching before view with current list. + //also in case of before is NULL. + this->push_view(view); + + return true; +} + +bool UiIfaceViewmgrImpl::remove_view(UiIfaceView *view) +{ + if (this->destroying) return false; + + this->view_list.remove(view); + this->disconnect_view(view); + + //TODO: If this view is the top on the stack ? + return true; +} + +UiIfaceView *UiIfaceViewmgrImpl::get_view(unsigned int idx) +{ + if (idx < 0 || idx >= this->view_list.size()) + { + LOGE("Invalid idx(%d)! =? (idx range: %d ~ %d)", idx, 0, this->view_list.size() - 1); + return NULL; + } + VIEW_ITR it = this->view_list.begin(); + advance(it, idx); + return *it; +} + +int UiIfaceViewmgrImpl::get_view_index(const UiIfaceView *view) +{ + int idx = 0; + + for (VIEW_ITR it = this->view_list.begin(); it != this->view_list.end(); it++) + { + if (view == *it) return idx; + ++idx; + } + + return -1; +} + +UiIfaceView *UiIfaceViewmgrImpl::get_last_view() +{ + int cnt = this->get_view_count(); + return this->get_view(cnt - 1); +} + +bool UiIfaceViewmgrImpl::activate() +{ + if (this->activated) return false; + if (this->get_view_count() == 0) return false; + this->activated = true; + UiIfaceView *view = this->get_last_view(); + view->on_load(); + view->on_deactivate(); + view->on_activate(); + return true; +} + +bool UiIfaceViewmgrImpl::deactivate() +{ + if (!this->activated) return false; + this->activated = false; + UiIfaceView *view = this->get_last_view(); + + if ((view->get_state() != UI_VIEW_STATE_DEACTIVATE) && + (view->get_state() != UI_VIEW_STATE_UNLOAD)) + { + view->on_deactivate(); + } + if (view->get_state() != UI_VIEW_STATE_UNLOAD) + { + view->on_unload(); + } + + return true; +} + +UiIfaceView *UiIfaceViewmgrImpl::get_view(const char *name) +{ + if (!name) return NULL; + int name_len = strlen(name); + + for (VIEW_ITR it = this->view_list.begin(); it != this->view_list.end(); it++) + { + UiIfaceView *view = *it; + const char *view_name = view->get_name(); + if (!view_name) continue; + int view_name_len = strlen(view_name); + + //Got you! + if ((view_name_len == name_len) && !strcmp(name, view_name)) + { + return view; + } + } + + return NULL; +} + +bool UiIfaceViewmgrImpl::is_activated() +{ + return this->activated; +} + +unsigned int UiIfaceViewmgrImpl::get_view_count() +{ + return this->view_list.size(); +} + +UiIfaceViewmgr* UiIfaceViewmgrImpl::get_instance() +{ + return UiIfaceViewmgrImpl::inst; +} + +/***********************************************************************************************/ +/* External class Implementation */ +/***********************************************************************************************/ +bool UiIfaceViewmgr::insert_view_after(UiIfaceView *view, UiIfaceView *after) +{ + return this->impl->insert_view_after(view, after); +} + +bool UiIfaceViewmgr::need_soft_key() +{ + return UiIfaceViewmgrImpl::need_soft_key(); +} + +bool UiIfaceViewmgr::push_view_finished(UiIfaceView *view) +{ + return this->impl->push_view_finished(view); +} + +bool UiIfaceViewmgr::pop_view_finished(UiIfaceView *view) +{ + return this->impl->pop_view_finished(view); +} + +UiIfaceViewmgr::UiIfaceViewmgr() +{ + this->impl = new UiIfaceViewmgrImpl(this); +} + +UiIfaceViewmgr::~UiIfaceViewmgr() +{ + delete(this->impl); +} + +UiIfaceView *UiIfaceViewmgr::push_view(UiIfaceView *view) +{ + return this->impl->push_view(view); +} + +bool UiIfaceViewmgr::pop_view() +{ + return this->impl->pop_view(); +} + +bool UiIfaceViewmgr::insert_view_before(UiIfaceView *view, UiIfaceView *before) +{ + return this->impl->insert_view_before(view, before); +} + +bool UiIfaceViewmgr::remove_view(UiIfaceView *view) +{ + return this->impl->remove_view(view); +} + +UiIfaceView *UiIfaceViewmgr::get_view(unsigned int idx) +{ + return this->impl->get_view(idx); +} + +int UiIfaceViewmgr::get_view_index(const UiIfaceView *view) +{ + return this->get_view_index(view); +} + +UiIfaceView *UiIfaceViewmgr::get_last_view() +{ + return this->impl->get_last_view(); +} + +bool UiIfaceViewmgr::activate() +{ + return this->impl->activate(); +} + +bool UiIfaceViewmgr::deactivate() +{ + return this->impl->deactivate(); +} + +UiIfaceView *UiIfaceViewmgr::get_view(const char *name) +{ + return this->impl->get_view(name); +} + +bool UiIfaceViewmgr::is_activated() +{ + return this->impl->is_activated(); +} + +unsigned int UiIfaceViewmgr::get_view_count() +{ + return this->impl->get_view_count(); +} + +UiIfaceViewmgr* UiIfaceViewmgr::get_instance() +{ + return UiIfaceViewmgrImpl::get_instance(); +} diff --git a/src/lib/interface/ui_iface_app.cpp b/src/lib/interface/ui_iface_app.cpp deleted file mode 100644 index 2896ae6..0000000 --- a/src/lib/interface/ui_iface_app.cpp +++ /dev/null @@ -1,325 +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 "../../include/interface/ui_iface_viewmanager.h" - -/***********************************************************************************************/ -/* Internal class Implementation */ -/***********************************************************************************************/ -namespace ui_viewmanager -{ - -class ui_iface_app_impl -{ -public: - friend class ui_iface_app; - - ui_iface_app *app; - ui_iface_viewmgr *viewmgr; - Eina_Stringshare *pkg; - Eina_Stringshare *locale_dir; - - ui_iface_app_impl(ui_iface_app *app, const char *pkg, const char *locale_dir, ui_iface_viewmgr* viewmgr); - ~ui_iface_app_impl(); - - int run(int argc, char **argv); - - bool init(); - bool on_create(); - void on_terminate(); - void on_pause(); - void on_resume(); - void on_control(app_control_h app_control); - - void on_low_battery(app_event_info_h event_info); - void on_low_memory(app_event_info_h event_info); - void on_region_changed(app_event_info_h event_info); - void on_orient_changed(app_event_info_h event_info); - void on_lang_changed(app_event_info_h event_info); -}; - -} - -static bool app_create(void *data) -{ - ui_iface_app_impl *app = static_cast(data); - return app->on_create(); -} - -static void app_terminate(void *data) -{ - ui_iface_app_impl *app = static_cast(data); - app->on_terminate(); -} - -static void app_pause(void *data) -{ - ui_iface_app_impl *app = static_cast(data); - app->on_pause(); -} - -static void app_resume(void *data) -{ - ui_iface_app_impl *app = static_cast(data); - app->on_resume(); -} - -static void app_control(app_control_s *app_control, void *data) -{ - ui_iface_app_impl *app = static_cast(data); - app->on_control(app_control); -} - -static void ui_app_lang_changed(app_event_info_h event_info, void *data) -{ - ui_iface_app_impl *app = static_cast(data); - app->on_lang_changed(event_info); -} - -static void ui_app_orient_changed(app_event_info_h event_info, void *data) -{ - ui_iface_app_impl *app = static_cast(data); - app->on_orient_changed(event_info); -} - -static void ui_app_region_changed(app_event_info_h event_info, void *data) -{ - ui_iface_app_impl *app = static_cast(data); - app->on_region_changed(event_info); -} - -static void ui_app_low_battery(app_event_info_h event_info, void *data) -{ - ui_iface_app_impl *app = static_cast(data); - app->on_low_battery(event_info); -} - -static void ui_app_low_memory(app_event_info_h event_info, void *data) -{ - ui_iface_app_impl *app = static_cast(data); - app->on_low_memory(event_info); -} - -bool ui_iface_app_impl::init() -{ - /* Bind package locale file */ - bindtextdomain(this->pkg, this->locale_dir); - textdomain(this->pkg); - - return true; -} - -ui_iface_app_impl::ui_iface_app_impl(ui_iface_app *app, const char *pkg, const char *locale_dir, ui_iface_viewmgr *viewmgr) - : app(app), viewmgr(viewmgr) -{ - this->pkg = eina_stringshare_add(pkg); - this->locale_dir = eina_stringshare_add(locale_dir); -} - -int ui_iface_app_impl::run(int argc, char **argv) -{ - ui_app_lifecycle_callback_s event_callback = { 0, }; - app_event_handler_h handlers[5] = { NULL, }; - - event_callback.create = app_create; - event_callback.terminate = app_terminate; - event_callback.pause = app_pause; - event_callback.resume = app_resume; - event_callback.app_control = app_control; - - ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, this); - ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, this); - ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, this); - ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, this); - ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, this); - - int ret = ui_app_main(argc, argv, &event_callback, this); - - if (ret != APP_ERROR_NONE) - { - LOGE("ui_app_main() is failed. err = %d", ret); - } - - return ret; -} - -ui_iface_app_impl::~ui_iface_app_impl() -{ - delete (this->viewmgr); - eina_stringshare_del(this->pkg); - eina_stringshare_del(this->locale_dir); -} - -void ui_iface_app_impl::on_lang_changed(app_event_info_h event_info) -{ - this->app->on_lang_changed(event_info); -} - -void ui_iface_app_impl::on_low_memory(app_event_info_h event_info) -{ - this->app->on_low_memory(event_info); -} - -void ui_iface_app_impl::on_low_battery(app_event_info_h event_info) -{ - this->app->on_low_battery(event_info); -} - -void ui_iface_app_impl::on_region_changed(app_event_info_h event_info) -{ - this->app->on_region_changed(event_info); -} - -void ui_iface_app_impl::on_orient_changed(app_event_info_h event_info) -{ - this->app->on_orient_changed(event_info); -} - -bool ui_iface_app_impl::on_create() -{ - return this->app->on_create(); -} - -void ui_iface_app_impl::on_pause() -{ - this->app->on_pause(); -} - -void ui_iface_app_impl::on_resume() -{ - this->app->on_resume(); -} - -void ui_iface_app_impl::on_control(app_control_h app_control) -{ - this->app->on_control(app_control); -} - -void ui_iface_app_impl::on_terminate() -{ - this->app->on_terminate(); -} - -/***********************************************************************************************/ -/* External class Implementation */ -/***********************************************************************************************/ - -static ui_iface_app *inst = NULL; - -void ui_iface_app::on_lang_changed(app_event_info_h event_info) -{ - char *language = NULL; - int ret = app_event_get_language(event_info, &language); - if (ret != APP_ERROR_NONE) { - dlog_print(DLOG_ERROR, LOG_TAG, "app_event_get_language() failed. Err = %d.", ret); - return; - } - - if (language != NULL) { - elm_language_set(language); - ui_iface_view *view = this->impl->viewmgr->get_last_view(); - view->on_language_changed(language); - free(language); - } -} - -void ui_iface_app::on_low_memory(app_event_info_h event_info) -{ - ui_iface_view *view = this->impl->viewmgr->get_last_view(); - view->on_low_memory(); -} - -void ui_iface_app::on_low_battery(app_event_info_h event_info) -{ - ui_iface_view *view = this->impl->viewmgr->get_last_view(); - view->on_low_battery(); -} - -void ui_iface_app::on_region_changed(app_event_info_h event_info) -{ - char *region = NULL; - int ret = app_event_get_region_format(event_info, ®ion); - if (ret != APP_ERROR_NONE) { - dlog_print(DLOG_ERROR, LOG_TAG, "model_app_event_get_region_format() failed. Err = %d", ret); - return; - } - - ui_iface_view *view = this->impl->viewmgr->get_last_view(); - view->on_region_changed(region); -} - -void ui_iface_app::on_orient_changed(app_event_info_h event_info) -{ -} - -bool ui_iface_app::on_create() -{ - return this->impl->init(); -} - -void ui_iface_app::on_pause() -{ - this->impl->viewmgr->deactivate(); -} - -void ui_iface_app::on_resume() -{ -// this->impl->viewmgr->activate(); -} - -void ui_iface_app::on_control(app_control_h app_control) -{ - /* Handle the launch request. */ - this->impl->viewmgr->activate(); -} - -void ui_iface_app::on_terminate() -{ - delete(this); -} - -ui_iface_app::ui_iface_app(const char *pkg, const char *locale_dir, ui_iface_viewmgr *viewmgr) -{ - if (inst) - { - LOGE("You created ui_iface_app multiple times!!"); - } - inst = this; - - this->impl = new ui_iface_app_impl(this, pkg, locale_dir, viewmgr); -} - -int ui_iface_app::run(int argc, char **argv) -{ - return this->impl->run(argc, argv); -} - -ui_iface_app::~ui_iface_app() -{ - delete (this->impl); - inst = NULL; -} - -ui_iface_viewmgr *ui_iface_app::get_viewmgr() -{ - return this->impl->viewmgr; -} - -ui_iface_app *ui_iface_app::get_instance() -{ - return inst; -} diff --git a/src/lib/interface/ui_iface_overlay.cpp b/src/lib/interface/ui_iface_overlay.cpp deleted file mode 100644 index a56da6a..0000000 --- a/src/lib/interface/ui_iface_overlay.cpp +++ /dev/null @@ -1,132 +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_iface_viewmanager.h" - - -/***********************************************************************************************/ -/* Internal class Implementation */ -/***********************************************************************************************/ -namespace ui_viewmanager -{ - -class ui_iface_overlay_impl -{ - friend class ui_iface_overlay; - -private: - ui_iface_overlay *overlay; - ui_iface_view *view; - T content; - -public: - bool set_content(T content); - T unset_content(); - ui_iface_view *get_view(); - T get_content(); - - ui_iface_overlay_impl(ui_iface_overlay *overlay, ui_iface_view *view); - ~ui_iface_overlay_impl(); -}; - -} - -ui_iface_overlay_impl::ui_iface_overlay_impl(ui_iface_overlay *overlay, ui_iface_view *view) - : overlay(overlay), view(view), content(NULL) -{ -} - -ui_iface_overlay_impl::~ui_iface_overlay_impl() -{ -} - -bool ui_iface_overlay_impl::set_content(T content) -{ - this->content = content; - return true; -} - -T ui_iface_overlay_impl::unset_content() -{ - T prev = this->content; - this->content = NULL; - return prev; -} - -T ui_iface_overlay_impl::get_content() -{ - return this->content; -} - -ui_iface_view *ui_iface_overlay_impl::get_view() -{ - return this->view; -} - - -/***********************************************************************************************/ -/* External class Implementation */ -/***********************************************************************************************/ -ui_iface_overlay::ui_iface_overlay(ui_iface_view *view) -{ - this->impl = new ui_iface_overlay_impl(this, view); -} - -ui_iface_overlay::~ui_iface_overlay() -{ - delete(this->impl); -} - -bool ui_iface_overlay::set_content(T content) -{ - return this->impl->set_content(content); -} - -T ui_iface_overlay::unset_content() -{ - return this->impl->unset_content(); -} - -T ui_iface_overlay::get_content() -{ - return this->impl->get_content(); -} - -ui_iface_view *ui_iface_overlay::get_view() -{ - return this->impl->get_view(); -} - -void ui_iface_overlay::on_back() -{ - this->deactivate(); -} - -bool ui_iface_overlay::activate() -{ - return true; -} - -bool ui_iface_overlay::deactivate() -{ - return true; -} - -bool ui_iface_overlay::is_activated() -{ - return true; -} diff --git a/src/lib/interface/ui_iface_view.cpp b/src/lib/interface/ui_iface_view.cpp deleted file mode 100644 index 2e6d9c3..0000000 --- a/src/lib/interface/ui_iface_view.cpp +++ /dev/null @@ -1,353 +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_iface_viewmanager.h" - -#include - -using namespace std; - -/***********************************************************************************************/ -/* Internal class Implementation */ -/***********************************************************************************************/ -namespace ui_viewmanager -{ - -class ui_iface_view_impl -{ - friend class ui_iface_viewmgr_impl; - friend class ui_iface_view; - -private: - ui_iface_view *view; - T content; ///< A content instance for a screen as a view. - string name; ///< View name. - string transition_style; ///< View transition style name. - ui_iface_viewmgr *viewmgr; ///< Viewmgr which this view belongs to. - ui_view_state state; ///< View state. - ui_view_indicator indicator; ///< View indicator mode. - bool event_block; ///< State of event block. - bool removable_content; ///< When this value is true, view removes it's content internally on unload state. - -public: - void set_event_block(bool block); - void on_load(); - void on_unload(); - void on_activate(); - void on_deactivate(); - void on_pause(); - void on_resume(); - void on_destroy(); - bool get_event_block(); - bool set_content(T content); - T unset_content(); - - ui_iface_view_impl(ui_iface_view *view, const char *name); - ~ui_iface_view_impl(); - - bool set_transition_style(const char *style); - void set_removable_content(bool removable); - void set_indicator(ui_view_indicator indicator); - const char *get_transition_style(); - const char *get_name(); - T get_content(); - ui_view_state get_state(); - bool get_removable_content(); - ui_view_indicator get_indicator(); - void on_back(); -}; - -} - -bool ui_iface_view_impl::get_event_block() -{ - return this->event_block; -} - -void ui_iface_view_impl::set_event_block(bool block) -{ - this->event_block = block; -} - -void ui_iface_view_impl::on_load() -{ - this->state = UI_VIEW_STATE_LOAD; -} - -void ui_iface_view_impl::on_unload() -{ - this->state = UI_VIEW_STATE_UNLOAD; - if (this->get_removable_content()) - { - this->set_content(NULL); - return; - } -} - -void ui_iface_view_impl::on_activate() -{ - this->state = UI_VIEW_STATE_ACTIVATE; -} - -void ui_iface_view_impl::on_deactivate() -{ - this->state = UI_VIEW_STATE_DEACTIVATE; -} - -void ui_iface_view_impl::on_pause() -{ - this->state = UI_VIEW_STATE_PAUSE; -} - -void ui_iface_view_impl::on_resume() -{ - this->state = UI_VIEW_STATE_ACTIVATE; -} - -void ui_iface_view_impl::on_destroy() -{ -} - -ui_iface_view_impl::ui_iface_view_impl(ui_iface_view *view, const char *name) - : view(view), 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; -} - -ui_iface_view_impl::~ui_iface_view_impl() -{ - this->viewmgr->remove_view(this->view); -} - -bool ui_iface_view_impl::set_content(T content) -{ - this->content = content; - return true; -} - -T ui_iface_view_impl::unset_content() -{ - T prev = this->content; - this->content = NULL; - return prev; -} - -bool ui_iface_view_impl::set_transition_style(const char *style) -{ - this->transition_style.assign(style); - return true; -} - -void ui_iface_view_impl::set_removable_content(bool removable) -{ - this->removable_content = removable; - - //FIXME: If this api is called on unload state? should we remove content right now? -} - -void ui_iface_view_impl::set_indicator(ui_view_indicator indicator) -{ - this->indicator = indicator; -} - -const char *ui_iface_view_impl::get_transition_style() -{ - return this->transition_style.c_str(); -} - -const char *ui_iface_view_impl::get_name() -{ - return this->name.c_str(); -} - -T ui_iface_view_impl::get_content() -{ - return this->content; -} - -ui_view_state ui_iface_view_impl::get_state() -{ - return this->state; -} - -bool ui_iface_view_impl::get_removable_content() -{ - return this->removable_content; -} - -ui_view_indicator ui_iface_view_impl::get_indicator() -{ - return this->indicator; -} - -void ui_iface_view_impl::on_back() -{ - ui_iface_viewmgr *viewmgr = this->viewmgr; - if (!viewmgr) - { - LOGE("Failed to get a viewmgr, view =%p", this); - return; - } - viewmgr->pop_view(); -} - -/***********************************************************************************************/ -/* External class Implementation */ -/***********************************************************************************************/ - -bool ui_iface_view::get_event_block() -{ - return this->impl->get_event_block(); -} - -void ui_iface_view::set_event_block(bool block) -{ - this->impl->set_event_block(block); -} - -void ui_iface_view::on_load() -{ - this->impl->on_load(); -} - -void ui_iface_view::on_unload() -{ - this->impl->on_unload(); -} - -void ui_iface_view::on_activate() -{ - this->impl->on_activate(); -} - -void ui_iface_view::on_deactivate() -{ - this->impl->on_deactivate(); -} - -void ui_iface_view::on_pause() -{ - this->impl->on_pause(); -} - -void ui_iface_view::on_resume() -{ - this->impl->on_resume(); -} - -void ui_iface_view::on_destroy() -{ - this->impl->on_destroy(); -} - -ui_iface_view::ui_iface_view(const char *name) -{ - this->impl = new ui_iface_view_impl(this, name); -} - -ui_iface_view::~ui_iface_view() -{ - delete(this->impl); -} - -bool ui_iface_view::set_content(T content) -{ - return this->impl->set_content(content); -} - -T ui_iface_view::unset_content() -{ - return this->impl->unset_content(); -} - -bool ui_iface_view::set_transition_style(const char *style) -{ - return this->impl->set_transition_style(style); -} - -void ui_iface_view::set_removable_content(bool removable) -{ - this->impl->set_removable_content(removable); -} - -void ui_iface_view::set_indicator(ui_view_indicator indicator) -{ - this->impl->set_indicator(indicator); -} - -const char *ui_iface_view::get_transition_style() -{ - return this->impl->get_transition_style(); -} - -const char *ui_iface_view::get_name() -{ - return this->impl->get_name(); -} - -T ui_iface_view::get_content() -{ - return this->impl->get_content(); -} - -ui_view_state ui_iface_view::get_state() -{ - return this->impl->get_state(); -} - -bool ui_iface_view::get_removable_content() -{ - return this->impl->get_removable_content(); -} - -ui_view_indicator ui_iface_view::get_indicator() -{ - return this->impl->get_indicator(); -} - -void ui_iface_view::on_back() -{ - this->impl->on_back(); -} - -bool ui_iface_view::set_viewmgr(ui_iface_viewmgr *viewmgr) -{ - this->impl->viewmgr = viewmgr; - return true; -} - -ui_iface_viewmgr *ui_iface_view::get_viewmgr() -{ - return this->impl->viewmgr; -} - -void ui_iface_view::on_low_memory() -{ -} - -void ui_iface_view::on_low_battery() -{ -} - -void ui_iface_view::on_region_changed(const char *region) -{ -} - -void ui_iface_view::on_language_changed(const char *language) -{ -} diff --git a/src/lib/interface/ui_iface_viewmgr.cpp b/src/lib/interface/ui_iface_viewmgr.cpp deleted file mode 100644 index fb5cc86..0000000 --- a/src/lib/interface/ui_iface_viewmgr.cpp +++ /dev/null @@ -1,563 +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 -#include "../../include/interface/ui_iface_viewmanager.h" - -using namespace std; - -/***********************************************************************************************/ -/* Internal class Implementation */ -/***********************************************************************************************/ -namespace ui_viewmanager -{ - -class ui_iface_viewmgr_impl -{ - friend class ui_iface_view_impl; - friend class ui_iface_viewmgr; - -private: - static ui_iface_viewmgr *inst; - static bool soft_key; //If system doesn't support HW back key, then this value is @c true. - static bool event_block; //Event block on view transition. This value should be configurable by system. - list view_list; //View list. - bool activated; //Activated status of this viewmgr. - bool destroying; //True, if viewmgr is on destroying. - -public: - bool connect_view(ui_iface_view *view); - bool disconnect_view(ui_iface_view *view); - void set_event_block(ui_iface_view *view, bool block); - - bool push_view_finished(ui_iface_view *view); - bool pop_view_finished(ui_iface_view *view); - ui_iface_view *push_view(ui_iface_view *view); - bool pop_view(); - bool insert_view_before(ui_iface_view *view, ui_iface_view *before); - bool insert_view_after(ui_iface_view *view, ui_iface_view *after); - bool remove_view(ui_iface_view *view); - ui_iface_view* get_view(unsigned int idx); - ui_iface_view *get_view(const char *name); - ui_iface_view *get_last_view(); - int get_view_index(const ui_iface_view *view); - - ui_iface_viewmgr_impl(ui_iface_viewmgr *viewmgr); - ~ui_iface_viewmgr_impl(); - - bool activate(); - bool deactivate(); - bool is_activated(); - unsigned int get_view_count(); - static bool need_soft_key(); - static ui_iface_viewmgr* get_instance(); -}; - -} - -ui_iface_viewmgr* ui_iface_viewmgr_impl::inst = NULL; -//FIXME: Read system profile to decide whether support software key or not. -bool ui_iface_viewmgr_impl::soft_key = true; -//FIXME: Read system profile to decide whether support event block or not. -bool ui_iface_viewmgr_impl::event_block = true; - -#define VIEW_ITR list::iterator -#define VIEW_RITR list::reverse_iterator - -bool ui_iface_viewmgr_impl::insert_view_after(ui_iface_view *view, ui_iface_view *after) -{ - VIEW_ITR it; - - if (!view) - { - LOGE("invalid view argument. view(NULL)"); - return false; - } - - if (!this->connect_view(view)) - { - LOGE("connect view failed"); - return false; - } - - if (this->view_list.size() > 0) - { - for (it = this->view_list.begin(); it != this->view_list.end(); it++) - { - if (after == *it) - { - //If the after is a last item of list. - //view has to push now. - if (it == this->view_list.end()) - this->push_view(view); - else - this->view_list.insert(++it, view); - - return true; - } - } - } - - //If there is no matching after view with current list. - //also in case of after is NULL. - this->push_view(view); - - return true; -} - -bool ui_iface_viewmgr_impl::need_soft_key() -{ - return ui_iface_viewmgr_impl::soft_key; -} - -bool ui_iface_viewmgr_impl::connect_view(ui_iface_view *view) -{ - //TODO: Perform this only in debug mode? - //Check whether the same name of this view is already existed in this viewmgr? - int name_len = strlen(view->get_name()); - const char *name = view->get_name(); - - for (VIEW_ITR it = this->view_list.begin(); it != this->view_list.end(); it++) - { - ui_iface_view *view = *it; - const char *view_name = view->get_name(); - if (!view_name) continue; - int view_name_len = strlen(view_name); - - //Got you! - if ((view_name_len == name_len) && !strcmp(name, view_name)) - { - LOGE("the same name of ui_iface_view(%p) is already in this ui_iface_viewmgr(%p)", view, this); - return false; - } - } - - return view->set_viewmgr(this->get_instance()); -} - -bool ui_iface_viewmgr_impl::disconnect_view(ui_iface_view *view) -{ - if (!view->get_viewmgr()) return false; - view->set_viewmgr(NULL); - return true; -} - -void ui_iface_viewmgr_impl::set_event_block(ui_iface_view *view, bool block) -{ - if (!ui_iface_viewmgr_impl::event_block) return; - view->set_event_block(block); -} - -bool ui_iface_viewmgr_impl::push_view_finished(ui_iface_view *view) -{ - ui_iface_view *last = this->view_list.back(); - - //The previous view has been pushed. This should be unload. - if (last != view) - { - view->on_unload(); - return true; - } - - //A new view has been pushed. This should be activate. - view->on_activate(); - this->set_event_block(view, false); - - return true; -} - -bool ui_iface_viewmgr_impl::pop_view_finished(ui_iface_view *view) -{ - ui_iface_view *last = this->view_list.back(); - - //This view has been popped. It should be destroyed. - if (last == view) - { - view->on_unload(); - view->on_destroy(); - delete (view); - return true; - } - - //The previous view has been popped. It should become activate. - view->on_activate(); - this->set_event_block(view, false); - - return true; -} - -ui_iface_viewmgr_impl::ui_iface_viewmgr_impl(ui_iface_viewmgr* viewmgr) - : activated(false), destroying(false) -{ - ui_iface_viewmgr_impl::inst = viewmgr; -} - -ui_iface_viewmgr_impl::~ui_iface_viewmgr_impl() -{ - //Terminate views - this->destroying = EINA_TRUE; - for (VIEW_RITR ritr = this->view_list.rbegin(); ritr != this->view_list.rend(); ritr++) - { - ui_iface_view *view = *ritr; - if ((view->get_state() != UI_VIEW_STATE_DEACTIVATE) && - (view->get_state() != UI_VIEW_STATE_UNLOAD)) - { - view->on_deactivate(); - } - if (view->get_state() != UI_VIEW_STATE_UNLOAD) - { - view->on_unload(); - } - view->on_destroy(); - delete (view); - } - this->destroying = EINA_FALSE; - - ui_app_exit(); - - ui_iface_viewmgr_impl::inst = NULL; -} - -ui_iface_view *ui_iface_viewmgr_impl::push_view(ui_iface_view *view) -{ - if (!view) - { - LOGE("invalid view argument. view(NULL)"); - return NULL; - } - - if (!this->connect_view(view)) - { - LOGE("connect view failed"); - return NULL; - } - - ui_iface_view *pview; - - //Previous view - if (this->view_list.size() > 0) - { - pview = this->view_list.back(); - pview->on_deactivate(); - this->set_event_block(pview, true); - } - - this->view_list.push_back(view); - - //If view manager is not activated yet, don't load view. - if (!this->is_activated()) return view; - - view->on_load(); - view->on_deactivate(); - - if (this->view_list.size() != 1) - { - this->set_event_block(view, true); - } - - return view; -} - -bool ui_iface_viewmgr_impl::pop_view() -{ - //last page to be popped. - ui_iface_view*view = this->view_list.back(); - - if (view->get_event_block()) - { - return false; - } - - //FIXME: No more view? - if (this->get_view_count() == 0) - { - LOGE("No Views. Can't pop anymore!"); - return false; - } - - //This is the last page. - if (this->get_view_count() == 1) - { - //destroy viewmgr? - ui_iface_view*view = this->view_list.back(); - view->on_deactivate(); - view->on_unload(); - view->on_destroy(); - delete(view); - - return true; - } - - view->on_deactivate(); - this->set_event_block(view, true); - - //Below object has to be used in child class... - //Make this getter method? or define instance? - //previous page is to be an active page. - auto nx = prev(this->view_list.end(), 2); - ui_iface_view*pview = *nx; - pview->on_load(); - pview->on_deactivate(); - this->set_event_block(pview, true); - - return true; -} - -bool ui_iface_viewmgr_impl::insert_view_before(ui_iface_view *view, ui_iface_view *before) -{ - VIEW_ITR it; - - if (!view) - { - LOGE("invalid view argument. view(NULL)"); - return false; - } - - if (!this->connect_view(view)) - { - LOGE("connect view failed"); - return false; - } - - if (this->view_list.size() > 0) - { - for (it = this->view_list.begin(); it != this->view_list.end(); it++) - { - if (before == *it) - { - this->view_list.insert(it, view); - - return true; - } - } - } - - //If there is no matching before view with current list. - //also in case of before is NULL. - this->push_view(view); - - return true; -} - -bool ui_iface_viewmgr_impl::remove_view(ui_iface_view *view) -{ - if (this->destroying) return false; - - this->view_list.remove(view); - this->disconnect_view(view); - - //TODO: If this view is the top on the stack ? - return true; -} - -ui_iface_view *ui_iface_viewmgr_impl::get_view(unsigned int idx) -{ - if (idx < 0 || idx >= this->view_list.size()) - { - LOGE("Invalid idx(%d)! =? (idx range: %d ~ %d)", idx, 0, this->view_list.size() - 1); - return NULL; - } - VIEW_ITR it = this->view_list.begin(); - advance(it, idx); - return *it; -} - -int ui_iface_viewmgr_impl::get_view_index(const ui_iface_view *view) -{ - int idx = 0; - - for (VIEW_ITR it = this->view_list.begin(); it != this->view_list.end(); it++) - { - if (view == *it) return idx; - ++idx; - } - - return -1; -} - -ui_iface_view *ui_iface_viewmgr_impl::get_last_view() -{ - int cnt = this->get_view_count(); - return this->get_view(cnt - 1); -} - -bool ui_iface_viewmgr_impl::activate() -{ - if (this->activated) return false; - if (this->get_view_count() == 0) return false; - this->activated = true; - ui_iface_view *view = this->get_last_view(); - view->on_load(); - view->on_deactivate(); - view->on_activate(); - return true; -} - -bool ui_iface_viewmgr_impl::deactivate() -{ - if (!this->activated) return false; - this->activated = false; - ui_iface_view *view = this->get_last_view(); - - if ((view->get_state() != UI_VIEW_STATE_DEACTIVATE) && - (view->get_state() != UI_VIEW_STATE_UNLOAD)) - { - view->on_deactivate(); - } - if (view->get_state() != UI_VIEW_STATE_UNLOAD) - { - view->on_unload(); - } - - return true; -} - -ui_iface_view *ui_iface_viewmgr_impl::get_view(const char *name) -{ - if (!name) return NULL; - int name_len = strlen(name); - - for (VIEW_ITR it = this->view_list.begin(); it != this->view_list.end(); it++) - { - ui_iface_view *view = *it; - const char *view_name = view->get_name(); - if (!view_name) continue; - int view_name_len = strlen(view_name); - - //Got you! - if ((view_name_len == name_len) && !strcmp(name, view_name)) - { - return view; - } - } - - return NULL; -} - -bool ui_iface_viewmgr_impl::is_activated() -{ - return this->activated; -} - -unsigned int ui_iface_viewmgr_impl::get_view_count() -{ - return this->view_list.size(); -} - -ui_iface_viewmgr* ui_iface_viewmgr_impl::get_instance() -{ - return ui_iface_viewmgr_impl::inst; -} - -/***********************************************************************************************/ -/* External class Implementation */ -/***********************************************************************************************/ -bool ui_iface_viewmgr::insert_view_after(ui_iface_view *view, ui_iface_view *after) -{ - return this->impl->insert_view_after(view, after); -} - -bool ui_iface_viewmgr::need_soft_key() -{ - return ui_iface_viewmgr_impl::need_soft_key(); -} - -bool ui_iface_viewmgr::push_view_finished(ui_iface_view *view) -{ - return this->impl->push_view_finished(view); -} - -bool ui_iface_viewmgr::pop_view_finished(ui_iface_view *view) -{ - return this->impl->pop_view_finished(view); -} - -ui_iface_viewmgr::ui_iface_viewmgr() -{ - this->impl = new ui_iface_viewmgr_impl(this); -} - -ui_iface_viewmgr::~ui_iface_viewmgr() -{ - delete(this->impl); -} - -ui_iface_view *ui_iface_viewmgr::push_view(ui_iface_view *view) -{ - return this->impl->push_view(view); -} - -bool ui_iface_viewmgr::pop_view() -{ - return this->impl->pop_view(); -} - -bool ui_iface_viewmgr::insert_view_before(ui_iface_view *view, ui_iface_view *before) -{ - return this->impl->insert_view_before(view, before); -} - -bool ui_iface_viewmgr::remove_view(ui_iface_view *view) -{ - return this->impl->remove_view(view); -} - -ui_iface_view *ui_iface_viewmgr::get_view(unsigned int idx) -{ - return this->impl->get_view(idx); -} - -int ui_iface_viewmgr::get_view_index(const ui_iface_view *view) -{ - return this->get_view_index(view); -} - -ui_iface_view *ui_iface_viewmgr::get_last_view() -{ - return this->impl->get_last_view(); -} - -bool ui_iface_viewmgr::activate() -{ - return this->impl->activate(); -} - -bool ui_iface_viewmgr::deactivate() -{ - return this->impl->deactivate(); -} - -ui_iface_view *ui_iface_viewmgr::get_view(const char *name) -{ - return this->impl->get_view(name); -} - -bool ui_iface_viewmgr::is_activated() -{ - return this->impl->is_activated(); -} - -unsigned int ui_iface_viewmgr::get_view_count() -{ - return this->impl->get_view_count(); -} - -ui_iface_viewmgr* ui_iface_viewmgr::get_instance() -{ - return ui_iface_viewmgr_impl::get_instance(); -}