This interface is designed for rotataion events.
All kinds of views which is rotatable could inherit this.
Change-Id: Ifac8e14cf62631c62554201ddfe88abfab412097
#define UI_MENU_H
#include "../ui_viewmanager_base.h"
+#include "../../interface/ui_viewmanager_interface.h"
namespace efl_viewmgr
{
class ui_view;
-class ui_menu
+class ui_menu: public viewmgr::ui_iface_rotatable
{
friend class ui_view;
private:
virtual Elm_Ctxpopup *unset_content();
virtual void on_back();
virtual bool is_activated();
- virtual Evas_Object *get_base();
+ virtual Evas_Object *get_base();
+ virtual int get_degree();
virtual Elm_Ctxpopup *get_content()
{
return this->ctxpopup;
virtual void set_event_block(bool block);
virtual void on_back();
+ /** @brief This is for calling controller's rotate method.
+ */
+ virtual void on_rotate(int degree);
+
+ /** @brief This is for calling controller's portrait method.
+ */
+ virtual void on_portrait();
+
+ /** @brief This is for calling controller's landscape method.
+ */
+ virtual void on_landscape();
+
public:
ui_view(ui_controller *controller, const char *name = NULL);
ui_view(const char *name = NULL);
* @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_base_view: public viewmgr::ui_iface_view
+class ui_base_view: public viewmgr::ui_iface_view, public viewmgr::ui_iface_rotatable
{
friend class ui_base_viewmgr;
*
* @param indicator The mode to set, one of #ui_base_view_indicator.
*/
- void set_indicator(ui_view_indicator indicator);
+ virtual void set_indicator(ui_view_indicator indicator);
/** @brief Get current view's degree.
*
- * @return Current rotation degree, -1 if failed to get viewmgr degree.
+ * @return Current rotation degree, -1 if it fails to get degree information.
*/
- int get_degree();
+ virtual int get_degree();
};
}
--- /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_ROTATABLE_INTERFACE_H_
+#define UI_ROTATABLE_INTERFACE_H_
+
+namespace viewmgr
+{
+class ui_iface_rotatable
+{
+protected:
+ /** @brief This is for calling controller's portrait method.
+ */
+ virtual void on_portrait() {}
+
+ /** @brief This is for calling controller's landscape method.
+ */
+ virtual void on_landscape() {}
+
+ /** @brief This is for calling controller's rotate method.
+ */
+ virtual void on_rotate(int degree) {}
+
+public:
+ /** @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_ROTATABLE_INTERFACE_H_ */
UI_VIEW_INDICATOR_LAST
};
+#include "ui_iface_rotatable.h"
#include "ui_iface_viewmgr.h"
#include "ui_iface_view.h"
#include "ui_iface_controller.h"
using namespace efl_viewmgr;
-#define MY_VIEWMGR
-
static void ctxpopup_dismissed_cb(void *data, Evas_Object *obj, void *event_info)
{
evas_object_hide(obj);
{
this->deactivate();
}
+
+int ui_menu::get_degree()
+{
+ return this->view->get_degree();
+}
return toolbar;
}
+
+void ui_view::on_rotate(int degree)
+{
+ ui_base_view::on_rotate(degree);
+ if (this->menu && this->menu->is_activated())
+ {
+ this->menu->on_rotate(degree);
+ }
+}
+
+void ui_view::on_portrait()
+{
+ ui_base_view::on_portrait();
+ if (this->menu && this->menu->is_activated())
+ {
+ this->menu->on_portrait();
+ }
+}
+
+void ui_view::on_landscape()
+{
+ ui_base_view::on_landscape();
+ if (this->menu && this->menu->is_activated())
+ {
+ this->menu->on_landscape();
+ }
+}
void ui_base_view::on_rotate(int degree)
{
- if (this->get_controller())
- {
- MY_CONTROLLER->on_rotate(degree);
- }
+ if (!this->get_controller()) return;
+ MY_CONTROLLER->on_rotate(degree);
}
void ui_base_view::on_portrait()
{
- if (this->get_controller())
- {
- MY_CONTROLLER->on_portrait();
- }
+ if (!this->get_controller()) return;
+ MY_CONTROLLER->on_portrait();
}
void ui_base_view::on_landscape()
{
- if (this->get_controller())
- {
- MY_CONTROLLER->on_landscape();
- }
+ if (!this->get_controller()) return;
+ MY_CONTROLLER->on_landscape();
}
void ui_base_view::set_event_block(bool block)
{