From: Woochan Lee Date: Wed, 25 May 2016 09:09:06 +0000 (+0900) Subject: Prepare to inplement CAPIs. X-Git-Tag: submit/tizen/20160617.075742~31 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F17%2F71417%2F2;p=platform%2Fcore%2Fuifw%2Fui-viewmgr.git Prepare to inplement CAPIs. Change-Id: I00bfc68dd76954e252d47101621aa313a8f00330 --- diff --git a/packaging/ui-viewmgr.spec b/packaging/ui-viewmgr.spec index 6f4fde9..fc6d935 100644 --- a/packaging/ui-viewmgr.spec +++ b/packaging/ui-viewmgr.spec @@ -70,5 +70,6 @@ cp %{_builddir}/%{buildsubdir}/LICENSE %{buildroot}/usr/share/license/%{name} %{_includedir}/ui-viewmgr/interface/*.h %{_includedir}/ui-viewmgr/efl/*.h %{_includedir}/ui-viewmgr/efl/mobile/*.h +%{_includedir}/ui-viewmgr/efl/mobile/c/*.h %{_libdir}/*.so %{_libdir}/pkgconfig/ui-viewmgr.pc diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8596dc5..ef2796c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,4 +3,4 @@ LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/lib) ADD_SUBDIRECTORY(include) ADD_SUBDIRECTORY(lib) -ADD_SUBDIRECTORY(examples/efl) +ADD_SUBDIRECTORY(examples/efl/cpp) diff --git a/src/examples/efl/CMakeLists.txt b/src/examples/efl/CMakeLists.txt deleted file mode 100644 index 53ef473..0000000 --- a/src/examples/efl/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -SET(SRCS - contents.cpp - main.cpp - ) - -ADD_EXECUTABLE(${BINNAME} ${SRCS}) - -ADD_DEFINITIONS("-DBINDIR=\"${BINDIR}\"") - -PKG_CHECK_MODULES(BIN_PKGS REQUIRED elementary dlog capi-appfw-application capi-system-system-settings appcore-efl capi-appfw-app-manager) - -FOREACH(flag ${BIN_PKGS_CFLAGS}) - SET(PKG_CFLAGS "${PKG_CFLAGS} ${flag}") -ENDFOREACH(flag) - -SET_TARGET_PROPERTIES(${BINNAME} PROPERTIES COMPILE_FLAGS "${PKG_CFLAGS}" LINK_FLAGS -pie) -TARGET_LINK_LIBRARIES(${BINNAME} ${BIN_PKGS_LDFLAGS} ${LIBNAME}) - -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PKG_CFLAGS}") - -INSTALL(TARGETS ${BINNAME} DESTINATION ${BINDIR}/bin) diff --git a/src/examples/efl/c/CMakeLists.txt b/src/examples/efl/c/CMakeLists.txt new file mode 100644 index 0000000..d287512 --- /dev/null +++ b/src/examples/efl/c/CMakeLists.txt @@ -0,0 +1,20 @@ +SET(SRCS + main.cpp + ) + +ADD_EXECUTABLE(${BINNAME} ${SRCS}) + +ADD_DEFINITIONS("-DBINDIR=\"${BINDIR}\"") + +PKG_CHECK_MODULES(BIN_PKGS REQUIRED elementary dlog capi-appfw-application capi-system-system-settings appcore-efl capi-appfw-app-manager) + +FOREACH(flag ${BIN_PKGS_CFLAGS}) + SET(PKG_CFLAGS "${PKG_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET_TARGET_PROPERTIES(${BINNAME} PROPERTIES COMPILE_FLAGS "${PKG_CFLAGS}" LINK_FLAGS -pie) +TARGET_LINK_LIBRARIES(${BINNAME} ${BIN_PKGS_LDFLAGS} ${LIBNAME}) + +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PKG_CFLAGS}") + +INSTALL(TARGETS ${BINNAME} DESTINATION ${BINDIR}/bin) diff --git a/src/examples/efl/c/main.c b/src/examples/efl/c/main.c new file mode 100644 index 0000000..2bcea7a --- /dev/null +++ b/src/examples/efl/c/main.c @@ -0,0 +1,1215 @@ +/* + * 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 "main.h" + +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) +{ + char buf[PATH_MAX]; + 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), "%s/data/images/tizen.png", BINDIR); + 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, NULL); + 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, NULL); + evas_object_show(btn); + elm_box_pack_end(box, btn); + + elm_object_content_set(scroller, grid); + + return scroller; +} + +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) +{ + Elm_Grid *grid; + Elm_Box *box; + Elm_Layout *layout; + Elm_Button *btn; + + /* Grid */ + grid = elm_grid_add(parent); + 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", NULL); + evas_object_show(layout); + elm_grid_pack(grid, layout, 0, 0, 100, 100); + + /* 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, 25, 15, 50, 50); + + /* Title Show 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, "Title Show"); + evas_object_smart_callback_add(btn, "clicked", title_show_btn_clicked_cb, view); + evas_object_show(btn); + elm_box_pack_end(box, btn); + + /* Title Hide 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, "Title Hide"); + evas_object_smart_callback_add(btn, "clicked", title_hide_btn_clicked_cb, view); + evas_object_show(btn); + elm_box_pack_end(box, btn); + + /* Title Show Anim 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, "Title Show Anim"); + evas_object_smart_callback_add(btn, "clicked", title_show_anim_btn_clicked_cb, view); + evas_object_show(btn); + elm_box_pack_end(box, btn); + + /* Title Hide Anim 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, "Title Hide Anim"); + evas_object_smart_callback_add(btn, "clicked", title_hide_anim_btn_clicked_cb, view); + evas_object_show(btn); + elm_box_pack_end(box, btn); + + /* 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, 1.0); + 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, NULL); + 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, NULL); + evas_object_show(btn); + elm_box_pack_end(box, btn); + + return grid; +} + +Evas_Object* +create_scrolling_content(Evas_Object *parent) +{ + char buf[PATH_MAX]; + Elm_Image *image; + + /* Image */ + image = elm_image_add(parent); + snprintf(buf, sizeof(buf), "%s/data/images/bg.png", BINDIR); + elm_image_file_set(image, buf, NULL); + elm_image_resizable_set(image, EINA_FALSE, EINA_FALSE); + evas_object_show(image); + + return image; +} + +Evas_Object* +create_content(Evas_Object *parent, const char *text, Evas_Smart_Cb prev_btn_clicked_cb, Evas_Smart_Cb next_btn_clicked_cb) +{ + Elm_Grid *grid; + Elm_Box *box; + Elm_Layout *layout; + Elm_Scroller *scroller; + Elm_Button *btn; + + /* 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, 100, 100); + + /* 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, NULL); + 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, NULL); + evas_object_show(btn); + elm_box_pack_end(box, btn); + + elm_object_content_set(scroller, grid); + + return scroller; +} + +Elm_Toolbar* +create_toolbar(Evas_Object *parent, const char *style) +{ + Elm_Toolbar *toolbar; + + toolbar = elm_toolbar_add(parent); + + //FIXME: :( UI_View can set this style instead. + elm_object_style_set(toolbar, style); + + //FIXME: If not call below API, toolbar items create with min size. + // It looks toolbar bug. + elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_EXPAND); + + elm_toolbar_item_append(toolbar, NULL, "Tab1", NULL, NULL); + elm_toolbar_item_append(toolbar, NULL, "Tab2", NULL, NULL); + elm_toolbar_item_append(toolbar, NULL, "Tab3", NULL, NULL); + elm_toolbar_item_append(toolbar, NULL, "Tab4", NULL, NULL); + + return toolbar; +} + +//================================================================================= +//================================== View 16 ====================================== +//================================================================================= + +static void +view16_prev_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + UI_VIEWMGR_VIEW_POP(); +} + +static void +view16_next_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + UI_VIEWMGR_DEACTIVATE(); +} + +static void +view16_title_show_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + ui_view *view = data; + ui_standard_view_title_visible_set(view, true, false); +} + +static void +view16_title_hide_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + ui_view *view = data; + ui_standard_view_title_visible_set(view, false, false); +} + +static void +view16_title_show_anim_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + ui_view *view = data; + ui_standard_view_title_visible_set(view, true, true); +} + +static void +view16_title_hide_anim_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + ui_view *view = data; + ui_standard_view_title_visible_set(view, false, true); +} + +static void +view16_load_cb(ui_view *view, void *data) +{ + Evas_Object *base_layout = ui_view_base_get(view); + + Evas_Object *content = create_title_handle_content(this->get_base(), + view16_prev_btn_clicked_cb, view16_next_btn_clicked_cb, + view16_title_show_btn_clicked_cb, view16_title_hide_btn_clicked_cb, + view16_title_show_anim_btn_clicked_cb, view16_title_hide_anim_btn_clicked_cb, view); + + ui_standard_view_content_set(view, content, "Page16", NULL, NULL); +} + +static void +create_page16() +{ + ui_view_lifecycle_callback_s lifecycle_callback = {0, }; + + lifecycle_callback.load = view16_load_cb; + + ui_view *view = ui_standard_view_create("page16"); + + int ret = ui_view_lifecycle_callbacks_set(view, &lifecycle_callback, NULL); + if (ret != 0) + { + //TODO + } + + UI_VIEWMGR_VIEW_PUSH(view); +} + +//================================================================================= +//================================== View 15 ====================================== +//================================================================================= + +static void +view15_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + create_page16(); +} + +static void +view15_load_cb(ui_view *view, void *data) +{ + Evas_Object *base_layout = ui_view_base_get(view); + + Evas_Object *content = create_scrolling_content(base_layout); + + ui_standard_view_content_set(view, content, "Page 15 Scroller In Viewmgr", NULL, NULL); + + //Title Right button + Elm_Button *right_btn = elm_button_add(this->get_base()); + elm_object_text_set(right_btn, "Next"); + evas_object_smart_callback_add(right_btn, "clicked", view15_btn_clicked_cb, NULL); + + ui_standard_view_title_right_btn_set(view, right_btn); +} + +static void +create_page15() +{ + ui_view_lifecycle_callback_s lifecycle_callback = {0, }; + + lifecycle_callback.load = view15_load_cb; + + ui_view *view = ui_standard_view_create("page15"); + + int ret = ui_view_lifecycle_callbacks_set(view, &lifecycle_callback, NULL); + if (ret != 0) + { + //TODO + } + + UI_VIEWMGR_VIEW_PUSH(view); +} + +//================================================================================= +//================================== View 14 ====================================== +//================================================================================= + +static void +view14_prev_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + UI_VIEWMGR_VIEW_POP(); +} + +static void +view14_next_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + create_page15(); +} + +static void +view14_load_cb(ui_view *view, void *data) +{ + Evas_Object *base_layout = ui_view_base_get(view); + + Evas_Object *content = create_content(base_layout, "ViewMgr Demo
None Transition", + view14_prev_btn_clicked_cb, view14_next_btn_clicked_cb); + + ui_standard_view_content_set(view, content, "Page14", NULL, NULL); +} + +static void +create_page14() +{ + ui_view_lifecycle_callback_s lifecycle_callback = {0, }; + + lifecycle_callback.load = view14_load_cb; + + ui_view *view = ui_standard_view_create("page14"); + ui_view_transition_style_set(view, "none"); + + int ret = ui_view_lifecycle_callbacks_set(view, &lifecycle_callback, NULL); + if (ret != 0) + { + //TODO + } + + UI_VIEWMGR_VIEW_PUSH(view); +} + +//================================================================================= +//================================== View 13 ====================================== +//================================================================================= + +static void +view13_prev_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + UI_VIEWMGR_VIEW_POP(); +} + +static void +view13_next_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + create_page14(); +} + +static void +view13_load_cb(ui_view *view, void *data) +{ + Evas_Object *base_layout = ui_view_base_get(view); + + Evas_Object *content = create_content(base_layout, "ViewMgr Demo
Fade Transition", + view13_prev_btn_clicked_cb, view13_next_btn_clicked_cb); + + ui_standard_view_content_set(view, content, "Page13", NULL, NULL); +} + +static void +create_page13() +{ + ui_view_lifecycle_callback_s lifecycle_callback = {0, }; + + lifecycle_callback.load = view13_load_cb; + + ui_view *view = ui_standard_view_create("page13"); + ui_view_transition_style_set(view, "fade"); + + int ret = ui_view_lifecycle_callbacks_set(view, &lifecycle_callback, NULL); + if (ret != 0) + { + //TODO + } + + UI_VIEWMGR_VIEW_PUSH(view); +} + +//================================================================================= +//================================== View 12 ====================================== +//================================================================================= + +static void +view12_prev_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + UI_VIEWMGR_VIEW_POP(); +} + +static void +view12_next_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + create_page13(); +} + +static void +popup_block_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + elm_poopup_dismiss(obj); +} + +static void +popup_timeout_cb(void *data, Evas_Object *obj, void *event_info) +{ + elm_poopup_dismiss(obj); +} +static void +popup_dismissed_cb(void *data, Evas_Object *obj, void *event_info) +{ + //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_popup *popup = data; + + //Is It right? + ui_popup_del(popup); +} + +static void +view12_btn_clicked(void *data, Evas_Object *obj, void *event_info) +{ + ui_view *view = data; + + //Create popup. + //FIXME: is overlay a proper name? + ui_popup *popup = ui_popup_create(view); + + Elm_Popup *obj = elm_popup_add(ui_view_base_get(view)); + 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", popup_block_clicked_cb. NULL); + evas_object_smart_callback_add(obj, "timeout", popup_timeout_cb, NULL); + + ui_popup_content_set(popup, obj); + ui_popup_activate(popup); +} + +static void +view12_load_cb(ui_view *view, void *data) +{ + Evas_Object *base_layout = ui_view_base_get(view); + + Evas_Object *content = create_content(base_layout, "ViewMgr Demo
Popup", + view12_prev_btn_clicked_cb, view12_next_btn_clicked_cb); + + ui_standard_view_content_set(view, content, "Page12", NULL, NULL); + + //Title Right button + Elm_Button *right_btn = elm_button_add(base_layout); + elm_object_text_set(right_btn, "popup"); + evas_object_smart_callback_add(right_btn, "clicked", view12_btn_clicked, view); + + ui_standard_view_title_right_btn_set(view, right_btn); +} + +static void +create_page12() +{ + ui_view_lifecycle_callback_s lifecycle_callback = {0, }; + lifecycle_callback.load = view12_load_cb; + + ui_view *view = ui_standard_view_create("page12"); + + int ret = ui_view_lifecycle_callbacks_set(view, &lifecycle_callback, NULL); + if (ret != 0) + { + //TODO + } + + UI_VIEWMGR_VIEW_PUSH(view); +} + +//================================================================================= +//================================== View 11 ====================================== +//================================================================================= + + +static void +view11_prev_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) + ol ui_popup_content_set(ui_popup *popup, Elm_Popup *popup); + bool ui_popup_activate(ui_popup *popup); + +{ + UI_VIEWMGR_VIEW_POP(); +} + +static void +view11_next_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + create_page12(); +} + +static void +view11_load_cb(ui_view *view, void *data) +{ + Evas_Object *base_layout = ui_view_base_get(view); + + Evas_Object *content = create_content(base_layout, "ViewMgr Demo
Menu Popup", + view11_prev_btn_clicked_cb, view11_next_btn_clicked_cb); + + ui_standard_view_content_set(view, content, "Page11", NULL, NULL); +} + +static void ctxpopup_item_select_cb(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Object_Item *it = event_info; + elm_ctxpopup_dismiss(obj); + LOGE("Item (%s) is selected", elm_object_item_text_get(it)); +} + +static void +view11_menu_cb(ui_menu *menu, void *data) +{ + Elm_Ctxpopup *ctxpopup = elm_ctxpopup_add(menu->get_base()); + elm_ctxpopup_item_append(ctxpopup, "Phone calls", NULL, ctxpopup_item_select_cb, this); + elm_ctxpopup_item_append(ctxpopup, "Favorites", NULL, ctxpopup_item_select_cb, this); + elm_ctxpopup_item_append(ctxpopup, "Search", NULL, ctxpopup_item_select_cb, this); + elm_ctxpopup_item_append(ctxpopup, "Dialer", NULL, ctxpopup_item_select_cb, this); + elm_ctxpopup_item_append(ctxpopup, "Add contact", NULL, ctxpopup_item_select_cb, this); + elm_ctxpopup_item_append(ctxpopup, "Phone calls", NULL, ctxpopup_item_select_cb, this); + elm_ctxpopup_item_append(ctxpopup, "Favorites", NULL, ctxpopup_item_select_cb, this); + elm_ctxpopup_item_append(ctxpopup, "Search", NULL, ctxpopup_item_select_cb, this); + elm_ctxpopup_item_append(ctxpopup, "Dialer", NULL, ctxpopup_item_select_cb, this); + + ui_menu_content_set(menu, ctxpopup); +} + +static void +create_page11() +{ + ui_view_lifecycle_callback_s lifecycle_callback = {0, }; + + lifecycle_callback.load = view11_load_cb; + event_callback.menu = view11_menu_cb; + + ui_view *view = ui_standard_view_create("page11"); + + int ret = ui_view_lifecycle_callbacks_set(view, &lifecycle_callback, NULL); + if (ret != 0) + { + //TODO + } + + int ret = ui_view_event_callbacks_set(view, &event_callback, NULL); + if (ret != 0) + { + //TODO + } + + UI_VIEWMGR_VIEW_PUSH(view); +} + +//================================================================================= +//================================== View 10 ====================================== +//================================================================================= + +static void +view10_prev_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + UI_VIEWMGR_VIEW_POP(); +} + +static void +view10_next_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + create_page11(); +} + +static void +view10_rotate_cb(ui_view *view, int degree, void *data) +{ + Evas_Object *base_layout = ui_view_base_get(view); + + if (degree == 0 || degree == 180) + { + Evas_Object *content = create_content(base_layout, "ViewMgr Demo
Rotation", + view10_prev_btn_clicked_cb, view10_next_btn_clicked_cb); + + ui_standard_view_content_set(view, content, "Page10", NULL, NULL); + ui_view_indicator_set(view, UI_VIEW_INDICATOR_DEFAULT); + } + else + { + Evas_Object *content = create_content(base_layout, "ViewMgr Demo
Rotation", + view10_prev_btn_clicked_cb, view10_next_btn_clicked_cb); + + ui_standard_view_content_set(view, content, "Page10", NULL. NULL); + ui_view_indicator_set(view, UI_VIEW_INDICATOR_OPTIMAL); + } +} + +static void +view10_load_cb(ui_view *view, void *data) +{ + view10_rotate_cb(view, data); +} + +static void +create_page10() +{ + ui_view_lifecycle_callback_s lifecycle_callback = {0, }; + ui_view_event_callback_s event_callback = {0, }; + + lifecycle_callback.load = view10_load_cb; + event_callback.rotate = view10_rotate_cb; + + ui_view *view = ui_standard_view_create("page10"); + + int ret = ui_view_lifecycle_callbacks_set(view, &lifecycle_callback, NULL); + if (ret != 0) + { + //TODO + } + + int ret = ui_view_event_callbacks_set(view, &event_callback, NULL); + if (ret != 0) + { + //TODO + } + + UI_VIEWMGR_VIEW_PUSH(view); +} + +//================================================================================ +//================================== View 9 ====================================== +//================================================================================ + +static void +view9_prev_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + UI_VIEWMGR_VIEW_POP(); +} + +static void +view9_next_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + create_page10(); +} + +static void +view9_portrait_cb(ui_view *view, void *data) +{ + Evas_Object *base_layout = ui_view_base_get(view); + + Evas_Object *content = create_content(base_layout, "ViewMgr Demo
Portrait/Landscape", + view9_prev_btn_clicked_cb, view9_next_btn_clicked_cb); + + ui_standard_view_content_set(view, content, "Page9", NULL, NULL); + ui_view_indicator_set(view, UI_VIEW_INDICATOR_DEFAULT); +} + +static void +view9_landscape_cb(ui_view *view, void *data) +{ + Evas_Object *base_layout = ui_view_base_get(view); + + Evas_Object *content = create_content(base_layout, "ViewMgr Demo
Portrait/Landscape", + view9_prev_btn_clicked_cb, view9_next_btn_clicked_cb); + + ui_standard_view_content_set(view, content, "Page9", NULL, NULL); + ui_view_indicator_set(view, UI_VIEW_INDICATOR_OPTIMAL); +} + +static void +view9_load_cb(ui_view *view, void *data) +{ + if (ui_view_degree_get(view) == 90 || ui_view_degree_get(view) == 270) + view9_landscape_cb(view, data); + else + view9_portrait_cb(view, data); +} + +static void +create_page9() +{ + ui_view_lifecycle_callback_s lifecycle_callback = {0, }; + ui_view_event_callback_s event_callback = {0, }; + + lifecycle_callback.load = view9_load_cb; + + event_callback.portrait = view9_portrait_cb; + event_callback.landscape = view9_landscape_cb; + + ui_view *view = ui_standard_view_create("page9"); + + int ret = ui_view_lifecycle_callbacks_set(view, &lifecycle_callback, NULL); + if (ret != 0) + { + //TODO + } + + int ret = ui_view_event_callbacks_set(view, &event_callback, NULL); + if (ret != 0) + { + //TODO + } + + UI_VIEWMGR_VIEW_PUSH(view); +} + +//================================================================================ +//================================== View 8 ====================================== +//================================================================================ + +static void +view8_prev_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + UI_VIEWMGR_VIEW_POP(); +} + +static void +view8_next_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + create_page9(); +} + +static void +create_page8() +{ + ui_view_lifecycle_callback_s lifecycle_callback = {0, }; + ui_view *view = ui_standard_view_create("page7"); + + Evas_Object *base_layout = ui_view_base_get(view); + + Evas_Object *content = create_content(base_layout, "ViewMgr Demo
Content Preload", + view8_prev_btn_clicked_cb, view8_next_btn_clicked_cb); + + ui_view_removable_content(view, false); + ui_standard_view_content_set(view, content, "Page7", NULL, NULL); + + UI_VIEWMGR_VIEW_PUSH(view); +} + +//================================================================================ +//================================== View 7 ====================================== +//================================================================================ + +static void +view7_prev_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + UI_VIEWMGR_VIEW_POP(); +} + +static void +view7_next_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + create_page8(); +} + +static void +view7_load_cb(ui_view *view, void *data) +{ + Evas_Object *base_layout = ui_view_base_get(view); + + Evas_Object *content = create_content(base_layout, "ViewMgr Demo
Navigationbarr", + view7_prev_btn_clicked_cb, view7_next_btn_clicked_cb); + + ui_standard_view_content_set(view, content, "Page7", NULL, NULL); + Elm_Toolbar *toolbar = create_toolbar(base_layout, "navigarionbar"); + ui_standard_view_toolbar_set(view, toolbar); +} + +static void +create_page7() +{ + ui_view_lifecycle_callback_s lifecycle_callback = {0, }; + + lifecycle_callback.load = view7_load_cb; + + ui_view *view = ui_standard_view_create("page7"); + + int ret = ui_view_lifecycle_callbacks_set(view, &lifecycle_callback, NULL); + if (ret != 0) + { + //TODO + } + + UI_VIEWMGR_VIEW_PUSH(view); +} + +//================================================================================ +//================================== View 6 ====================================== +//================================================================================ + +static void +view6_prev_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + UI_VIEWMGR_VIEW_POP(); +} + +static void +view6_next_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + create_page7(); +} + +static void +view6_load_cb(ui_view *view, void *data) +{ + Evas_Object *base_layout = ui_view_base_get(view); + + Evas_Object *content = create_content(base_layout, "ViewMgr Demo
Toolbar", + view6_prev_btn_clicked_cb, view6_next_btn_clicked_cb); + + ui_standard_view_content_set(view, content, "Page6", NULL, NULL); + Elm_Toolbar *toolbar = create_toolbar(base_layout, "toolbar_with_title"); + ui_standard_view_toolbar_set(view, toolbar); +} + +static void +create_page6() +{ + ui_view_lifecycle_callback_s lifecycle_callback = {0, }; + lifecycle_callback.load = view6_load_cb; + + ui_view *view = ui_standard_view_create("page6"); + + int ret = ui_view_lifecycle_callbacks_set(view, &lifecycle_callback, NULL); + if (ret != 0) + { + //TODO + } + + UI_VIEWMGR_VIEW_PUSH(view); +} + +//================================================================================ +//================================== View 5 ====================================== +//================================================================================ + +static void +view5_prev_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + UI_VIEWMGR_VIEW_POP(); +} + +static void +view5_next_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + create_page6(); +} + +static void +view5_load_cb(ui_view *view, void *data) +{ + Evas_Object *base_layout = ui_view_base_get(view); + + Evas_Object *content = create_content(base_layout, "ViewMgr Demo
Full View", + view5_prev_btn_clicked_cb, view5_next_btn_clicked_cb); + + ui_view_content_set(view, content); + ui_view_indicator_set(view, UI_VIEW_INDICATOR_HIDE); +} + +static void +create_page5() +{ + ui_view_lifecycle_callback_s lifecycle_callback = {0, }; + + lifecycle_callback.load = view5_load_cb; + + ui_view *view = ui_view_create("page5"); + + int ret = ui_view_lifecycle_callbacks_set(view, &lifecycle_callback, NULL); + if (ret != 0) + { + //TODO + } + + UI_VIEWMGR_VIEW_PUSH(view); +} + +//================================================================================ +//================================== View 4 ====================================== +//================================================================================ + +static void +view4_prev_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + UI_VIEWMGR_VIEW_POP(); +} + +static void +view4_next_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + create_page5(); +} + +static void +view4_load_cb(ui_view *view, void *data) +{ + Evas_Object *base_layout = ui_view_base_get(view); + + Evas_Object *content = create_content(base_layout, "ViewMgr Demo
Title Badge", + view4_prev_btn_clicked_cb, view4_next_btn_clicked_cb); + + ui_standard_view_content_set(view, content, "Page4 We put a long title here intentionally", NULL, NULL); + ui_standard_view_title_badge_set(view, "999+"); +} + +static void +create_page4() +{ + ui_view_lifecycle_callback_s lifecycle_callback = {0, }; + lifecycle_callback.load = view4_load_cb; + + ui_view *view = ui_standard_view_create("page4"); + + int ret = ui_view_lifecycle_callbacks_set(view, &lifecycle_callback, NULL); + if (ret != 0) + { + //TODO + } + + UI_VIEWMGR_VIEW_PUSH(view); +} + +//================================================================================ +//================================== View 3 ====================================== +//================================================================================ + +static void +view3_prev_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + UI_VIEWMGR_VIEW_POP(); +} + +static void +view3_next_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + create_page4(); +} + +static void +view3_load_cb(ui_view *view, void *data) +{ + Evas_Object *base_layout = ui_view_base_get(view); + + Evas_Object *content = create_content(base_layout, "ViewMgr Demo
Subtitle", + view3_prev_btn_clicked_cb, view3_next_btn_clicked_cb); + + ui_standard_view_content_set(view, content, "Page3", "Subtitle", NULL, NULL); +} + +static void +create_page3() +{ + ui_view_lifecycle_callback_s lifecycle_callback = {0, }; + + lifecycle_callback.load = view3_load_cb; + + ui_view *view = ui_standard_view_create("page3"); + + int ret = ui_view_lifecycle_callbacks_set(view, &lifecycle_callback, NULL); + if (ret != 0) + { + //TODO + } + + UI_VIEWMGR_VIEW_PUSH(view); +} + +//================================================================================ +//================================== View 2 ====================================== +//================================================================================ + +static void +view2_prev_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + UI_VIEWMGR_VIEW_POP(); +} + +static void +view2_next_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + create_page3(); +} + +static void +view2_load_cb(ui_view *view, void *data) +{ + Evas_Object *base_layout = ui_view_base_get(view); + + Evas_Object *content = create_content(base_layout, "ViewMgr Demo
Title Buttons", + view2_prev_btn_clicked_cb, view2_next_btn_clicked_cb); + + //Title left button + Elm_Button *left_title_btn = elm_button_add(this->get_base()); + elm_object_text_set(left_title_btn, "Cancel"); + + //Title right button + Elm_Button *right_title_btn = elm_button_add(this->get_base()); + elm_object_text_set(right_title_btn, "Done"); + + ui_standard_view_content_set(view, content, "Page2", NULL, left_title_btn, right_title_btn); +} + +static void +create_page2() +{ + ui_view_lifecycle_callback_s lifecycle_callback = {0, }; + + lifecycle_callback.load = view2_load_cb; + + ui_view *view = ui_standard_view_create("page2"); + + int ret = ui_view_lifecycle_callbacks_set(view, &lifecycle_callback, NULL); + if (ret != 0) + { + //TODO + } + + UI_VIEWMGR_VIEW_PUSH(view); +} + +//================================================================================ +//================================== View 1 ====================================== +//================================================================================ + +static void +view1_prev_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + UI_VIEWMGR_DEACTIVATE(); +} + +static void +view1_next_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + create_page2(); +} + +static void +view1_load_cb(ui_view *view, void *data) +{ + Evas_Object *base_layout = ui_view_base_get(view); + + Evas_Object *content = create_content(base_layout, "ViewMgr Demo
Page 1", + view1_prev_btn_clicked_cb, view1_next_btn_clicked_cb); + + ui_standard_view_content_set(view, content, "Page1", NULL, NULL, NULL); +} + +static void +create_page1() +{ + ui_view_lifecycle_callback_s lifecycle_callback = {0, }; + + lifecycle_callback.load = view1_load_cb; + + ui_view *view = ui_standard_view_create("page1"); + + int ret = ui_view_lifecycle_callbacks_set(view, &lifecycle_callback, NULL); + if (ret != 0) + { + //TODO + } + + UI_VIEWMGR_VIEW_PUSH(view); +} + +static bool +app_create(void *data) +{ + create_page1(); + + return true; +} + +int +main(int argc, char *argv[]) +{ + appdata_s ad = {0,}; + int ret; + + ui_app_lifecycle_callback_s event_callback = {0,}; + + 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; + + ret = ui_app_init(PACKAGE, LOCALE_DIR); + if (ret != 0) + { + //TODO + return ret; + } + + app_event_handler_h handlers[5] = {NULL, }; + + ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, &ad); + ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, &ad); + ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, &ad); + ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, &ad); + ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, &ad) + + + return ui_app_run(argc, argv, &event_callback, &ad); +} diff --git a/src/examples/efl/c/main.cpp b/src/examples/efl/c/main.cpp new file mode 100644 index 0000000..9146310 --- /dev/null +++ b/src/examples/efl/c/main.cpp @@ -0,0 +1,50 @@ +//This is to check CAPIs. +#include "main.h" + +static bool +app_create(void *data) +{ + ui_app_init(NULL, NULL); + ui_app_run(0, NULL, NULL, NULL); + ui_menu_content_set(NULL, NULL); + ui_popup_content_set(NULL, NULL); + ui_popup_activate(NULL); + ui_popup_del(NULL); + ui_standard_view_create(NULL); + ui_view_lifecycle_callbacks_set(NULL, NULL, NULL); + ui_view_base_get(NULL); + ui_view_content_set(NULL, NULL); + ui_standard_view_content_set(NULL, NULL, NULL, NULL, NULL, NULL); + ui_standard_view_title_badge_set(NULL, NULL); + ui_view_indicator_set(NULL, UI_VIEW_INDICATOR_DEFAULT); + ui_standard_view_toolbar_set(NULL, NULL); + ui_view_removable_content(NULL, false); + ui_view_event_callbacks_set(NULL, NULL, NULL); + ui_standard_view_title_right_btn_set(NULL, NULL); + ui_standard_view_title_visible_set(NULL, false, false); + UI_VIEWMGR_VIEW_DEACTIVATE(); + UI_VIEWMGR_VIEW_PUSH(NULL); + UI_VIEWMGR_VIEW_POP(); + + return true; +} + +int +main(int argc, char *argv[]) +{ + appdata_s ad = {0,}; + int ret = 0; + + ui_app_lifecycle_callback_s event_callback = {0,}; + + ret = ui_app_init(PACKAGE, LOCALE_DIR); + + event_callback.create = app_create; + + ret = ui_app_main(argc, argv, &event_callback, &ad); + if (ret != APP_ERROR_NONE) { + dlog_print(DLOG_ERROR, LOG_TAG, "ui_app_main() is failed. err = %d", ret); + } + + return ret; +} diff --git a/src/examples/efl/c/main.h b/src/examples/efl/c/main.h new file mode 100644 index 0000000..8510c3d --- /dev/null +++ b/src/examples/efl/c/main.h @@ -0,0 +1,43 @@ +/* + * 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 +#include + +//uncomment if you want debug +#ifndef TIZEN_ENGINEER_MODE +#define TIZEN_ENGINEER_MODE +#endif + +#ifdef LOG_TAG +#undef LOG_TAG +#endif +#define LOG_TAG "UI_VIEWMGR" + +#if !defined(PACKAGE) +#define PACKAGE "ui-viewmgr" +#endif + +typedef struct appdata { + Evas_Object *win; + Evas_Object *conform; + Evas_Object *layout; + Evas_Object *nf; + Evas_Object *tabbar; +} appdata_s; diff --git a/src/examples/efl/contents.cpp b/src/examples/efl/contents.cpp deleted file mode 100644 index 31be69e..0000000 --- a/src/examples/efl/contents.cpp +++ /dev/null @@ -1,280 +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 "main.h" - -Elm_Toolbar* -create_toolbar(Evas_Object *parent, const char *style) -{ - Elm_Toolbar *toolbar; - - toolbar = elm_toolbar_add(parent); - - //FIXME: :( UI_View can set this style instead. - elm_object_style_set(toolbar, style); - - //FIXME: If not call below API, toolbar items create with min size. - // It looks toolbar bug. - elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_EXPAND); - - elm_toolbar_item_append(toolbar, NULL, "Tab1", NULL, NULL); - elm_toolbar_item_append(toolbar, NULL, "Tab2", NULL, NULL); - elm_toolbar_item_append(toolbar, NULL, "Tab3", NULL, NULL); - elm_toolbar_item_append(toolbar, NULL, "Tab4", NULL, NULL); - - return toolbar; -} - -Evas_Object* -create_scrolling_content(Evas_Object *parent) -{ - char buf[PATH_MAX]; - Elm_Image *image; - - /* Image */ - image = elm_image_add(parent); - snprintf(buf, sizeof(buf), "%s/data/images/bg.png", BINDIR); - elm_image_file_set(image, buf, NULL); - elm_image_resizable_set(image, EINA_FALSE, EINA_FALSE); - evas_object_show(image); - - return image; -} - -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) -{ - char buf[PATH_MAX]; - 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), "%s/data/images/tizen.png", BINDIR); - 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, NULL); - 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, NULL); - evas_object_show(btn); - elm_box_pack_end(box, btn); - - elm_object_content_set(scroller, grid); - - return scroller; -} - -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) -{ - Elm_Grid *grid; - Elm_Box *box; - Elm_Layout *layout; - Elm_Button *btn; - - /* Grid */ - grid = elm_grid_add(parent); - 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", NULL); - evas_object_show(layout); - elm_grid_pack(grid, layout, 0, 0, 100, 100); - - /* 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, 25, 15, 50, 50); - - /* Title Show 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, "Title Show"); - evas_object_smart_callback_add(btn, "clicked", title_show_btn_clicked_cb, view); - evas_object_show(btn); - elm_box_pack_end(box, btn); - - /* Title Hide 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, "Title Hide"); - evas_object_smart_callback_add(btn, "clicked", title_hide_btn_clicked_cb, view); - evas_object_show(btn); - elm_box_pack_end(box, btn); - - /* Title Show Anim 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, "Title Show Anim"); - evas_object_smart_callback_add(btn, "clicked", title_show_anim_btn_clicked_cb, view); - evas_object_show(btn); - elm_box_pack_end(box, btn); - - /* Title Hide Anim 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, "Title Hide Anim"); - evas_object_smart_callback_add(btn, "clicked", title_hide_anim_btn_clicked_cb, view); - evas_object_show(btn); - elm_box_pack_end(box, btn); - - /* 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, 1.0); - 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, NULL); - 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, NULL); - evas_object_show(btn); - elm_box_pack_end(box, btn); - - return grid; -} - -Evas_Object* -create_content(Evas_Object *parent, const char *text, Evas_Smart_Cb prev_btn_clicked_cb, Evas_Smart_Cb next_btn_clicked_cb) -{ - Elm_Grid *grid; - Elm_Box *box; - Elm_Layout *layout; - Elm_Scroller *scroller; - Elm_Button *btn; - - /* 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, 100, 100); - - /* 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, NULL); - 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, NULL); - evas_object_show(btn); - elm_box_pack_end(box, btn); - - elm_object_content_set(scroller, grid); - - return scroller; -} diff --git a/src/examples/efl/cpp/CMakeLists.txt b/src/examples/efl/cpp/CMakeLists.txt new file mode 100644 index 0000000..53ef473 --- /dev/null +++ b/src/examples/efl/cpp/CMakeLists.txt @@ -0,0 +1,21 @@ +SET(SRCS + contents.cpp + main.cpp + ) + +ADD_EXECUTABLE(${BINNAME} ${SRCS}) + +ADD_DEFINITIONS("-DBINDIR=\"${BINDIR}\"") + +PKG_CHECK_MODULES(BIN_PKGS REQUIRED elementary dlog capi-appfw-application capi-system-system-settings appcore-efl capi-appfw-app-manager) + +FOREACH(flag ${BIN_PKGS_CFLAGS}) + SET(PKG_CFLAGS "${PKG_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET_TARGET_PROPERTIES(${BINNAME} PROPERTIES COMPILE_FLAGS "${PKG_CFLAGS}" LINK_FLAGS -pie) +TARGET_LINK_LIBRARIES(${BINNAME} ${BIN_PKGS_LDFLAGS} ${LIBNAME}) + +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PKG_CFLAGS}") + +INSTALL(TARGETS ${BINNAME} DESTINATION ${BINDIR}/bin) diff --git a/src/examples/efl/cpp/contents.cpp b/src/examples/efl/cpp/contents.cpp new file mode 100644 index 0000000..31be69e --- /dev/null +++ b/src/examples/efl/cpp/contents.cpp @@ -0,0 +1,280 @@ +/* + * 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 "main.h" + +Elm_Toolbar* +create_toolbar(Evas_Object *parent, const char *style) +{ + Elm_Toolbar *toolbar; + + toolbar = elm_toolbar_add(parent); + + //FIXME: :( UI_View can set this style instead. + elm_object_style_set(toolbar, style); + + //FIXME: If not call below API, toolbar items create with min size. + // It looks toolbar bug. + elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_EXPAND); + + elm_toolbar_item_append(toolbar, NULL, "Tab1", NULL, NULL); + elm_toolbar_item_append(toolbar, NULL, "Tab2", NULL, NULL); + elm_toolbar_item_append(toolbar, NULL, "Tab3", NULL, NULL); + elm_toolbar_item_append(toolbar, NULL, "Tab4", NULL, NULL); + + return toolbar; +} + +Evas_Object* +create_scrolling_content(Evas_Object *parent) +{ + char buf[PATH_MAX]; + Elm_Image *image; + + /* Image */ + image = elm_image_add(parent); + snprintf(buf, sizeof(buf), "%s/data/images/bg.png", BINDIR); + elm_image_file_set(image, buf, NULL); + elm_image_resizable_set(image, EINA_FALSE, EINA_FALSE); + evas_object_show(image); + + return image; +} + +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) +{ + char buf[PATH_MAX]; + 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), "%s/data/images/tizen.png", BINDIR); + 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, NULL); + 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, NULL); + evas_object_show(btn); + elm_box_pack_end(box, btn); + + elm_object_content_set(scroller, grid); + + return scroller; +} + +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) +{ + Elm_Grid *grid; + Elm_Box *box; + Elm_Layout *layout; + Elm_Button *btn; + + /* Grid */ + grid = elm_grid_add(parent); + 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", NULL); + evas_object_show(layout); + elm_grid_pack(grid, layout, 0, 0, 100, 100); + + /* 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, 25, 15, 50, 50); + + /* Title Show 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, "Title Show"); + evas_object_smart_callback_add(btn, "clicked", title_show_btn_clicked_cb, view); + evas_object_show(btn); + elm_box_pack_end(box, btn); + + /* Title Hide 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, "Title Hide"); + evas_object_smart_callback_add(btn, "clicked", title_hide_btn_clicked_cb, view); + evas_object_show(btn); + elm_box_pack_end(box, btn); + + /* Title Show Anim 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, "Title Show Anim"); + evas_object_smart_callback_add(btn, "clicked", title_show_anim_btn_clicked_cb, view); + evas_object_show(btn); + elm_box_pack_end(box, btn); + + /* Title Hide Anim 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, "Title Hide Anim"); + evas_object_smart_callback_add(btn, "clicked", title_hide_anim_btn_clicked_cb, view); + evas_object_show(btn); + elm_box_pack_end(box, btn); + + /* 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, 1.0); + 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, NULL); + 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, NULL); + evas_object_show(btn); + elm_box_pack_end(box, btn); + + return grid; +} + +Evas_Object* +create_content(Evas_Object *parent, const char *text, Evas_Smart_Cb prev_btn_clicked_cb, Evas_Smart_Cb next_btn_clicked_cb) +{ + Elm_Grid *grid; + Elm_Box *box; + Elm_Layout *layout; + Elm_Scroller *scroller; + Elm_Button *btn; + + /* 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, 100, 100); + + /* 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, NULL); + 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, NULL); + evas_object_show(btn); + elm_box_pack_end(box, btn); + + elm_object_content_set(scroller, grid); + + return scroller; +} diff --git a/src/examples/efl/cpp/main.cpp b/src/examples/efl/cpp/main.cpp new file mode 100644 index 0000000..2f3de6f --- /dev/null +++ b/src/examples/efl/cpp/main.cpp @@ -0,0 +1,65 @@ +/* + * 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 "main.h" +#include "page16.h" +#include "page15.h" +#include "page14.h" +#include "page13.h" +#include "page12.h" +#include "page11.h" +#include "page10.h" +#include "page9.h" +#include "page8.h" +#include "page7.h" +#include "page6.h" +#include "page5.h" +#include "page4.h" +#include "page3.h" +#include "page2.h" +#include "page1.h" + +class sample_app: public ui_app +{ +public: + sample_app() + : ui_app(PACKAGE, LOCALE_DIR) + { + } + ~sample_app() + { + } + +protected: + bool on_create() + { + if (!ui_app::on_create()) + { + return false; + } + + //Push first view in viewmgr. + UI_VIEWMGR->push_view(new page1()); + + return true; + } +}; + +int main(int argc, char *argv[]) +{ + sample_app app; + return app.run(argc, argv); +} diff --git a/src/examples/efl/cpp/main.h b/src/examples/efl/cpp/main.h new file mode 100644 index 0000000..019651a --- /dev/null +++ b/src/examples/efl/cpp/main.h @@ -0,0 +1,40 @@ +/* + * 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 + +//uncomment if you want debug +#ifndef TIZEN_ENGINEER_MODE +#define TIZEN_ENGINEER_MODE +#endif + +#ifdef LOG_TAG +#undef LOG_TAG +#endif +#define LOG_TAG "UI_VIEWMGR" + +#if !defined(PACKAGE) +#define PACKAGE "ui-viewmgr" +#endif + +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); +Evas_Object *create_content(Evas_Object *parent, const char *text, Evas_Smart_Cb prev_btn_clicked_cb, Evas_Smart_Cb next_btn_clicked_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); +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 new file mode 100644 index 0000000..97c1701 --- /dev/null +++ b/src/examples/efl/cpp/page1.h @@ -0,0 +1,47 @@ +/* + * 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. + * + */ + +/** This example create a simple view which is inheritance ui_standard_view. + * Then push in viewmgr. + */ +class page1: public ui_standard_view +{ +protected: + //on_load() will be called when this page1 is requested to be shown. + void on_load() + { + ui_standard_view::on_load(); + + //Create a main content. + Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Basic View", + //Prev Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->deactivate(); + }, + //Next Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->push_view(new page2()); + }); + this->set_content(content, "Page1"); + } + +public: + page1() : ui_standard_view("page1") {} + ~page1() {} +}; diff --git a/src/examples/efl/cpp/page10.h b/src/examples/efl/cpp/page10.h new file mode 100644 index 0000000..8f7de8c --- /dev/null +++ b/src/examples/efl/cpp/page10.h @@ -0,0 +1,74 @@ +/* + * 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. + * + */ + +/** 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 +{ +protected: + void on_load() + { + ui_standard_view::on_load(); + this->on_rotate(this->get_degree()); + } + + void on_rotate(int degree) + { + ui_standard_view::on_rotate(degree); + + //Portrait + if (this->get_degree() == 0 || this->get_degree() == 180) + { + Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Rotation", + //Prev Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->pop_view(); + }, + //Next Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->push_view(new page11()); + }); + + this->set_content(content, "Page 10"); + this->set_indicator(UI_VIEW_INDICATOR_DEFAULT); + } + //Landscape + else + { + Evas_Object *content = create_landscape_content(this->get_base(), "ViewMgr Demo
Rotation", + //Prev Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->pop_view(); + }, + //Next Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->push_view(new page11()); + }); + + this->set_content(content, "Page 10"); + this->set_indicator(UI_VIEW_INDICATOR_OPTIMAL); + } + } +public: + page10() : ui_standard_view("page10") {} + ~page10() {} +}; diff --git a/src/examples/efl/cpp/page11.h b/src/examples/efl/cpp/page11.h new file mode 100644 index 0000000..34e14b7 --- /dev/null +++ b/src/examples/efl/cpp/page11.h @@ -0,0 +1,73 @@ +/* + * 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. + * + */ + + +/** This page implement on_menu() method to create ctxpopup when menu HW key clicked. + * This page will be created menu(ctxpopup)items in on_menu() method. + */ +static void ctxpopup_item_select_cb(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Object_Item *it = static_cast(event_info); + elm_ctxpopup_dismiss(obj); + LOGE("Item (%s) is selected", elm_object_item_text_get(it)); +} + +class page11: public ui_standard_view +{ +protected: + void on_load() + { + ui_standard_view::on_load(); + + //Create a main content. + Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Menu Popup", + //Prev Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->pop_view(); + }, + //Next Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->push_view(new page12()); + }); + + this->set_content(content, "Page11"); + } + + void on_menu(ui_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); + elm_ctxpopup_item_append(ctxpopup, "Favorites", NULL, ctxpopup_item_select_cb, this); + elm_ctxpopup_item_append(ctxpopup, "Search", NULL, ctxpopup_item_select_cb, this); + elm_ctxpopup_item_append(ctxpopup, "Dialer", NULL, ctxpopup_item_select_cb, this); + elm_ctxpopup_item_append(ctxpopup, "Add contact", NULL, ctxpopup_item_select_cb, this); + elm_ctxpopup_item_append(ctxpopup, "Phone calls", NULL, ctxpopup_item_select_cb, this); + elm_ctxpopup_item_append(ctxpopup, "Favorites", NULL, ctxpopup_item_select_cb, this); + elm_ctxpopup_item_append(ctxpopup, "Search", NULL, ctxpopup_item_select_cb, this); + elm_ctxpopup_item_append(ctxpopup, "Dialer", NULL, ctxpopup_item_select_cb, this); + + menu->set_content(ctxpopup); + } + +public: + page11() {} + ~page11() {} +}; diff --git a/src/examples/efl/cpp/page12.h b/src/examples/efl/cpp/page12.h new file mode 100644 index 0000000..fdfafcf --- /dev/null +++ b/src/examples/efl/cpp/page12.h @@ -0,0 +1,97 @@ +/* + * 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. + * + */ + +/** 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. + */ + +static void popup_dismissed_cb(void *data, Evas_Object *obj, void *event_info) +{ + //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_popup *popup = static_cast(data); + delete (popup); +} + +class page12: public ui_standard_view +{ +protected: + void on_load() + { + ui_standard_view::on_load(); + + //Create a main content. + Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Popup", + //Prev Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->pop_view(); + }, + //Next Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->push_view(new page13()); + }); + + this->set_content(content, "Page12"); + + //Title Right button + Elm_Button *right_btn = elm_button_add(this->get_base()); + elm_object_text_set(right_btn, "popup"); + evas_object_smart_callback_add(right_btn, "clicked", + [](void *data, Evas_Object *obj, void *event_info) -> void + { + page12 *view = static_cast(data); + view->create_popup(); + }, + this); + + this->set_title_right_btn(right_btn); + } + +public: + page12() : ui_standard_view("page12") {} + ~page12() {} + + void create_popup() + { + //FIXME: is overlay a proper name? + ui_popup *popup = new ui_popup(this); + + 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(obj, "timeout", + [](void *data, Evas_Object *obj, void *event_info) -> void + { + elm_popup_dismiss(obj); + }, + NULL); + + popup->set_content(obj); + popup->activate(); + } +}; diff --git a/src/examples/efl/cpp/page13.h b/src/examples/efl/cpp/page13.h new file mode 100644 index 0000000..1ca40a4 --- /dev/null +++ b/src/examples/efl/cpp/page13.h @@ -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. + * + */ + +/** This page inherit ui_ui_standard_view + * 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 +{ +protected: + void on_load() + { + ui_standard_view::on_load(); + + //Create a main content. + Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Fade Transition", + //Prev Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->pop_view(); + }, + //Next Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->push_view(new page14()); + }); + + this->set_content(content, "Page13"); + } + +public: + page13() : ui_standard_view("page13") + { + this->set_transition_style("fade"); + } + ~page13() {} +}; diff --git a/src/examples/efl/cpp/page14.h b/src/examples/efl/cpp/page14.h new file mode 100644 index 0000000..36080ef --- /dev/null +++ b/src/examples/efl/cpp/page14.h @@ -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. + * + */ + +/** This page inherit ui_ui_standard_view + * 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 +{ +protected: + void on_load() + { + ui_standard_view::on_load(); + + //Create a main content. + Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
None Transition", + //Prev Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->pop_view(); + }, + //Next Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->push_view(new page15()); + }); + + this->set_content(content, "Page14"); + } + +public: + page14() : ui_standard_view("page14") + { + this->set_transition_style("none"); + } + ~page14(){} +}; diff --git a/src/examples/efl/cpp/page15.h b/src/examples/efl/cpp/page15.h new file mode 100644 index 0000000..30dc9ce --- /dev/null +++ b/src/examples/efl/cpp/page15.h @@ -0,0 +1,46 @@ +/* + * 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. + * + */ + +/** This page inherit ui_ui_standard_view + * 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 +{ +protected: + void on_load() + { + ui_standard_view::on_load(); + + //Create a main content. + Evas_Object *content = create_scrolling_content(this->get_base()); + + this->set_content(content, "Page15 Scroller In Viewmgr"); + + //Title Right button + Elm_Button *right_btn = elm_button_add(this->get_base()); + elm_object_text_set(right_btn, "Next"); + evas_object_smart_callback_add(right_btn, "clicked", + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->push_view(new page16()); + }, + this); + + this->set_title_right_btn(right_btn); + } +}; diff --git a/src/examples/efl/cpp/page16.h b/src/examples/efl/cpp/page16.h new file mode 100644 index 0000000..89ea0ef --- /dev/null +++ b/src/examples/efl/cpp/page16.h @@ -0,0 +1,71 @@ +/* + * 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. + * + */ + +/** This page inherit ui_ui_standard_view + * 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 +{ +protected: + void on_load() + { + ui_standard_view::on_load(); + + //Create a main content. + Evas_Object *content = create_title_handle_content(this->get_base(), + //Prev Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->pop_view(); + }, + //Next Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->deactivate(); + }, + //Title Show Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + ui_standard_view *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); + 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); + 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); + view->set_title_visible(false, true); + }, this); + + this->set_content(content, "Page16"); + } + +public: + page16() : ui_standard_view("page16") {} + ~page16() {} +}; diff --git a/src/examples/efl/cpp/page2.h b/src/examples/efl/cpp/page2.h new file mode 100644 index 0000000..ae4b496 --- /dev/null +++ b/src/examples/efl/cpp/page2.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. + * + */ + +/** This example create a simple view which is inheritance ui_standard_view. + * And add two buttons in view title area. then push in viewmgr. + */ +class page2: public ui_standard_view +{ +protected: + void on_load() + { + ui_standard_view::on_load(); + + //Create a main content. + Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Title Buttons", + //Prev Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->pop_view(); + }, + //Next Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->push_view(new page3()); + }); + + //Title left button + Elm_Button *left_title_btn = elm_button_add(this->get_base()); + elm_object_text_set(left_title_btn, "Cancel"); + + //Title right button + Elm_Button *right_title_btn = elm_button_add(this->get_base()); + elm_object_text_set(right_title_btn, "Done"); + + //Arguments: content, title, subtitle, title left button, title right button + this->set_content(content, "Page2", NULL, left_title_btn, right_title_btn); + } + +public: + page2() : ui_standard_view("page2") {} + ~page2() {} +}; diff --git a/src/examples/efl/cpp/page3.h b/src/examples/efl/cpp/page3.h new file mode 100644 index 0000000..9de47ea --- /dev/null +++ b/src/examples/efl/cpp/page3.h @@ -0,0 +1,48 @@ +/* + * 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. + * + */ + +/** 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_standard_view +{ +protected: + void on_load() + { + ui_standard_view::on_load(); + + //Create a main content. + Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Subtitle", + //Prev Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->pop_view(); + }, + //Next Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->push_view(new page4()); + }); + + //Arguments: content, title, subtitle, title left button, title right button + this->set_content(content, "Page3", "Subtitle", NULL, NULL); + } + +public: + page3() : ui_standard_view("page3") {} + ~page3() {} +}; diff --git a/src/examples/efl/cpp/page4.h b/src/examples/efl/cpp/page4.h new file mode 100644 index 0000000..8bfc0a5 --- /dev/null +++ b/src/examples/efl/cpp/page4.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. + * + */ + +/** 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_standard_view +{ +protected: + void on_load() + { + ui_standard_view::on_load(); + + //Create a main content. + Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Title Badge", + //Prev Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->pop_view(); + }, + //Next Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->push_view(new page5()); + }); + + //Arguments: content, title + this->set_content(content, "Page4. We put a long title here intentionally"); + this->set_title_badge("999+"); + } + +public: + page4() : ui_standard_view("page4") {} + ~page4() {} +}; diff --git a/src/examples/efl/cpp/page5.h b/src/examples/efl/cpp/page5.h new file mode 100644 index 0000000..8ec8998 --- /dev/null +++ b/src/examples/efl/cpp/page5.h @@ -0,0 +1,48 @@ +/* + * 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. + * + */ + +/** This page inherit ui_view to show how to create full view. + * And set indicator state as hide. + */ +class page5: public ui_view +{ +protected: + void on_load() + { + ui_view::on_load(); + + //Create a main content. + Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Full View", + //Prev Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->pop_view(); + }, + //Next Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->push_view(new page6()); + }); + + this->set_content(content); + this->set_indicator(UI_VIEW_INDICATOR_HIDE); + } + +public: + page5() : ui_view("page5") {} + ~page5() {} +}; diff --git a/src/examples/efl/cpp/page6.h b/src/examples/efl/cpp/page6.h new file mode 100644 index 0000000..5f56952 --- /dev/null +++ b/src/examples/efl/cpp/page6.h @@ -0,0 +1,49 @@ +/* + * 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. + * + */ + +/** This page inherit ui_standard_view to show title with toolbar(toolbar_with_title) example. + */ +class page6: public ui_standard_view +{ +protected: + void on_load() + { + ui_standard_view::on_load(); + + //Create a main content. + Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Toolbar", + //Prev Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->pop_view(); + }, + //Next Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->push_view(new page7()); + }); + + //Arguments: content, title + this->set_content(content, "Page6"); + Elm_Toolbar *toolbar = create_toolbar(this->get_base(), "toolbar_with_title"); + this->set_toolbar(toolbar); + } + +public: + page6() : ui_standard_view("page6") {} + ~page6() {} +}; diff --git a/src/examples/efl/cpp/page7.h b/src/examples/efl/cpp/page7.h new file mode 100644 index 0000000..27f5df8 --- /dev/null +++ b/src/examples/efl/cpp/page7.h @@ -0,0 +1,48 @@ +/* + * 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. + * + */ + +/** This page inherit ui_standard_view to show title with toolbar(navigationbar) example. + */ +class page7: public ui_standard_view +{ +protected: + void on_load() + { + ui_standard_view::on_load(); + + //Create a main content. + Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Navigationbar", + //Prev Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->pop_view(); + }, + //Next Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->push_view(new page8()); + }); + + //Arguments: content, title + this->set_content(content, "Page7"); + Elm_Toolbar *toolbar = create_toolbar(this->get_base(), "navigationbar"); + this->set_toolbar(toolbar); + } +public: + page7() : ui_standard_view("page7") {} + ~page7() {} +}; diff --git a/src/examples/efl/cpp/page8.h b/src/examples/efl/cpp/page8.h new file mode 100644 index 0000000..723553b --- /dev/null +++ b/src/examples/efl/cpp/page8.h @@ -0,0 +1,43 @@ +/* + * 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. + * + */ + +/** This page shows how to create a view content in advance. + */ +class page8: public ui_standard_view +{ +public: + page8() : ui_standard_view("page8") + { + //Create a main content. + Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Content Preloading", + //Prev Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->pop_view(); + }, + //Next Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->push_view(new page9()); + }); + + //Don't delete view's content when this view poped. + this->set_removable_content(false); + this->set_content(content, "Page 8"); + } + ~page8() {} +}; diff --git a/src/examples/efl/cpp/page9.h b/src/examples/efl/cpp/page9.h new file mode 100644 index 0000000..bfe54a0 --- /dev/null +++ b/src/examples/efl/cpp/page9.h @@ -0,0 +1,79 @@ +/* + * 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. + * + */ + +/** This page inherit ui_standard_view. + * 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 +{ +protected: + void 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) + this->on_landscape(); + else + this->on_portrait(); + } + + void on_portrait() + { + ui_standard_view::on_portrait(); + + Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Portrait/Landscape", + //Prev Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->pop_view(); + }, + //Next Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->push_view(new page10()); + }); + + this->set_content(content, "Page 9"); + this->set_indicator(UI_VIEW_INDICATOR_DEFAULT); + } + + void on_landscape() + { + ui_standard_view::on_landscape(); + + Evas_Object *content = create_landscape_content(this->get_base(), "ViewMgr Demo
Portrait/Landscape", + //Prev Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->pop_view(); + }, + //Next Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + UI_VIEWMGR->push_view(new page10()); + }); + + this->set_content(content, "Page 9"); + this->set_indicator(UI_VIEW_INDICATOR_OPTIMAL); + } + +public: + page9() : ui_standard_view("page9") {} + ~page9() {} +}; diff --git a/src/examples/efl/main.cpp b/src/examples/efl/main.cpp deleted file mode 100644 index 2f3de6f..0000000 --- a/src/examples/efl/main.cpp +++ /dev/null @@ -1,65 +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 "main.h" -#include "page16.h" -#include "page15.h" -#include "page14.h" -#include "page13.h" -#include "page12.h" -#include "page11.h" -#include "page10.h" -#include "page9.h" -#include "page8.h" -#include "page7.h" -#include "page6.h" -#include "page5.h" -#include "page4.h" -#include "page3.h" -#include "page2.h" -#include "page1.h" - -class sample_app: public ui_app -{ -public: - sample_app() - : ui_app(PACKAGE, LOCALE_DIR) - { - } - ~sample_app() - { - } - -protected: - bool on_create() - { - if (!ui_app::on_create()) - { - return false; - } - - //Push first view in viewmgr. - UI_VIEWMGR->push_view(new page1()); - - return true; - } -}; - -int main(int argc, char *argv[]) -{ - sample_app app; - return app.run(argc, argv); -} diff --git a/src/examples/efl/main.h b/src/examples/efl/main.h deleted file mode 100644 index 019651a..0000000 --- a/src/examples/efl/main.h +++ /dev/null @@ -1,40 +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 - -//uncomment if you want debug -#ifndef TIZEN_ENGINEER_MODE -#define TIZEN_ENGINEER_MODE -#endif - -#ifdef LOG_TAG -#undef LOG_TAG -#endif -#define LOG_TAG "UI_VIEWMGR" - -#if !defined(PACKAGE) -#define PACKAGE "ui-viewmgr" -#endif - -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); -Evas_Object *create_content(Evas_Object *parent, const char *text, Evas_Smart_Cb prev_btn_clicked_cb, Evas_Smart_Cb next_btn_clicked_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); -Elm_Toolbar *create_toolbar(Evas_Object *parent, const char *style); diff --git a/src/examples/efl/page1.h b/src/examples/efl/page1.h deleted file mode 100644 index 252c528..0000000 --- a/src/examples/efl/page1.h +++ /dev/null @@ -1,71 +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. - * - */ - -/** This example create a simple view which is inheritance ui_standard_view. - * Then push in viewmgr. - */ -class page1: public ui_standard_view -{ -protected: - //on_load() will be called when this page1 is requested to be shown. - void on_load() - { - ui_standard_view::on_load(); - - //Create a main content. - Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Basic View", - //Prev Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->deactivate(); - }, - //Next Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->push_view(new page2()); - }); - this->set_content(content, "Page1"); - } - - //on_unload() will be called when this page1 is requested to be hidden. - void on_unload() - { - ui_standard_view::on_unload(); - } - - //on_destroy() will be called when this page1 is requested to be destroyed. - void on_destroy() - { - ui_standard_view::on_destroy(); - } - - //on_deactivate() will be called when this page1 is requested to be deactivated. - void on_deactivate() - { - ui_standard_view::on_deactivate(); - } - - //on_activate() will be called when this page1 is requested to be activated. - void on_activate() - { - ui_standard_view::on_activate(); - } - -public: - page1() : ui_standard_view("page1") {} - ~page1() {} -}; diff --git a/src/examples/efl/page10.h b/src/examples/efl/page10.h deleted file mode 100644 index 8f7de8c..0000000 --- a/src/examples/efl/page10.h +++ /dev/null @@ -1,74 +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. - * - */ - -/** 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 -{ -protected: - void on_load() - { - ui_standard_view::on_load(); - this->on_rotate(this->get_degree()); - } - - void on_rotate(int degree) - { - ui_standard_view::on_rotate(degree); - - //Portrait - if (this->get_degree() == 0 || this->get_degree() == 180) - { - Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Rotation", - //Prev Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->pop_view(); - }, - //Next Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->push_view(new page11()); - }); - - this->set_content(content, "Page 10"); - this->set_indicator(UI_VIEW_INDICATOR_DEFAULT); - } - //Landscape - else - { - Evas_Object *content = create_landscape_content(this->get_base(), "ViewMgr Demo
Rotation", - //Prev Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->pop_view(); - }, - //Next Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->push_view(new page11()); - }); - - this->set_content(content, "Page 10"); - this->set_indicator(UI_VIEW_INDICATOR_OPTIMAL); - } - } -public: - page10() : ui_standard_view("page10") {} - ~page10() {} -}; diff --git a/src/examples/efl/page11.h b/src/examples/efl/page11.h deleted file mode 100644 index 34e14b7..0000000 --- a/src/examples/efl/page11.h +++ /dev/null @@ -1,73 +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. - * - */ - - -/** This page implement on_menu() method to create ctxpopup when menu HW key clicked. - * This page will be created menu(ctxpopup)items in on_menu() method. - */ -static void ctxpopup_item_select_cb(void *data, Evas_Object *obj, void *event_info) -{ - Elm_Object_Item *it = static_cast(event_info); - elm_ctxpopup_dismiss(obj); - LOGE("Item (%s) is selected", elm_object_item_text_get(it)); -} - -class page11: public ui_standard_view -{ -protected: - void on_load() - { - ui_standard_view::on_load(); - - //Create a main content. - Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Menu Popup", - //Prev Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->pop_view(); - }, - //Next Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->push_view(new page12()); - }); - - this->set_content(content, "Page11"); - } - - void on_menu(ui_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); - elm_ctxpopup_item_append(ctxpopup, "Favorites", NULL, ctxpopup_item_select_cb, this); - elm_ctxpopup_item_append(ctxpopup, "Search", NULL, ctxpopup_item_select_cb, this); - elm_ctxpopup_item_append(ctxpopup, "Dialer", NULL, ctxpopup_item_select_cb, this); - elm_ctxpopup_item_append(ctxpopup, "Add contact", NULL, ctxpopup_item_select_cb, this); - elm_ctxpopup_item_append(ctxpopup, "Phone calls", NULL, ctxpopup_item_select_cb, this); - elm_ctxpopup_item_append(ctxpopup, "Favorites", NULL, ctxpopup_item_select_cb, this); - elm_ctxpopup_item_append(ctxpopup, "Search", NULL, ctxpopup_item_select_cb, this); - elm_ctxpopup_item_append(ctxpopup, "Dialer", NULL, ctxpopup_item_select_cb, this); - - menu->set_content(ctxpopup); - } - -public: - page11() {} - ~page11() {} -}; diff --git a/src/examples/efl/page12.h b/src/examples/efl/page12.h deleted file mode 100644 index fdfafcf..0000000 --- a/src/examples/efl/page12.h +++ /dev/null @@ -1,97 +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. - * - */ - -/** 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. - */ - -static void popup_dismissed_cb(void *data, Evas_Object *obj, void *event_info) -{ - //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_popup *popup = static_cast(data); - delete (popup); -} - -class page12: public ui_standard_view -{ -protected: - void on_load() - { - ui_standard_view::on_load(); - - //Create a main content. - Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Popup", - //Prev Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->pop_view(); - }, - //Next Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->push_view(new page13()); - }); - - this->set_content(content, "Page12"); - - //Title Right button - Elm_Button *right_btn = elm_button_add(this->get_base()); - elm_object_text_set(right_btn, "popup"); - evas_object_smart_callback_add(right_btn, "clicked", - [](void *data, Evas_Object *obj, void *event_info) -> void - { - page12 *view = static_cast(data); - view->create_popup(); - }, - this); - - this->set_title_right_btn(right_btn); - } - -public: - page12() : ui_standard_view("page12") {} - ~page12() {} - - void create_popup() - { - //FIXME: is overlay a proper name? - ui_popup *popup = new ui_popup(this); - - 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(obj, "timeout", - [](void *data, Evas_Object *obj, void *event_info) -> void - { - elm_popup_dismiss(obj); - }, - NULL); - - popup->set_content(obj); - popup->activate(); - } -}; diff --git a/src/examples/efl/page13.h b/src/examples/efl/page13.h deleted file mode 100644 index 1ca40a4..0000000 --- a/src/examples/efl/page13.h +++ /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. - * - */ - -/** This page inherit ui_ui_standard_view - * 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 -{ -protected: - void on_load() - { - ui_standard_view::on_load(); - - //Create a main content. - Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Fade Transition", - //Prev Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->pop_view(); - }, - //Next Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->push_view(new page14()); - }); - - this->set_content(content, "Page13"); - } - -public: - page13() : ui_standard_view("page13") - { - this->set_transition_style("fade"); - } - ~page13() {} -}; diff --git a/src/examples/efl/page14.h b/src/examples/efl/page14.h deleted file mode 100644 index 36080ef..0000000 --- a/src/examples/efl/page14.h +++ /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. - * - */ - -/** This page inherit ui_ui_standard_view - * 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 -{ -protected: - void on_load() - { - ui_standard_view::on_load(); - - //Create a main content. - Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
None Transition", - //Prev Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->pop_view(); - }, - //Next Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->push_view(new page15()); - }); - - this->set_content(content, "Page14"); - } - -public: - page14() : ui_standard_view("page14") - { - this->set_transition_style("none"); - } - ~page14(){} -}; diff --git a/src/examples/efl/page15.h b/src/examples/efl/page15.h deleted file mode 100644 index 30dc9ce..0000000 --- a/src/examples/efl/page15.h +++ /dev/null @@ -1,46 +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. - * - */ - -/** This page inherit ui_ui_standard_view - * 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 -{ -protected: - void on_load() - { - ui_standard_view::on_load(); - - //Create a main content. - Evas_Object *content = create_scrolling_content(this->get_base()); - - this->set_content(content, "Page15 Scroller In Viewmgr"); - - //Title Right button - Elm_Button *right_btn = elm_button_add(this->get_base()); - elm_object_text_set(right_btn, "Next"); - evas_object_smart_callback_add(right_btn, "clicked", - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->push_view(new page16()); - }, - this); - - this->set_title_right_btn(right_btn); - } -}; diff --git a/src/examples/efl/page16.h b/src/examples/efl/page16.h deleted file mode 100644 index 89ea0ef..0000000 --- a/src/examples/efl/page16.h +++ /dev/null @@ -1,71 +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. - * - */ - -/** This page inherit ui_ui_standard_view - * 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 -{ -protected: - void on_load() - { - ui_standard_view::on_load(); - - //Create a main content. - Evas_Object *content = create_title_handle_content(this->get_base(), - //Prev Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->pop_view(); - }, - //Next Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->deactivate(); - }, - //Title Show Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - ui_standard_view *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); - 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); - 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); - view->set_title_visible(false, true); - }, this); - - this->set_content(content, "Page16"); - } - -public: - page16() : ui_standard_view("page16") {} - ~page16() {} -}; diff --git a/src/examples/efl/page2.h b/src/examples/efl/page2.h deleted file mode 100644 index 37f27d9..0000000 --- a/src/examples/efl/page2.h +++ /dev/null @@ -1,75 +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. - * - */ - -/** This example create a simple view which is inheritance ui_standard_view. - * And add two buttons in view title area. then push in viewmgr. - */ -class page2: public ui_standard_view -{ -private: - Evas_Object *content; - Elm_Button *left_title_btn; - Elm_Button *right_title_btn; - -protected: - void on_load() - { - ui_standard_view::on_load(); - - //Create a main content. - Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Title Buttons", - //Prev Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->pop_view(); - }, - //Next Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->push_view(new page3()); - }); - - //Title left button - Elm_Button *left_title_btn = elm_button_add(this->get_base()); - elm_object_text_set(left_title_btn, "Cancel"); - - //Title right button - Elm_Button *right_title_btn = elm_button_add(this->get_base()); - elm_object_text_set(right_title_btn, "Done"); - - //Arguments: content, title, subtitle, title left button, title right button - this->set_content(content, "Page2", NULL, left_title_btn, right_title_btn); - - this->content = content; - this->left_title_btn = left_title_btn; - this->right_title_btn = right_title_btn; - } - void on_unload() - { - ui_standard_view::on_unload(); - - evas_object_del(this->content); - evas_object_del(this->left_title_btn); - evas_object_del(this->right_title_btn); - } - -public: - page2() : ui_standard_view("page2") - { - } - ~page2() {} -}; diff --git a/src/examples/efl/page3.h b/src/examples/efl/page3.h deleted file mode 100644 index 9de47ea..0000000 --- a/src/examples/efl/page3.h +++ /dev/null @@ -1,48 +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. - * - */ - -/** 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_standard_view -{ -protected: - void on_load() - { - ui_standard_view::on_load(); - - //Create a main content. - Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Subtitle", - //Prev Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->pop_view(); - }, - //Next Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->push_view(new page4()); - }); - - //Arguments: content, title, subtitle, title left button, title right button - this->set_content(content, "Page3", "Subtitle", NULL, NULL); - } - -public: - page3() : ui_standard_view("page3") {} - ~page3() {} -}; diff --git a/src/examples/efl/page4.h b/src/examples/efl/page4.h deleted file mode 100644 index 8bfc0a5..0000000 --- a/src/examples/efl/page4.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. - * - */ - -/** 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_standard_view -{ -protected: - void on_load() - { - ui_standard_view::on_load(); - - //Create a main content. - Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Title Badge", - //Prev Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->pop_view(); - }, - //Next Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->push_view(new page5()); - }); - - //Arguments: content, title - this->set_content(content, "Page4. We put a long title here intentionally"); - this->set_title_badge("999+"); - } - -public: - page4() : ui_standard_view("page4") {} - ~page4() {} -}; diff --git a/src/examples/efl/page5.h b/src/examples/efl/page5.h deleted file mode 100644 index 8ec8998..0000000 --- a/src/examples/efl/page5.h +++ /dev/null @@ -1,48 +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. - * - */ - -/** This page inherit ui_view to show how to create full view. - * And set indicator state as hide. - */ -class page5: public ui_view -{ -protected: - void on_load() - { - ui_view::on_load(); - - //Create a main content. - Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Full View", - //Prev Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->pop_view(); - }, - //Next Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->push_view(new page6()); - }); - - this->set_content(content); - this->set_indicator(UI_VIEW_INDICATOR_HIDE); - } - -public: - page5() : ui_view("page5") {} - ~page5() {} -}; diff --git a/src/examples/efl/page6.h b/src/examples/efl/page6.h deleted file mode 100644 index 5f56952..0000000 --- a/src/examples/efl/page6.h +++ /dev/null @@ -1,49 +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. - * - */ - -/** This page inherit ui_standard_view to show title with toolbar(toolbar_with_title) example. - */ -class page6: public ui_standard_view -{ -protected: - void on_load() - { - ui_standard_view::on_load(); - - //Create a main content. - Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Toolbar", - //Prev Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->pop_view(); - }, - //Next Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->push_view(new page7()); - }); - - //Arguments: content, title - this->set_content(content, "Page6"); - Elm_Toolbar *toolbar = create_toolbar(this->get_base(), "toolbar_with_title"); - this->set_toolbar(toolbar); - } - -public: - page6() : ui_standard_view("page6") {} - ~page6() {} -}; diff --git a/src/examples/efl/page7.h b/src/examples/efl/page7.h deleted file mode 100644 index 27f5df8..0000000 --- a/src/examples/efl/page7.h +++ /dev/null @@ -1,48 +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. - * - */ - -/** This page inherit ui_standard_view to show title with toolbar(navigationbar) example. - */ -class page7: public ui_standard_view -{ -protected: - void on_load() - { - ui_standard_view::on_load(); - - //Create a main content. - Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Navigationbar", - //Prev Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->pop_view(); - }, - //Next Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->push_view(new page8()); - }); - - //Arguments: content, title - this->set_content(content, "Page7"); - Elm_Toolbar *toolbar = create_toolbar(this->get_base(), "navigationbar"); - this->set_toolbar(toolbar); - } -public: - page7() : ui_standard_view("page7") {} - ~page7() {} -}; diff --git a/src/examples/efl/page8.h b/src/examples/efl/page8.h deleted file mode 100644 index 723553b..0000000 --- a/src/examples/efl/page8.h +++ /dev/null @@ -1,43 +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. - * - */ - -/** This page shows how to create a view content in advance. - */ -class page8: public ui_standard_view -{ -public: - page8() : ui_standard_view("page8") - { - //Create a main content. - Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Content Preloading", - //Prev Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->pop_view(); - }, - //Next Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->push_view(new page9()); - }); - - //Don't delete view's content when this view poped. - this->set_removable_content(false); - this->set_content(content, "Page 8"); - } - ~page8() {} -}; diff --git a/src/examples/efl/page9.h b/src/examples/efl/page9.h deleted file mode 100644 index bfe54a0..0000000 --- a/src/examples/efl/page9.h +++ /dev/null @@ -1,79 +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. - * - */ - -/** This page inherit ui_standard_view. - * 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 -{ -protected: - void 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) - this->on_landscape(); - else - this->on_portrait(); - } - - void on_portrait() - { - ui_standard_view::on_portrait(); - - Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Portrait/Landscape", - //Prev Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->pop_view(); - }, - //Next Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->push_view(new page10()); - }); - - this->set_content(content, "Page 9"); - this->set_indicator(UI_VIEW_INDICATOR_DEFAULT); - } - - void on_landscape() - { - ui_standard_view::on_landscape(); - - Evas_Object *content = create_landscape_content(this->get_base(), "ViewMgr Demo
Portrait/Landscape", - //Prev Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->pop_view(); - }, - //Next Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - UI_VIEWMGR->push_view(new page10()); - }); - - this->set_content(content, "Page 9"); - this->set_indicator(UI_VIEW_INDICATOR_OPTIMAL); - } - -public: - page9() : ui_standard_view("page9") {} - ~page9() {} -}; diff --git a/src/include/CMakeLists.txt b/src/include/CMakeLists.txt index 1b56e6c..73ea1ca 100644 --- a/src/include/CMakeLists.txt +++ b/src/include/CMakeLists.txt @@ -3,6 +3,7 @@ INSTALL( FILES_MATCHING PATTERN "interface/*.h" PATTERN "efl/*.h" + PATTERN "efl/mobile/c/*.h" PATTERN "efl/mobile/*.h" PATTERN "*.h" ) diff --git a/src/include/efl/mobile/c/ui_app_c.h b/src/include/efl/mobile/c/ui_app_c.h new file mode 100644 index 0000000..12f0eb9 --- /dev/null +++ b/src/include/efl/mobile/c/ui_app_c.h @@ -0,0 +1,17 @@ +#ifndef _UI_APP_C_H_ +#define _UI_APP_C_H_ + +namespace efl_viewmanager +{ + +#ifdef __cplusplus +extern "C" { +#endif + int ui_app_init(const char *pkg, const char *locale_dir); + int ui_app_run(int argc, char **argv, ui_app_lifecycle_callback_s *event_callback, void *data); +#ifdef __cplusplus +} +#endif + +} +#endif /* _UI_APP_C_H_ */ diff --git a/src/include/efl/mobile/c/ui_menu_c.h b/src/include/efl/mobile/c/ui_menu_c.h new file mode 100644 index 0000000..0c6a5ae --- /dev/null +++ b/src/include/efl/mobile/c/ui_menu_c.h @@ -0,0 +1,16 @@ +#ifndef _UI_MENU_C_H_ +#define _UI_MENU_C_H_ + +namespace efl_viewmananger +{ + +#ifdef __cplusplus +extern "C" { +#endif + bool ui_menu_content_set(ui_menu *menu, Elm_Ctxpopup *ctxpopup); +#ifdef __cplusplus +} +#endif +} + +#endif /* _UI_MENU_C_H_ */ diff --git a/src/include/efl/mobile/c/ui_popup_c.h b/src/include/efl/mobile/c/ui_popup_c.h new file mode 100644 index 0000000..c64b1f2 --- /dev/null +++ b/src/include/efl/mobile/c/ui_popup_c.h @@ -0,0 +1,18 @@ +#ifndef _UI_POPUP_C_H_ +#define _UI_POPUP_C_H_ + +namespace efl_viewmananger +{ + +#ifdef __cplusplus +extern "C" { +#endif + bool ui_popup_content_set(ui_popup *popup, Elm_Popup *elm_popup); + bool ui_popup_activate(ui_popup *popup); + void ui_popup_del(ui_popup *popup); +#ifdef __cplusplus +} +#endif + +} +#endif /* _UI_POPUP_C_H_ */ diff --git a/src/include/efl/mobile/c/ui_view_c.h b/src/include/efl/mobile/c/ui_view_c.h new file mode 100644 index 0000000..1441edb --- /dev/null +++ b/src/include/efl/mobile/c/ui_view_c.h @@ -0,0 +1,66 @@ +#ifndef _UI_VIEW_C_H_ +#define _UI_VIEW_C_H_ + +namespace efl_viewmananger +{ + +#ifdef __cplusplus +extern "C" { +#endif + typedef bool (*ui_view_lifecycle_load_cb) (ui_view *view, void *data); + typedef bool (*ui_view_lifecycle_unload_cb) (ui_view *view, void *data); + typedef bool (*ui_view_lifecycle_pause_cb) (ui_view *view, void *data); + typedef bool (*ui_view_lifecycle_resume_cb) (ui_view *view, void *data); + typedef bool (*ui_view_lifecycle_activate_cb) (ui_view *view, void *data); + typedef bool (*ui_view_lifecycle_deactivate_cb) (ui_view *view, void *data); + typedef bool (*ui_view_lifecycle_destroy_cb) (ui_view *view, void *data); + + typedef bool (*ui_view_event_rotate_cb) (ui_view *view, int degree, void *data); + typedef bool (*ui_view_event_portrait_cb) (ui_view *view, void *data); + typedef bool (*ui_view_event_landscape_cb) (ui_view *view, void *data); + typedef bool (*ui_view_event_back_cb) (ui_view *view, void *data); + typedef bool (*ui_view_event_menu_cb) (ui_menu *menu, void *data); + + typedef struct + { + ui_view_lifecycle_load_cb load; + ui_view_lifecycle_unload_cb unload; + ui_view_lifecycle_pause_cb pause; + ui_view_lifecycle_resume_cb resume; + ui_view_lifecycle_activate_cb activate; + ui_view_lifecycle_deactivate_cb deactivate; + ui_view_lifecycle_destroy_cb destroy; + } ui_view_lifecycle_callback_s; + + typedef struct + { + ui_view_event_rotate_cb rotate; + ui_view_event_portrait_cb portrait; + ui_view_event_landscape_cb landscape; + ui_view_event_back_cb back; + ui_view_event_menu_cb menu; + } ui_view_event_callback_s; + + ui_view* ui_standard_view_create(const char *name); + bool ui_view_lifecycle_callbacks_set(ui_view *view, + ui_view_lifecycle_callback_s *lifecycle_callback, void *data); + Evas_Object* ui_view_base_get(ui_view *view); + bool ui_view_content_set(ui_view *view, Evas_Object *content); + bool ui_standard_view_content_set(ui_view *view, Evas_Object *content, + const char *title, const char *subtitle, + Evas_Object *title_left_btn, Evas_Object *title_right_btn); + bool ui_standard_view_title_badge_set(ui_view *view, const char *badge_text); + bool ui_view_indicator_set(ui_view *view, ui_view_indicator indicator); + bool ui_standard_view_toolbar_set(ui_view *view, Elm_Toolbar *toolbar); + void ui_view_removable_content(ui_view *view, bool remove); + bool ui_view_event_callbacks_set(ui_view *view, + ui_view_event_callback_s *event_callback, void *data); + bool ui_standard_view_title_right_btn_set(ui_view *view, Evas_Object *title_right_btn); + bool ui_standard_view_title_visible_set(ui_view *view, bool visible, bool anim); + +#ifdef __cplusplus +} +#endif + +} +#endif /* _UI_VIEW_C_H_ */ diff --git a/src/include/efl/mobile/c/ui_viewmgr_c.h b/src/include/efl/mobile/c/ui_viewmgr_c.h new file mode 100644 index 0000000..e25dca1 --- /dev/null +++ b/src/include/efl/mobile/c/ui_viewmgr_c.h @@ -0,0 +1,17 @@ +#ifndef _UI_VIEWMGR_C_H_ +#define _UI_VIEWMGR_C_H_ + +using namespace efl_viewmananger; + +#ifdef __cplusplus +extern "C" { +#endif + //TODO + #define UI_VIEWMGR_VIEW_DEACTIVATE() (ui_app::get_instance()->get_viewmgr())->deactivate() + #define UI_VIEWMGR_VIEW_PUSH(x) (ui_app::get_instance()->get_viewmgr())->push_view(x) + #define UI_VIEWMGR_VIEW_POP() (ui_app::get_instance()->get_viewmgr())->pop_view() +#ifdef __cplusplus +} +#endif + +#endif /* _UI_VIEWMGR_C_H_ */ diff --git a/src/include/efl/mobile/ui_mobile_viewmanager.h b/src/include/efl/mobile/ui_mobile_viewmanager.h index 62841ea..3ade19b 100644 --- a/src/include/efl/mobile/ui_mobile_viewmanager.h +++ b/src/include/efl/mobile/ui_mobile_viewmanager.h @@ -17,6 +17,7 @@ #ifndef _UI_MOBILE_VIEWMANAGER_H_ #define _UI_MOBILE_VIEWMANAGER_H_ +#include #include "../ui_base_viewmanager.h" #include "ui_view.h" #include "ui_standard_view.h" @@ -25,6 +26,11 @@ #include "ui_menu.h" #include "ui_popup.h" #include "ui_app.h" +#include "c/ui_app_c.h" +#include "c/ui_menu_c.h" +#include "c/ui_popup_c.h" +#include "c/ui_viewmgr_c.h" +#include "c/ui_view_c.h" #define UI_VIEWMGR (ui_app::get_instance()->get_viewmgr()) diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 94a2a69..6506d04 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -13,6 +13,10 @@ SET(SRCS efl/mobile/ui_standard_view.cpp efl/mobile/ui_key_listener.cpp efl/mobile/ui_viewmgr.cpp + efl/mobile/c/ui_app_c.cpp + efl/mobile/c/ui_menu_c.cpp + efl/mobile/c/ui_popup_c.cpp + efl/mobile/c/ui_view_c.cpp ) ADD_LIBRARY(${LIBNAME} SHARED ${SRCS}) diff --git a/src/lib/efl/mobile/c/ui_app_c.cpp b/src/lib/efl/mobile/c/ui_app_c.cpp new file mode 100644 index 0000000..1402e82 --- /dev/null +++ b/src/lib/efl/mobile/c/ui_app_c.cpp @@ -0,0 +1,18 @@ +#include "../../../../include/efl/mobile/ui_mobile_viewmanager.h" +#include "../../../../include/efl/mobile/c/ui_app_c.h" + +using namespace efl_viewmanager; + +extern "C" { + int ui_app_init(const char *pkg, const char *locale_dir) + { + //TODO + return 1; + } + + int ui_app_run(int argc, char **argv, ui_app_lifecycle_callback_s *event_callback, void *data) + { + //TODO + return 1; + } +} diff --git a/src/lib/efl/mobile/c/ui_menu_c.cpp b/src/lib/efl/mobile/c/ui_menu_c.cpp new file mode 100644 index 0000000..2600f8e --- /dev/null +++ b/src/lib/efl/mobile/c/ui_menu_c.cpp @@ -0,0 +1,13 @@ +#include "../../../../include/efl/mobile/ui_mobile_viewmanager.h" +#include "../../../../include/efl/mobile/c/ui_menu_c.h" + +using namespace efl_viewmanager; + +extern "C" { + bool ui_menu_content_set(ui_menu *menu, Elm_Ctxpopup *ctxpopup) + { + //TODO + return 1; + } +} + diff --git a/src/lib/efl/mobile/c/ui_popup_c.cpp b/src/lib/efl/mobile/c/ui_popup_c.cpp new file mode 100644 index 0000000..d2f067e --- /dev/null +++ b/src/lib/efl/mobile/c/ui_popup_c.cpp @@ -0,0 +1,23 @@ +#include "../../../../include/efl/mobile/ui_mobile_viewmanager.h" +#include "../../../../include/efl/mobile/c/ui_popup_c.h" + +using namespace efl_viewmanager; + +extern "C" { + bool ui_popup_content_set(ui_popup *popup, Elm_Popup *elm_popup) + { + //TODO + return 1; + } + + bool ui_popup_activate(ui_popup *popup) + { + //TODO + return 1; + } + + void ui_popup_del(ui_popup *popup) + { + //TODO + } +} diff --git a/src/lib/efl/mobile/c/ui_view_c.cpp b/src/lib/efl/mobile/c/ui_view_c.cpp new file mode 100644 index 0000000..40d099e --- /dev/null +++ b/src/lib/efl/mobile/c/ui_view_c.cpp @@ -0,0 +1,80 @@ +#include "../../../../include/efl/mobile/ui_mobile_viewmanager.h" +#include "../../../../include/efl/mobile/c/ui_view_c.h" + +using namespace efl_viewmanager; + +extern "C" { + ui_view* ui_standard_view_create(const char *name) + { + //TODO + return NULL; + } + + bool ui_view_lifecycle_callbacks_set(ui_view *view, + ui_view_lifecycle_callback_s *lifecycle_callback, void *data) + { + //TODO + return 1; + } + Evas_Object* ui_view_base_get(ui_view *view) + { + //TODO + return NULL; + } + + bool ui_view_content_set(ui_view *view, Evas_Object *content) + { + //TODO + return 1; + } + + bool ui_standard_view_content_set(ui_view *view, Evas_Object *content, + const char *title, const char *subtitle, + Evas_Object *title_left_btn, Evas_Object *title_right_btn) + { + //TODO + return 1; + } + + bool ui_standard_view_title_badge_set(ui_view *view, const char *badge_text) + { + //TODO + return 1; + } + + bool ui_view_indicator_set(ui_view *view, ui_view_indicator indicator) + { + //TODO + return 1; + } + + bool ui_standard_view_toolbar_set(ui_view *view, Elm_Toolbar *toolbar) + { + //TODO + return 1; + } + + void ui_view_removable_content(ui_view *view, bool remove) + { + //TODO + } + + bool ui_view_event_callbacks_set(ui_view *view, + ui_view_event_callback_s *event_callback, void *data) + { + //TODO + return 1; + } + + bool ui_standard_view_title_right_btn_set(ui_view *view, Evas_Object *title_right_btn) + { + //TODO + return 1; + } + + bool ui_standard_view_title_visible_set(ui_view *view, bool visible, bool anim) + { + //TODO + return 1; + } +}