SET(BINDIR ${PREFIX}/bin)
SET(LIBDIR ${PREFIX}/lib)
SET(INCDIR ${PREFIX}/include)
+SET(IMGDIR ${PREFIX}/share/${PROJECT_NAME}/images)
SET(VERSION_MAJOR 0)
SET(VERSION ${VERSION_MAJOR}.1.0)
SET(VENDOR "samsung")
)
ADD_DEPENDENCIES(${PROJECT_NAME} ${PROJECT_NAME}.edj)
INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.edj DESTINATION /usr/share/edje/${PROJECT_NAME})
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/images/ DESTINATION ${IMGDIR} FILES_MATCHING PATTERN "*.png")
%defattr(-,root,root,-)
%{_libdir}/libui-viewmgr.so.*
%manifest %{name}.manifest
+%{_datadir}/ui-viewmgr/images/*
/usr/share/license/%{name}
/usr/share/edje/ui-viewmgr/ui-viewmgr.edj
*
*/
#include "main.h"
+#include "page11.h"
+#include "page10.h"
#include "page9.h"
#include "page8.h"
#include "page7.h"
return toolbar;
}
+Evas_Object*
+create_landscape_content(Evas_Object *parent, const char *text, Evas_Smart_Cb prev_btn_clicked_cb, Evas_Smart_Cb next_btn_clicked_cb, appdata_s *ad)
+{
+ char buf[128];
+ Elm_Grid *grid;
+ Elm_Box *box;
+ Elm_Layout *layout;
+ Elm_Scroller *scroller;
+ Elm_Button *btn;
+ Elm_Image *image;
+
+ /* Scroller */
+ scroller = elm_scroller_add(parent);
+ elm_scroller_bounce_set(scroller, EINA_FALSE, EINA_TRUE);
+ elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
+
+ /* Grid */
+ grid = elm_grid_add(scroller);
+ evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(grid);
+
+ /* NoContent Layout */
+ layout = elm_layout_add(grid);
+ elm_layout_theme_set(layout, "layout", "nocontents", "default");
+ elm_object_part_text_set(layout, "elm.text", text);
+ evas_object_show(layout);
+ elm_grid_pack(grid, layout, 0, 0, 50, 100);
+
+ /* Image */
+ image = elm_image_add(grid);
+ snprintf(buf, sizeof(buf), "/usr/share/ui-viewmgr/images/tizen.png");
+ elm_image_file_set(image, buf, NULL);
+ evas_object_show(image);
+ elm_grid_pack(grid, image, 50, 0, 50, 85);
+
+ /* Box */
+ box = elm_box_add(grid);
+ elm_box_horizontal_set(box, EINA_TRUE);
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_padding_set(box, ELM_SCALE_SIZE(50), 0);
+ evas_object_show(box);
+ elm_grid_pack(grid, box, 0, 0, 100, 100);
+
+ /* Previous Page Button */
+ btn = elm_button_add(grid);
+ evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 1.0);
+ elm_object_text_set(btn, "Prev");
+ evas_object_smart_callback_add(btn, "clicked", prev_btn_clicked_cb, ad);
+ evas_object_show(btn);
+ elm_box_pack_end(box, btn);
+
+ /* Next Page Button */
+ btn = elm_button_add(grid);
+ evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 1.0);
+ elm_object_text_set(btn, "Next");
+ evas_object_smart_callback_add(btn, "clicked", next_btn_clicked_cb, ad);
+ evas_object_show(btn);
+ elm_box_pack_end(box, btn);
+
+ elm_object_content_set(scroller, grid);
+
+ return scroller;
+}
+
Evas_Object*
create_content(Evas_Object *parent, const char *text, Evas_Smart_Cb prev_btn_clicked_cb, Evas_Smart_Cb next_btn_clicked_cb, appdata_s *ad)
{
ui_viewmgr *viewmgr;
} appdata_s;
+Evas_Object *create_landscape_content(Evas_Object *parent, const char *text, Evas_Smart_Cb prev_btn_clicked_cb, Evas_Smart_Cb next_btn_clicked_cb, appdata_s *ad);
Evas_Object *create_content(Evas_Object *parent, const char *text, Evas_Smart_Cb prev_btn_clicked_cb, Evas_Smart_Cb next_btn_clicked_cb, appdata_s *ad);
Elm_Toolbar *create_toolbar(Evas_Object *parent, const char *style);
--- /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.
+ *
+ */
+class page10: public ui_controller
+{
+private:
+ appdata_s *ad;
+
+public:
+ page10(appdata_s *ad)
+ : ad(ad)
+ {
+ /* ui_view(controller, identity name).
+ Later, you could get the identity name using view->get_name(); */
+ ad->viewmgr->push_view(new ui_view(this, "page10"));
+ }
+
+ ~page10()
+ {
+ }
+
+ Evas_Object *create_page10_content(ui_view *view, bool is_portrait)
+ {
+ Evas_Object *content;
+
+ if (is_portrait)
+ {
+ //Create portrait content.
+ content = create_content(view->get_base(),
+ "ViewMgr Demo<br>Page 10 With<br>on_portrait(), on_landscape()",
+ //Prev Button Callback
+ [](void *data, Evas_Object *obj, void *event_info) -> void
+ {
+ appdata_s *ad = static_cast<appdata_s *>(data);
+ ad->viewmgr->pop_view();
+ },
+ //Next Button Callback
+ [](void *data, Evas_Object *obj, void *event_info) -> void
+ {
+ appdata_s *ad = static_cast<appdata_s *>(data);
+ create_page11(ad);
+ },
+ this->ad);
+ }
+ else
+ {
+ //Create landscape content.
+ content = create_landscape_content(view->get_base(),
+ "ViewMgr Demo<br>Page 10 With<br>on_portrait(), on_landscape()",
+ //Prev Button Callback
+ [](void *data, Evas_Object *obj, void *event_info) -> void
+ {
+ appdata_s *ad = static_cast<appdata_s *>(data);
+ ad->viewmgr->pop_view();
+ },
+ //Next Button Callback
+ [](void *data, Evas_Object *obj, void *event_info) -> void
+ {
+ appdata_s *ad = static_cast<appdata_s *>(data);
+ create_page11(ad);
+ },
+ this->ad);
+ }
+
+ return content;
+ }
+
+ void on_load()
+ {
+ Evas_Object *content;
+
+ //Initialize contents.
+ ui_view *view = dynamic_cast<ui_view *>(this->get_view());
+
+ //FIXME: Change below code to more convenient and clear way.
+ if (view->get_degree() == 90 || view->get_degree() == 270)
+ this->on_landscape();
+ else
+ this->on_portrait();
+ }
+
+ void on_portrait()
+ {
+ Evas_Object *content;
+
+ ui_view *view = dynamic_cast<ui_view *>(this->get_view());
+
+ content = this->create_page10_content(view, true);
+ view->set_content(content, "Title Portrait");
+ }
+
+ void on_landscape()
+ {
+ Evas_Object *content;
+
+ ui_view *view = dynamic_cast<ui_view *>(this->get_view());
+
+ content = this->create_page10_content(view, false);
+ view->set_content(content, "Title Landscape");
+ }
+
+};
+
+void create_page10(appdata_s *ad)
+{
+ new page10(ad);
+}
--- /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.
+ *
+ */
+
+class page11: public ui_view
+{
+private:
+ appdata_s *ad;
+
+protected:
+ Evas_Object *create_page11_content(bool is_portrait)
+ {
+ Evas_Object *content;
+
+ if (is_portrait)
+ {
+ //Create portrait content.
+ content = create_content(this->get_base(), "ViewMgr Demo<br>Page 11 (View inheritance)<br>With on_rotate()",
+ //Prev Button Callback
+ [](void *data, Evas_Object *obj, void *event_info) -> void
+ {
+ appdata_s *ad = static_cast<appdata_s *>(data);
+ ad->viewmgr->pop_view();
+ },
+ //Next Button Callback
+ [](void *data, Evas_Object *obj, void *event_info) -> void
+ {
+ appdata_s *ad = static_cast<appdata_s *>(data);
+ ad->viewmgr->deactivate();
+ },
+ this->ad);
+ }
+ else
+ {
+ //Create landscape content.
+ content = create_landscape_content(this->get_base(), "ViewMgr Demo<br>Page 11 (View inheritance)<br>With on_rotate()",
+ //Prev Button Callback
+ [](void *data, Evas_Object *obj, void *event_info) -> void
+ {
+ appdata_s *ad = static_cast<appdata_s *>(data);
+ ad->viewmgr->pop_view();
+ },
+ //Next Button Callback
+ [](void *data, Evas_Object *obj, void *event_info) -> void
+ {
+ appdata_s *ad = static_cast<appdata_s *>(data);
+ ad->viewmgr->deactivate();
+ },
+ this->ad);
+ }
+
+ return content;
+ }
+
+ virtual void on_load()
+ {
+ this->on_rotate(this->get_degree());
+ }
+
+ virtual void on_rotate(int degree)
+ {
+ Evas_Object *content;
+
+ if (this->get_degree() == 0 || this->get_degree() == 180)
+ {
+ content = this->create_page11_content(true);
+ this->set_content(content, "Title Portrait");
+ }
+ else
+ {
+ content = this->create_page11_content(false);
+ this->set_content(content, "Title Landscape");
+ }
+ }
+
+public:
+ page11(const char *name, appdata_s *ad)
+ : ui_view(name), ad(ad)
+ {
+ ad->viewmgr->push_view(this);
+ }
+
+ ~page11()
+ {
+ }
+};
+
+void create_page11(appdata_s *ad)
+{
+ /* A example for view class extension instead of using controller class. */
+ new page11("page11", ad);
+}
[](void *data, Evas_Object *obj, void *event_info) -> void
{
appdata_s *ad = static_cast<appdata_s *>(data);
- ad->viewmgr->deactivate();
+ create_page10(ad);
},
this->ad);