From: Hermet Park Date: Wed, 15 Jun 2016 06:49:21 +0000 (+0900) Subject: Still c implementation is unstable. X-Git-Tag: submit/tizen/20160617.075742~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=90cecd3080765e7985133a14b3169a618bc006fb;p=platform%2Fcore%2Fuifw%2Fui-viewmgr.git Still c implementation is unstable. We are still on building up its bodies here and there. Change-Id: I708d66160d428cc62f69c38a6c598a0494e66cd1 --- diff --git a/src/examples/efl/c/page1.cpp b/src/examples/efl/c/page1.cpp index 9a95a2d..5b91dd3 100644 --- a/src/examples/efl/c/page1.cpp +++ b/src/examples/efl/c/page1.cpp @@ -63,7 +63,7 @@ create_page1() if (!(ret = ui_view_lifecycle_callbacks_set(view, &lifecycle_callback, NULL))) { - dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_lifecycle_callback_set is failed. err = %d", ret); + dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_lifecycle_callback_set() is failed. err = %d", ret); ui_view_destroy(view); return; } diff --git a/src/examples/efl/c/page2.cpp b/src/examples/efl/c/page2.cpp index be9b03a..a9b1dbd 100644 --- a/src/examples/efl/c/page2.cpp +++ b/src/examples/efl/c/page2.cpp @@ -18,13 +18,13 @@ #include "main.h" static void -view2_prev_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +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) +next_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) { create_page3(); } @@ -32,18 +32,21 @@ view2_next_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) static bool view2_load_cb(ui_view *view, void *data) { - Evas_Object *base_layout = ui_view_base_get(view); + Evas_Object *content = NULL; + Evas_Object *base = NULL; - Evas_Object *content = create_content(base_layout, "ViewMgr Demo
Title Buttons", - view2_prev_btn_clicked_cb, view2_next_btn_clicked_cb); + base = ui_view_base_get(view); + if (!base) return false; + + content = create_content(base, "ViewMgr Demo
Title Buttons", prev_btn_clicked_cb, next_btn_clicked_cb); //Title left button - Elm_Button *left_title_btn = elm_button_add(base_layout); + Elm_Button *left_title_btn = elm_button_add(base); elm_object_text_set(left_title_btn, "Cancel"); //Title right button - Elm_Button *right_title_btn = elm_button_add(base_layout); - elm_object_text_set(right_title_btn, "Done"); + Elm_Button *right_title_btn = elm_button_add(base); + elm_object_text_set(right_title_btn, "Done2221"); ui_standard_view_content_set(view, content, "Page2", NULL, left_title_btn, right_title_btn); @@ -53,16 +56,23 @@ view2_load_cb(ui_view *view, void *data) void create_page2() { + int ret = 0; + ui_view *view = NULL; ui_view_lifecycle_callback_s lifecycle_callback = {0, }; - lifecycle_callback.load = view2_load_cb; - - ui_view *view = ui_standard_view_create("page2"); + view = ui_standard_view_create("page2"); + if (!view) + { + dlog_print(DLOG_ERROR, LOG_TAG, "failed to create a view"); + return; + } - int ret = ui_view_lifecycle_callbacks_set(view, &lifecycle_callback, NULL); - if (!ret) + lifecycle_callback.load = view2_load_cb; + if (!ui_view_lifecycle_callbacks_set(view, &lifecycle_callback, NULL)) { - dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_lifecycle_callback_set is failed. err = %d", ret); + dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_lifecycle_callback_set() is failed. err = %d", ret); + ui_view_destroy(view); + return; } UI_VIEWMGR_VIEW_PUSH(view); diff --git a/src/include/efl/mobile/c/ui_app.h b/src/include/efl/mobile/c/ui_app.h index 81609e3..4ecefb6 100644 --- a/src/include/efl/mobile/c/ui_app.h +++ b/src/include/efl/mobile/c/ui_app.h @@ -5,6 +5,7 @@ extern "C" { #endif + //FIXME: rename prefix bool ui_app_init(const char *pkg, const char *locale_dir); int ui_app_run(int argc, char **argv, ui_app_lifecycle_callback_s *lifecycle_callback, void *data); diff --git a/src/include/efl/mobile/c/ui_mobile_viewmanager.h b/src/include/efl/mobile/c/ui_mobile_viewmanager.h index 2be78e0..97cd19e 100644 --- a/src/include/efl/mobile/c/ui_mobile_viewmanager.h +++ b/src/include/efl/mobile/c/ui_mobile_viewmanager.h @@ -36,6 +36,7 @@ #define ui_menu void #define ui_popup void + //FIXME: better way? #include "../../../interface/ui_iface_types.h" diff --git a/src/include/efl/mobile/c/ui_viewmgr.h b/src/include/efl/mobile/c/ui_viewmgr.h index 1ccd338..c37a4c8 100644 --- a/src/include/efl/mobile/c/ui_viewmgr.h +++ b/src/include/efl/mobile/c/ui_viewmgr.h @@ -9,29 +9,20 @@ ui_view *ui_viewmgr_view_push(ui_viewmgr *viewmgr, ui_view *view); bool ui_viewmgr_view_push_insert_before(ui_viewmgr *viewmgr, ui_view *view, ui_view *before); bool ui_viewmgr_view_push_insert_after(ui_viewmgr *viewmgr, ui_view *view, ui_view *after); bool ui_viewmgr_view_pop(ui_viewmgr *viewmgr); - bool ui_viewmgr_activate(ui_viewmgr *viewmgr); bool ui_viewmgr_deactivate(ui_viewmgr *viewmgr); - Elm_Win *ui_viewmgr_window_get(ui_viewmgr *viewmgr); - -Elm_Conformant *ui_viewmgr_conformant_get(ui_viewmgr *viewmgr); - ui_view *ui_viewmgr_last_view_get(ui_viewmgr *viewmgr); - ui_view *ui_viewmgr_view_get(ui_viewmgr *viewmgr, int idx); - +//ui_view *ui_viewmgr_view_get_by_id(ui_viewmgr *viewmgr, const char *id); Evas_Object *ui_viewmgr_base_get(ui_viewmgr *viewmgr); - int ui_viewmgr_view_count_get(ui_viewmgr *viewmgr); - bool ui_viewmgr_soft_key_need_get(ui_viewmgr *viewmgr); - ui_viewmgr *ui_viewmgr_viewmgr_get(); #define UI_VIEWMGR_DEACTIVATE() (ui_viewmgr_deactivate(ui_app_viewmgr_get())) #define UI_VIEWMGR_VIEW_PUSH(x) (ui_viewmgr_view_push(ui_app_viewmgr_get(), x)) -#define UI_VIEWMGR_VIEW_POP() (ui_viewmgr_view_pop(ui_app_viewmgr_get())) +#define UI_VIEWMGR_VIEW_POP() (ui_viewmgr_view_pop(ui_app_viewmgr_get())) #ifdef __cplusplus } diff --git a/src/lib/efl/mobile/c/ui_standard_view.cpp b/src/lib/efl/mobile/c/ui_standard_view.cpp index 16059a3..cd93fc3 100644 --- a/src/lib/efl/mobile/c/ui_standard_view.cpp +++ b/src/lib/efl/mobile/c/ui_standard_view.cpp @@ -135,7 +135,7 @@ bool ui_standard_view_content_set(ui_view *view, Evas_Object *content, const cha { if (!view) { - LOGE("Invalid View"); + LOGE("Invalid ui_view"); return false; } @@ -148,7 +148,7 @@ bool ui_standard_view_title_set(ui_view *view, const char *text) { if (!view) { - LOGE("Invalid View"); + LOGE("Invalid ui_view"); return false; } @@ -161,7 +161,7 @@ bool ui_standard_view_sub_title_set(ui_view *view, const char *text) { if (!view) { - LOGE("Invalid View"); + LOGE("Invalid ui_view"); return false; } @@ -174,7 +174,7 @@ bool ui_standard_view_title_badge_set(ui_view *view, const char *badge_text) { if (!view) { - LOGE("Invalid View"); + LOGE("Invalid ui_view"); return false; } @@ -187,7 +187,7 @@ bool ui_standard_view_title_right_btn_set(ui_view *view, Evas_Object *title_righ { if (!view) { - LOGE("Invalid View"); + LOGE("Invalid ui_view"); return false; } @@ -200,7 +200,7 @@ Elm_Button *ui_standard_view_title_right_btn_get(ui_view *view) { if (!view) { - LOGE("Invalid View"); + LOGE("Invalid ui_view"); return NULL; } @@ -213,7 +213,7 @@ Elm_Button *ui_standard_view_title_right_btn_unset(ui_view *view) { if (!view) { - LOGE("Invalid View"); + LOGE("Invalid ui_view"); return NULL; } @@ -226,7 +226,7 @@ bool ui_standard_view_title_left_btn_set(ui_view *view, Evas_Object *title_left_ { if (!view) { - LOGE("Invalid View"); + LOGE("Invalid ui_view"); return false; } @@ -239,7 +239,7 @@ Elm_Button *ui_standard_view_title_left_btn_get(ui_view *view) { if (!view) { - LOGE("Invalid View"); + LOGE("Invalid ui_view"); return NULL; } @@ -252,7 +252,7 @@ Elm_Button *ui_standard_view_title_left_btn_unset(ui_view *view) { if (!view) { - LOGE("Invalid View"); + LOGE("Invalid ui_view"); return NULL; } @@ -265,7 +265,7 @@ bool ui_standard_view_toolbar_set(ui_view *view, Elm_Toolbar *toolbar) { if (!view) { - LOGE("Invalid View"); + LOGE("Invalid ui_view"); return false; } @@ -278,7 +278,7 @@ Elm_Toolbar *ui_standard_view_toolbar_get(ui_view *view) { if (!view) { - LOGE("Invalid View"); + LOGE("Invalid ui_view"); return NULL; } @@ -291,7 +291,7 @@ Elm_Toolbar *ui_standard_view_toolbar_unset(ui_view *view) { if (!view) { - LOGE("Invalid View"); + LOGE("Invalid ui_view"); return NULL; } @@ -304,7 +304,7 @@ bool ui_standard_view_title_visible_set(ui_view *view, bool visible, bool anim) { if (!view) { - LOGE("Invalid View"); + LOGE("Invalid ui_view"); return false; } diff --git a/src/lib/efl/mobile/c/ui_view.cpp b/src/lib/efl/mobile/c/ui_view.cpp index f28ecff..d63c9eb 100644 --- a/src/lib/efl/mobile/c/ui_view.cpp +++ b/src/lib/efl/mobile/c/ui_view.cpp @@ -129,7 +129,7 @@ bool ui_view_lifecycle_callbacks_set(ui_view *view, ui_view_lifecycle_callback_s { if (!view) { - LOGE("Invalid View"); + LOGE("Invalid ui_view"); return false; } @@ -153,7 +153,7 @@ bool ui_view_event_callbacks_set(ui_view *view, ui_view_event_callback_s *event_ { if (!view) { - LOGE("Invalid View"); + LOGE("Invalid ui_view"); return false; } @@ -177,7 +177,7 @@ Evas_Object* ui_view_base_get(ui_view *view) { if (!view) { - LOGE("Invalid View"); + LOGE("Invalid ui_view"); return NULL; } return view->get_base(); @@ -187,7 +187,7 @@ Evas_Object *ui_view_content_unset(ui_view *view) { if (!view) { - LOGE("Invalid View"); + LOGE("Invalid ui_view"); return NULL; } @@ -198,7 +198,7 @@ void ui_view_indicator_set(ui_view *view, ui_view_indicator indicator) { if (!view) { - LOGE("Invalid View"); + LOGE("Invalid ui_view"); return; } @@ -209,7 +209,7 @@ ui_view_indicator ui_view_indicator_get(ui_view *view) { if (!view) { - LOGE("Invalid View"); + LOGE("Invalid ui_view"); return UI_VIEW_INDICATOR_LAST; } @@ -220,7 +220,7 @@ void ui_view_removable_content_set(ui_view *view, bool remove) { if (!view) { - LOGE("Invalid View"); + LOGE("Invalid ui_view"); return; } @@ -231,7 +231,7 @@ bool ui_view_removable_content_get(ui_view *view) { if (!view) { - LOGE("Invalid View"); + LOGE("Invalid ui_view"); return false; } @@ -242,7 +242,7 @@ int ui_view_degree_get(ui_view *view) { if (!view) { - LOGE("Invalid View"); + LOGE("Invalid ui_view"); return -1; } @@ -253,7 +253,7 @@ bool ui_view_transition_style_set(ui_view *view, const char *style) { if (!view) { - LOGE("Invalid View"); + LOGE("Invalid ui_view"); return false; } @@ -264,7 +264,7 @@ const char *ui_view_transition_style_get(ui_view *view) { if (!view) { - LOGE("Invalid View"); + LOGE("Invalid ui_view"); return NULL; } @@ -275,7 +275,7 @@ const ui_menu *ui_view_menu_get(ui_view *view) { if (!view) { - LOGE("Invalid View"); + LOGE("Invalid ui_view"); return NULL; } @@ -286,7 +286,7 @@ bool ui_view_name_set(ui_view *view, const char *name) { if (!view) { - LOGE("Invalid View"); + LOGE("Invalid ui_view"); return false; } @@ -298,7 +298,7 @@ const char *ui_view_name_get(ui_view *view) { if (!view) { - LOGE("Invalid View"); + LOGE("Invalid ui_view"); return NULL; } @@ -310,7 +310,7 @@ ui_view_state ui_view_state_get(ui_view *view) { if (!view) { - LOGE("Invalid View"); + LOGE("Invalid ui_view"); return UI_VIEW_STATE_UNKNOWN; } @@ -321,19 +321,18 @@ Evas_Object *ui_view_content_get(ui_view *view) { if (!view) { - LOGE("Invalid View"); + LOGE("Invalid ui_view"); return NULL; } return view->get_content(); - } bool ui_view_destroy(ui_view *view) { if (!view) { - LOGE("Invalid View"); + LOGE("Invalid ui_view"); return false; } delete (view); @@ -349,7 +348,7 @@ bool ui_view_content_set(ui_view *view, Evas_Object *content) { if (!view) { - LOGE("Invalid View"); + LOGE("Invalid ui_view"); return false; } return view->set_content(content); diff --git a/src/lib/efl/mobile/c/ui_viewmgr.cpp b/src/lib/efl/mobile/c/ui_viewmgr.cpp index 10965c6..7bc9447 100644 --- a/src/lib/efl/mobile/c/ui_viewmgr.cpp +++ b/src/lib/efl/mobile/c/ui_viewmgr.cpp @@ -3,152 +3,139 @@ using namespace efl_viewmanager; -extern "C" { - ui_view *ui_viewmgr_view_push(ui_viewmgr *viewmgr, ui_view *view) +ui_view *ui_viewmgr_view_push(ui_viewmgr *viewmgr, ui_view *view) +{ + if (!viewmgr || !view) { - if (!viewmgr || !view) - { - LOGE("Invalid Parameter viewmgr = %p, view = %p", viewmgr, view); - return NULL; - } - - return static_cast(viewmgr->push_view(view)); + LOGE("Invalid Parameter viewmgr = %p, view = %p", viewmgr, view); + return NULL; } - bool ui_viewmgr_view_push_insert_before(ui_viewmgr *viewmgr, ui_view *view, ui_view *before) - { - if (!viewmgr || !view || !before) - { - LOGE("Invalid Parameter viewmgr = %p, view = %p, before = %p", viewmgr, view, before); - return -1; - } - - return viewmgr->insert_view_before(view, before); - } + return dynamic_cast(viewmgr->push_view(view)); +} - bool ui_viewmgr_view_push_insert_after(ui_viewmgr *viewmgr, ui_view *view, ui_view *after) +bool ui_viewmgr_view_insert_before(ui_viewmgr *viewmgr, ui_view *view, ui_view *before) +{ + if (!viewmgr || !view) { - if (!viewmgr || !view || !after) - { - LOGE("Invalid Parameter viewmgr = %p, view = %p, after = %p", viewmgr, view, after); - return -1; - } - - return viewmgr->insert_view_after(view, after); + LOGE("Invalid Parameter viewmgr = %p, view = %p, before = %p", viewmgr, view, before); + return false; } - bool ui_viewmgr_view_pop(ui_viewmgr *viewmgr) - { - if (!viewmgr) - { - LOGE("Invalid Viewmgr"); - return -1; - } - - return viewmgr->pop_view(); - } + return viewmgr->insert_view_before(view, before); +} - bool ui_viewmgr_activate(ui_viewmgr *viewmgr) +bool ui_viewmgr_view_insert_after(ui_viewmgr *viewmgr, ui_view *view, ui_view *after) +{ + if (!viewmgr || !view) { - if (!viewmgr) - { - LOGE("Invalid Viewmgr"); - return -1; - } - - return viewmgr->activate(); + LOGE("Invalid Parameter viewmgr = %p, view = %p, after = %p", viewmgr, view, after); + return false; } - bool ui_viewmgr_deactivate(ui_viewmgr *viewmgr) - { - if (!viewmgr) - { - LOGE("Invalid Viewmgr"); - return -1; - } + return viewmgr->insert_view_after(view, after); +} - return viewmgr->deactivate(); +bool ui_viewmgr_view_pop(ui_viewmgr *viewmgr) +{ + if (!viewmgr) + { + LOGE("Invalid ui_viewmgr"); + return -1; } - Elm_Win *ui_viewmgr_window_get(ui_viewmgr *viewmgr) - { - if (!viewmgr) - { - LOGE("Invalid Viewmgr"); - return NULL; - } + return viewmgr->pop_view(); +} - return viewmgr->get_window(); +bool ui_viewmgr_activate(ui_viewmgr *viewmgr) +{ + if (!viewmgr) + { + LOGE("Invalid ui_viewmgr"); + return -1; } - Elm_Conformant *ui_viewmgr_conformant_get(ui_viewmgr *viewmgr) - { - if (!viewmgr) - { - LOGE("Invalid Viewmgr"); - return NULL; - } + return viewmgr->activate(); +} - return viewmgr->get_conformant(); +bool ui_viewmgr_deactivate(ui_viewmgr *viewmgr) +{ + if (!viewmgr) + { + LOGE("Invalid ui_viewmgr"); + return -1; } - ui_view *ui_viewmgr_last_view_get(ui_viewmgr *viewmgr) - { - if (!viewmgr) - { - LOGE("Invalid Viewmgr"); - return NULL; - } + return viewmgr->deactivate(); +} - return static_cast(viewmgr->get_last_view()); +Elm_Win *ui_viewmgr_window_get(ui_viewmgr *viewmgr) +{ + if (!viewmgr) + { + LOGE("Invalid ui_viewmgr"); + return NULL; } - ui_view *ui_viewmgr_view_get(ui_viewmgr *viewmgr, int idx) - { - if (!viewmgr) - { - LOGE("Invalid Viewmgr"); - return NULL; - } + return viewmgr->get_window(); +} - return static_cast(viewmgr->get_view(idx)); +ui_view *ui_viewmgr_last_view_get(ui_viewmgr *viewmgr) +{ + if (!viewmgr) + { + LOGE("Invalid ui_viewmgr"); + return NULL; } - Evas_Object *ui_viewmgr_base_get(ui_viewmgr *viewmgr) - { - if (!viewmgr) - { - LOGE("Invalid Viewmgr"); - return NULL; - } + return dynamic_cast(viewmgr->get_last_view()); +} - return viewmgr->get_base(); +ui_view *ui_viewmgr_view_get(ui_viewmgr *viewmgr, int idx) +{ + if (!viewmgr) + { + LOGE("Invalid ui_viewmgr"); + return NULL; } - int ui_viewmgr_view_count_get(ui_viewmgr *viewmgr) - { - if (!viewmgr) - { - LOGE("Invalid Viewmgr"); - return -1; - } + return dynamic_cast(viewmgr->get_view(idx)); +} - return viewmgr->get_view_count(); +Evas_Object *ui_viewmgr_base_get(ui_viewmgr *viewmgr) +{ + if (!viewmgr) + { + LOGE("Invalid ui_viewmgr"); + return NULL; } - bool ui_viewmgr_soft_key_need_get(ui_viewmgr *viewmgr) - { - if (!viewmgr) - { - LOGE("Invalid Viewmgr"); - return false; - } + return viewmgr->get_base(); +} - return viewmgr->need_soft_key(); +int ui_viewmgr_view_count_get(ui_viewmgr *viewmgr) +{ + if (!viewmgr) + { + LOGE("Invalid ui_viewmgr"); + return -1; } - ui_viewmgr *ui_viewmgr_viewmgr_get() + return viewmgr->get_view_count(); +} + +bool ui_viewmgr_soft_key_need_get(ui_viewmgr *viewmgr) +{ + if (!viewmgr) { - return UI_VIEWMGR; + LOGE("Invalid ui_viewmgr"); + return false; } + + return viewmgr->need_soft_key(); +} + +ui_viewmgr *ui_viewmgr_viewmgr_get() +{ + return UI_VIEWMGR; } diff --git a/src/lib/efl/mobile/ui_viewmgr.cpp b/src/lib/efl/mobile/ui_viewmgr.cpp index 6fc311f..6a44384 100644 --- a/src/lib/efl/mobile/ui_viewmgr.cpp +++ b/src/lib/efl/mobile/ui_viewmgr.cpp @@ -29,7 +29,6 @@ class ui_viewmgr_impl; /***********************************************************************************************/ /* External class Implementation */ /***********************************************************************************************/ - ui_viewmgr::ui_viewmgr(const char *pkg) : ui_base_viewmgr(pkg, new ui_key_listener(this)) {