SET(EXAM_SRCS
../../lib/interface/ui_iface_view.cpp
../../lib/interface/ui_iface_viewmgr.cpp
- ../../lib/efl/ui_base_popup.cpp
../../lib/efl/ui_base_view.cpp
../../lib/efl/ui_base_viewmgr.cpp
../../lib/efl/ui_base_key_listener.cpp
../../lib/efl/mobile/ui_menu.cpp
+ ../../lib/efl/mobile/ui_popup.cpp
../../lib/efl/mobile/ui_view.cpp
../../lib/efl/mobile/ui_key_listener.cpp
../../lib/efl/mobile/ui_viewmgr.cpp
//FIXME: remove dismissed callback because this callback is called twice.
//It seems this is an efl or popup error, not this ui_popup nor example.
evas_object_smart_callback_del(obj, "dismissed", popup_dismissed_cb);
- ui_base_popup *overlay = static_cast<ui_base_popup *>(data);
- delete (overlay);
+ ui_popup *popup = static_cast<ui_popup *>(data);
+ delete (popup);
}
class page12: public ui_view
void create_popup()
{
//FIXME: is overlay a proper name?
- ui_base_popup *overlay = new ui_base_popup(this);
+ ui_popup *popup = new ui_popup(this);
- Elm_Popup *popup = elm_popup_add(overlay->get_base());
- elm_object_text_set(popup, "This popup has only text which is set via desc set function, (This popup gets hidden when user clicks outside) here timeout of 3 sec is set.");
- elm_popup_timeout_set(popup, 3.0);
- evas_object_smart_callback_add(popup, "dismissed", popup_dismissed_cb, overlay);
- evas_object_smart_callback_add(popup, "block,clicked",
+ Elm_Popup *obj = elm_popup_add(popup->get_base());
+ elm_object_text_set(obj, "This popup has only text which is set via desc set function, (This popup gets hidden when user clicks outside) here timeout of 3 sec is set.");
+ elm_popup_timeout_set(obj, 3.0);
+ evas_object_smart_callback_add(obj, "dismissed", popup_dismissed_cb, popup);
+ evas_object_smart_callback_add(obj, "block,clicked",
[](void *data, Evas_Object *obj, void *event_info) -> void
{
elm_popup_dismiss(obj);
},
NULL);
- evas_object_smart_callback_add(popup, "timeout",
+ evas_object_smart_callback_add(obj, "timeout",
[](void *data, Evas_Object *obj, void *event_info) -> void
{
elm_popup_dismiss(obj);
},
NULL);
- overlay->set_content(popup);
- overlay->activate();
+ popup->set_content(obj);
+ popup->activate();
}
};
#define UI_MENU_H
#include "../../interface/ui_iface_viewmanager.h"
-#include "../ui_base_viewmanager.h"
namespace efl_viewmgr
{
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#ifndef UI_POPUP_H
+#define UI_POPUP_H
+
+#include "../../interface/ui_iface_viewmanager.h"
+
+namespace efl_viewmgr
+{
+class ui_popup : public viewmgr::ui_iface_overlay<Elm_Popup *>
+{
+private:
+ Elm_Win *get_window();
+
+public:
+ ui_popup(ui_view *view);
+ virtual ~ui_popup();
+
+ virtual bool activate();
+ virtual bool deactivate();
+ virtual bool set_content(Elm_Popup* ctxpopup);
+ virtual Elm_Popup *unset_content();
+ virtual bool is_activated();
+
+ virtual Evas_Object *get_base();
+ virtual int get_degree();
+};
+
+}
+
+#endif /* UI_POPUP_H */
{
class ui_menu;
+class ui_popup;
class ui_key_listener;
class ui_view: public ui_base_view
{
friend class ui_menu;
+ friend class ui_popup;
friend class ui_key_listener;
private:
Elm_Button *title_left_btn; //Title left button
Elm_Button *title_right_btn; //Title right button
ui_menu *menu; //Menu
+ list<ui_popup *> popup_list;
+
+ void connect_popup(ui_popup *popup);
+ void disconnect_popup(ui_popup *popup);
+ bool deactivate_popup(bool top_one);
bool create_layout();
bool destroy_layout();
virtual void on_portrait();
virtual void on_landscape();
+ /** @brief view deactivate state.
+ *
+ * @note this state will be triggered by ui_iface_viewmgr.
+ *
+ */
+ virtual void on_deactivate();
+
+
public:
ui_view(const char *name = NULL);
virtual ~ui_view();
#include "ui_key_listener.h"
#include "ui_viewmgr.h"
#include "ui_menu.h"
+#include "ui_popup.h"
#define UI_VIEWMGR dynamic_cast<ui_viewmgr *>(efl_viewmgr::ui_base_viewmgr::get_instance())
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-#ifndef UI_BASE_POPUP_H
-#define UI_BASE_POPUP_H
-
-#include "../interface/ui_iface_viewmanager.h"
-
-namespace efl_viewmgr
-{
-class ui_base_popup : public viewmgr::ui_iface_overlay<Elm_Popup *>
-{
-private:
- Elm_Win *get_window();
-
-public:
- ui_base_popup(ui_base_view *view);
- virtual ~ui_base_popup();
-
- virtual bool activate();
- virtual bool deactivate();
- virtual bool set_content(Elm_Popup* ctxpopup);
- virtual Elm_Popup *unset_content();
- virtual bool is_activated();
-
- virtual Evas_Object *get_base();
- virtual int get_degree();
-};
-
-}
-
-#endif /* UI_BASE_POPUP_H */
namespace efl_viewmgr
{
-class ui_base_popup;
/**
* @class ui_base_view
class ui_base_view: public viewmgr::ui_iface_view, public viewmgr::ui_iface_rotatable
{
friend class ui_base_viewmgr;
- friend class ui_base_popup;
-
-private:
- list<ui_base_popup *> popup_list;
-
- void connect_popup(ui_base_popup *popup);
- void disconnect_popup(ui_base_popup *popup);
- bool deactivate_popup(bool top_one);
protected:
/** @brief Unload current view's content
virtual void on_portrait();
virtual void on_landscape();
- /** @brief view deactivate state.
- *
- * @note this state will be triggered by ui_iface_viewmgr.
- *
- */
- virtual void on_deactivate();
-
public:
///Constructor.
ui_base_view(const char *name = NULL);
#include "ui_base_viewmgr.h"
#include "ui_base_view.h"
#include "ui_base_key_listener.h"
-#include "ui_base_popup.h"
SET(LIB_SRCS
interface/ui_iface_view.cpp
interface/ui_iface_viewmgr.cpp
- efl/ui_base_popup.cpp
efl/ui_base_view.cpp
efl/ui_base_viewmgr.cpp
efl/ui_base_key_listener.cpp
efl/mobile/ui_menu.cpp
+ efl/mobile/ui_popup.cpp
efl/mobile/ui_view.cpp
efl/mobile/ui_key_listener.cpp
efl/mobile/ui_viewmgr.cpp
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#include "../../../include/efl/mobile/ui_viewmanager.h"
+
+using namespace efl_viewmgr;
+
+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<ui_popup *>(data);
+ popup->unset_content();
+}
+
+ui_popup::ui_popup(ui_view *view)
+ : ui_iface_overlay(view)
+{
+ view->connect_popup(this);
+}
+
+ui_popup::~ui_popup()
+{
+ dynamic_cast<ui_view *>(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<ui_view*>(this->get_view())->on_resume();
+
+ return true;
+}
+
+bool ui_popup::activate()
+{
+ bool ret = update_popup(this);
+ if (ret) dynamic_cast<ui_view*>(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;
+
+ //validation!
+ //FIXME: isa ?
+ 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);
+
+ //FIXME: rename style.
+ 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_iface_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_iface_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();
+}
using namespace efl_viewmgr;
using namespace viewmgr;
+typedef list<ui_popup*>::reverse_iterator popup_ritr;
+
#define LAYOUT_VALIDATE() if (!layout) \
{ \
LOGE("Layout is invalid! ui_view(%p)", this); \
view->unset_toolbar();
}
+void ui_view::connect_popup(ui_popup *popup)
+{
+ this->popup_list.push_back(popup);
+}
+
+void ui_view::disconnect_popup(ui_popup *popup)
+{
+ this->popup_list.remove(popup);
+}
+
+bool ui_view::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::destroy_layout()
{
if (!this->layout) return false;
return true;
}
+void ui_view::on_deactivate()
+{
+ deactivate_popup(false);
+ ui_base_view::on_deactivate();
+}
+
void ui_view::on_back()
{
+ //If any popup is activated, deactivate the popup first.
+ if (this->deactivate_popup(true)) return;
+
if (this->menu)
{
if (this->menu->is_activated())
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-#include "../../include/efl/ui_base_viewmanager.h"
-
-using namespace efl_viewmgr;
-
-static bool update_popup(ui_base_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_base_popup *popup = static_cast<ui_base_popup *>(data);
- popup->unset_content();
-}
-
-ui_base_popup::ui_base_popup(ui_base_view *view)
- : ui_iface_overlay(view)
-{
- view->connect_popup(this);
-}
-
-ui_base_popup::~ui_base_popup()
-{
- dynamic_cast<ui_base_view *>(this->get_view())->disconnect_popup(this);
- Elm_Popup *popup = this->unset_content();
- evas_object_del(popup);
-}
-
-Elm_Win *ui_base_popup::get_window()
-{
- ui_base_viewmgr *viewmgr = UI_BASE_VIEWMGR;
- if (!viewmgr)
- {
- LOGE("Viewmgr is null?? menu(%p)", this);
- return NULL;
- }
- return viewmgr->get_window();
-}
-
-bool ui_base_popup::deactivate()
-{
- Elm_Popup *popup = this->get_content();
- if (!popup)
- {
- LOGE("Content is not set! = ui_base_popup(%p)", this);
- return false;
- }
-
- elm_popup_dismiss(popup);
- dynamic_cast<ui_base_view*>(this->get_view())->on_resume();
-
- return true;
-}
-
-bool ui_base_popup::activate()
-{
- bool ret = update_popup(this);
- if (ret) dynamic_cast<ui_base_view*>(this->get_view())->on_pause();
- return ret;
-}
-
-bool ui_base_popup::set_content(Elm_Popup *popup)
-{
- Elm_Popup *prev = this->unset_content();
- evas_object_del(prev);
-
- if (!popup) return true;
-
- //validation!
- //FIXME: isa ?
- 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);
-
- //FIXME: rename style.
- 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_iface_overlay::set_content(popup);
-
- return true;
-}
-
-bool ui_base_popup::is_activated()
-{
- Elm_Popup *popup = this->get_content();
- if (!popup) return false;
- return evas_object_visible_get(popup);
-}
-
-Elm_Popup *ui_base_popup::unset_content()
-{
- Elm_Popup *popup = ui_iface_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_base_popup::get_base()
-{
- return this->get_window();
-}
-
-int ui_base_popup::get_degree()
-{
- return this->get_view()->get_degree();
-}
using namespace efl_viewmgr;
using namespace viewmgr;
-typedef list<ui_base_popup*>::reverse_iterator popup_ritr;
-
static void content_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
ui_base_view *view = static_cast<ui_base_view *>(data);
view->unset_content();
}
-void ui_base_view::connect_popup(ui_base_popup *popup)
-{
- this->popup_list.push_back(popup);
-}
-
-void ui_base_view::disconnect_popup(ui_base_popup *popup)
-{
- this->popup_list.remove(popup);
-}
-
ui_base_view::ui_base_view(const char *name)
: ui_iface_view(name)
{
viewmgr->set_indicator(indicator);
}
-bool ui_base_view::deactivate_popup(bool top_one)
-{
- for (popup_ritr it = this->popup_list.rbegin(); it != this->popup_list.rend(); it++)
- {
- ui_base_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;
-}
-
-void ui_base_view::on_deactivate()
-{
- deactivate_popup(false);
- ui_iface_view::on_deactivate();
-}
-
void ui_base_view::on_back()
{
- //If any popup is activated, deactivate the popup first.
- if (this->deactivate_popup(true)) return;
-
ui_base_viewmgr *viewmgr = UI_BASE_VIEWMGR;
if (!viewmgr)
{