replaced ui_view to ui_standard_view.
instead, ui_view has been designed for empty view in mobile profile.
Change-Id: I5bc59a75898d9619b5161bc43ff4fe982dc36a00
*
*/
-/** This example create a simple view which is inheritance ui_view.
+/** This example create a simple view which is inheritance ui_standard_view.
* Then push in viewmgr.
*/
-class page1: public ui_view
+class page1: public ui_standard_view
{
protected:
void on_load()
{
- ui_view::on_load();
+ ui_standard_view::on_load();
//Create a main content.
Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo<br>Basic View",
}
public:
- page1() : ui_view("page1") {}
+ page1() : ui_standard_view("page1") {}
~page1() {}
};
/** This page implements on_rotate() method to create portarit, landscape content.
* This page will be created suitable content in on_rotate() method.
*/
-class page10: public ui_view
+class page10: public ui_standard_view
{
protected:
void on_load()
{
- ui_view::on_load();
+ ui_standard_view::on_load();
this->on_rotate(this->get_degree());
}
void on_rotate(int degree)
{
- ui_view::on_rotate(degree);
+ ui_standard_view::on_rotate(degree);
//Portrait
if (this->get_degree() == 0 || this->get_degree() == 180)
}
}
public:
- page10() : ui_view("page10") {}
+ page10() : ui_standard_view("page10") {}
~page10() {}
};
LOGE("Item (%s) is selected", elm_object_item_text_get(it));
}
-class page11: public ui_view
+class page11: public ui_standard_view
{
protected:
void on_load()
{
- ui_view::on_load();
+ ui_standard_view::on_load();
//Create a main content.
Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo<br>Menu Popup",
void on_menu(ui_menu *menu)
{
- ui_view::on_menu(menu);
+ ui_standard_view::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);
*
*/
-/** This page inherit ui_ui_view
+/** This page inherit ui_ui_standard_view
* And make a button on right top side of title area to activate popup.
* The created popup has view and it will be managed by viewmgr.
*/
delete (popup);
}
-class page12: public ui_view
+class page12: public ui_standard_view
{
protected:
void on_load()
{
- ui_view::on_load();
+ ui_standard_view::on_load();
//Create a main content.
Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo<br>Popup",
}
public:
- page12() : ui_view("page12") {}
+ page12() : ui_standard_view("page12") {}
~page12() {}
void create_popup()
*
*/
-/** This example create a simple view which is inheritance ui_view.
+/** This example create a simple view which is inheritance ui_standard_view.
* Then push in viewmgr.
*/
-class page13: public ui_view
+class page13: public ui_standard_view
{
protected:
void on_load()
{
- ui_view::on_load();
+ ui_standard_view::on_load();
//Create a main content.
Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo<br>Fade Transition",
}
public:
- page13() : ui_view("page13")
+ page13() : ui_standard_view("page13")
{
this->set_transition_style("fade");
}
*
*/
-/** This example create a simple view which is inheritance ui_view.
+/** This example create a simple view which is inheritance ui_standard_view.
* Then push in viewmgr.
*/
-class page14: public ui_view
+class page14: public ui_standard_view
{
protected:
void on_load()
{
- ui_view::on_load();
+ ui_standard_view::on_load();
//Create a main content.
Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo<br>None Transition",
}
public:
- page14() : ui_view("page14")
+ page14() : ui_standard_view("page14")
{
this->set_transition_style("none");
}
*
*/
-/** This example create a simple view which is inheritance ui_view.
+/** This example create a simple view which is inheritance ui_standard_view.
* Then push in viewmgr.
*/
-class page15: public ui_view
+class page15: public ui_standard_view
{
protected:
void on_load()
{
- ui_view::on_load();
+ ui_standard_view::on_load();
//Create a main content.
Evas_Object *content = create_scrolling_content(this->get_base());
*
*/
-/** This example create a simple view which is inheritance ui_view.
+/** This example create a simple view which is inheritance ui_standard_view.
* Then push in viewmgr.
*/
-class page16: public ui_view
+class page16: public ui_standard_view
{
protected:
void on_load()
{
- ui_view::on_load();
+ ui_standard_view::on_load();
//Create a main content.
Evas_Object *content = create_title_handle_content(this->get_base(),
//Title Show Button Callback
[](void *data, Evas_Object *obj, void *event_info) -> void
{
- ui_view *view = static_cast<ui_view *>(data);
+ ui_standard_view *view = static_cast<ui_standard_view *>(data);
view->set_title_visible(true, false);
},
//Title Hide Button Callback
[](void *data, Evas_Object *obj, void *event_info) -> void
{
- ui_view *view = static_cast<ui_view *>(data);
+ ui_standard_view *view = static_cast<ui_standard_view *>(data);
view->set_title_visible(false, false);
},
//Title Show Anim Button Callback
[](void *data, Evas_Object *obj, void *event_info) -> void
{
- ui_view *view = static_cast<ui_view *>(data);
+ ui_standard_view *view = static_cast<ui_standard_view *>(data);
view->set_title_visible(true, true);
},
//Title Hide Anim Button Callback
[](void *data, Evas_Object *obj, void *event_info) -> void
{
- ui_view *view = static_cast<ui_view *>(data);
+ ui_standard_view *view = static_cast<ui_standard_view *>(data);
view->set_title_visible(false, true);
}, this);
}
public:
- page16() : ui_view("page16") {}
+ page16() : ui_standard_view("page16") {}
~page16() {}
};
*
*/
-/** This example create a simple view which is inheritance ui_view.
+/** This example create a simple view which is inheritance ui_standard_view.
* And add two buttons in view title area. hen push in viewmgr.
*/
-class page2: public ui_view
+class page2: public ui_standard_view
{
protected:
void on_load()
{
- ui_view::on_load();
+ ui_standard_view::on_load();
//Create a main content.
Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo<br>Title Buttons",
}
public:
- page2() : ui_view("page2") {}
+ page2() : ui_standard_view("page2") {}
~page2() {}
};
*
*/
-/** This example create a simple view which is inheritance ui_view.
+/** This example create a simple view which is inheritance ui_standard_view.
* And set text in view subtitle. then push in viewmgr.
*/
-class page3: public ui_view
+class page3: public ui_standard_view
{
protected:
void on_load()
{
- ui_view::on_load();
+ ui_standard_view::on_load();
//Create a main content.
Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo<br>Subtitle",
}
public:
- page3() : ui_view("page3") {}
+ page3() : ui_standard_view("page3") {}
~page3() {}
};
*
*/
-/** This example create a simple view which is inheritance ui_view.
+/** This example create a simple view which is inheritance ui_standard_view.
* And set long text to title, set badge text in view title area.
* Then push in viewmgr.
*/
-class page4: public ui_view
+class page4: public ui_standard_view
{
protected:
void on_load()
{
- ui_view::on_load();
+ ui_standard_view::on_load();
//Create a main content.
Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo<br>Title Badge",
}
public:
- page4() : ui_view("page4") {}
+ page4() : ui_standard_view("page4") {}
~page4() {}
};
*
*/
-/** This page inherit ui_base_view to show how to create full view.
+/** This page inherit ui_view to show how to create full view.
* And set indicator state as hide.
*/
-class page5: public ui_base_view
+class page5: public ui_view
{
protected:
void on_load()
{
- ui_base_view::on_load();
+ ui_view::on_load();
//Create a main content.
Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo<br>Full View",
}
public:
- page5() : ui_base_view("page5") {}
+ page5() : ui_view("page5") {}
~page5() {}
};
*
*/
-/** This page inherit ui_view to show title with toolbar sample.
+/** This page inherit ui_standard_view to show title with toolbar sample.
*/
-class page6: public ui_view
+class page6: public ui_standard_view
{
protected:
void on_load()
{
- ui_view::on_load();
+ ui_standard_view::on_load();
//Create a main content.
Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo<br>Toolbar",
}
public:
- page6() : ui_view("page6") {}
+ page6() : ui_standard_view("page6") {}
~page6() {}
};
*
*/
-/** This page inherit ui_view to show title with toolbar sample.
+/** This page inherit ui_standard_view to show title with toolbar sample.
* And this page make a content in page constructor time.
*/
-class page7: public ui_view
+class page7: public ui_standard_view
{
protected:
void on_load()
{
- ui_view::on_load();
+ ui_standard_view::on_load();
//Create a main content.
Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo<br>Navigationbar",
this->set_toolbar(toolbar);
}
public:
- page7() : ui_view("page7") {}
+ page7() : ui_standard_view("page7") {}
~page7() {}
};
/** This page shows how to create a view content in advance.
*/
-class page8: public ui_view
+class page8: public ui_standard_view
{
public:
- page8() : ui_view("page8")
+ page8() : ui_standard_view("page8")
{
//Create a main content.
Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo<br>Content Preloading",
*
*/
-/** This page inherit ui_view.
+/** This page inherit ui_standard_view.
* And implement on_portait(), on_landscape() method to create portarit, landscape content.
* This page will be created suitable content in on_portrait(), on_landscape() method.
*/
-class page9: public ui_view
+class page9: public ui_standard_view
{
protected:
void on_load()
{
- ui_view::on_load();
+ ui_standard_view::on_load();
//FIXME: Change below code to more convenient and clear way.
if (this->get_degree() == 90 || this->get_degree() == 270)
void on_portrait()
{
- ui_view::on_portrait();
+ ui_standard_view::on_portrait();
Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo<br>Portrait/Landscape",
//Prev Button Callback
void on_landscape()
{
- ui_view::on_landscape();
+ ui_standard_view::on_landscape();
Evas_Object *content = create_landscape_content(this->get_base(), "ViewMgr Demo<br>Portrait/Landscape",
//Prev Button Callback
}
public:
- page9() : ui_view("page9") {}
+ page9() : ui_standard_view("page9") {}
~page9() {}
};
#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()
-
+#define UI_VIEWMGR dynamic_cast<ui_viewmgr *>(ui_iface_viewmgr::get_instance())
#endif /* UI_MOBILE_VIEWMANAGER_H */
--- /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_STANDARD_VIEW_H_
+#define _UI_STANDARD_VIEW_H_
+
+namespace efl_viewmanager
+{
+
+class ui_standard_view: public ui_view
+{
+private:
+ 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();
+
+protected:
+ virtual void on_load();
+ virtual void on_unload();
+ virtual void set_event_block(bool block);
+
+public:
+ ui_standard_view(const char *name = NULL);
+ virtual ~ui_standard_view();
+
+ 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);
+ Evas_Object *unset_content();
+ Elm_Button *unset_title_left_btn();
+ Elm_Button *unset_title_right_btn();
+ Elm_Toolbar *unset_toolbar();
+
+ virtual 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;
+ }
+};
+
+}
+
+#endif /* _UI_STANDARD_VIEW_H_ */
friend class ui_key_listener;
private:
- 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
ui_menu *menu; //Menu
list<ui_popup *> popup_list;
void disconnect_popup(ui_popup *popup);
bool deactivate_popup(bool top_one);
- bool create_layout();
- bool destroy_layout();
-
protected:
- virtual void on_load();
- virtual void on_unload();
ui_menu *on_menu_pre();
void on_menu_post();
virtual void on_menu(ui_menu *menu);
- virtual void set_event_block(bool block);
virtual void on_back();
virtual void on_rotate(int degree);
virtual void on_portrait();
*/
virtual void on_deactivate();
-
public:
ui_view(const char *name = NULL);
virtual ~ui_view();
- 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);
- Evas_Object *unset_content();
- Elm_Button *unset_title_left_btn();
- Elm_Button *unset_title_right_btn();
- Elm_Toolbar *unset_toolbar();
-
- virtual 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;
- }
-
const ui_menu *get_menu()
{
return this->menu;
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
)
--- /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_mobile_viewmanager.h"
+
+#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<ui_standard_view *>(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<ui_standard_view *>(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<ui_standard_view *>(data);
+ view->unset_toolbar();
+}
+
+bool ui_standard_view::destroy_layout()
+{
+ if (!this->layout) return false;
+ evas_object_del(this->layout);
+ this->layout = NULL;
+
+ return true;
+}
+
+bool ui_standard_view::create_layout()
+{
+ if (this->layout) return false;
+
+ Elm_Layout *layout = elm_layout_add(this->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->get_content())
+ {
+ elm_object_part_content_set(layout, "elm.swallow.content", this->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<ui_viewmgr *>(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::ui_standard_view(const char *name)
+ : ui_view(name), layout(NULL), toolbar(NULL), title_left_btn(NULL), title_right_btn(NULL)
+{
+}
+
+ui_standard_view::~ui_standard_view()
+{
+ destroy_layout();
+}
+
+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);
+
+ 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::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::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);
+
+ return true;
+}
+
+bool ui_standard_view::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);
+
+ return true;
+}
+
+bool ui_standard_view::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::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::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)
+{
+ 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);
+
+ return true;
+}
+
+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;
+
+ Elm_Layout *layout = this->get_base();
+ if (!layout)
+ {
+ LOGE("Layout is invalid! ui_standard_view(%p)", this);
+ return pcontent;
+ }
+ elm_object_part_content_unset(layout, "elm.swallow.content");
+ elm_object_signal_emit(layout, "elm.state,elm.swallow.content,hide", "viewmgr");
+
+ return pcontent;
+}
+
+Elm_Button *ui_standard_view::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::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::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::get_base()
+{
+ if (!this->layout)
+ {
+ this->create_layout();
+ }
+ return this->layout;
+}
+
+bool ui_standard_view::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;
+}
*/
#include "../../../include/efl/mobile/ui_mobile_viewmanager.h"
-#define DEFAULT_GROUP "tizen_view/default"
-
typedef list<ui_popup*>::reverse_iterator popup_ritr;
-#define LAYOUT_VALIDATE() if (!layout) \
- { \
- LOGE("Layout is invalid! ui_view(%p)", this); \
- return false; \
- }
-
-static void title_left_btn_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
- ui_view *view = static_cast<ui_view *>(data);
- view->unset_title_left_btn();
-}
-
-static void title_right_btn_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
- ui_view *view = static_cast<ui_view *>(data);
- view->unset_title_right_btn();
-}
-
-static void toolbar_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
- ui_view *view = static_cast<ui_view *>(data);
- view->unset_toolbar();
-}
-
void ui_view::connect_popup(ui_popup *popup)
{
this->popup_list.push_back(popup);
return false;
}
-bool ui_view::destroy_layout()
-{
- if (!this->layout) return false;
- evas_object_del(this->layout);
- this->layout = NULL;
-
- return true;
-}
-
-bool ui_view::create_layout()
-{
- if (this->layout) return false;
-
- Elm_Layout *layout = elm_layout_add(this->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_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->get_content())
- {
- elm_object_part_content_set(layout, "elm.swallow.content", this->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_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<ui_viewmgr *>(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;
-}
-
void ui_view::on_deactivate()
{
deactivate_popup(false);
}
ui_view::ui_view(const char *name)
- : ui_base_view(name), layout(NULL), toolbar(NULL), title_left_btn(NULL), title_right_btn(NULL), menu(NULL)
+ : ui_base_view(name), menu(NULL)
{
}
ui_view::~ui_view()
{
if (menu) delete (this->menu);
- destroy_layout();
-}
-
-void ui_view::on_load()
-{
- ui_base_view::on_load();
-
- Elm_Layout *layout = this->get_base();
- evas_object_show(layout);
-}
-
-void ui_view::on_unload()
-{
- ui_base_view::on_unload();
-
- Elm_Layout *layout = this->get_base();
- evas_object_hide(layout);
-}
-
-bool ui_view::set_content(Evas_Object *content, const char *title)
-{
- ui_base_view::set_content(content);
-
- 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_view::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_view::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);
-
- return true;
-}
-
-bool ui_view::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);
-
- return true;
-}
-
-bool ui_view::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_view::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_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_view::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);
-
- return true;
}
ui_menu *ui_view::on_menu_pre()
this->menu->activate();
}
-void ui_view::set_event_block(bool block)
-{
- ui_base_view::set_event_block(block);
- evas_object_freeze_events_set(this->get_base(), block);
-}
-
-Evas_Object *ui_view::unset_content()
-{
- Evas_Object *pcontent = ui_base_view::unset_content();
- if (!pcontent) return NULL;
-
- Elm_Layout *layout = this->get_base();
- if (!layout)
- {
- LOGE("Layout is invalid! ui_view(%p)", this);
- return pcontent;
- }
- elm_object_part_content_unset(layout, "elm.swallow.content");
- elm_object_signal_emit(layout, "elm.state,elm.swallow.content,hide", "viewmgr");
-
- return pcontent;
-}
-
-Elm_Button *ui_view::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_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_view::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_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_view::unset_toolbar()
-{
- Elm_Toolbar *toolbar = this->toolbar;
- if (!toolbar) return NULL;
-
- Elm_Layout *layout = this->get_base();
- if (!layout)
- {
- LOGE("Layout is invalid! ui_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;
-}
-
void ui_view::on_rotate(int degree)
{
//FIXME: see how to handle on_menu()
if (!this->menu->is_activated()) return;
this->menu->on_landscape();
}
-
-Evas_Object *ui_view::get_base()
-{
- if (!this->layout)
- {
- this->create_layout();
- }
- return this->layout;
-}
-
-bool ui_view::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_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;
-}