From: Hermet Park Date: Wed, 28 Sep 2016 14:06:31 +0000 (+0900) Subject: c: integerate lifecycle interfaces with events. X-Git-Tag: submit/tizen/20160930.094404^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F58%2F90158%2F1;p=platform%2Fcore%2Fuifw%2Fui-viewmgr.git c: integerate lifecycle interfaces with events. C Interface design has not been confirmed. but finally we did. This was for the pre/post event callbacks for life-cycle and common events. Change-Id: I2f632ca3de5149b8ac24b383e70730c30a675ff5 Conflicts: src/include/efl/mobile/c/ui_application.h Change-Id: Ia9bda8a64e8c7a3bffb1b303053fc5b4c355e5d9 --- diff --git a/src/examples/efl/c/main.cpp b/src/examples/efl/c/main.cpp index 203674f..e4765f6 100644 --- a/src/examples/efl/c/main.cpp +++ b/src/examples/efl/c/main.cpp @@ -1,7 +1,7 @@ #include "main.h" static bool -app_create(void *data) +app_create(void *user_data, void *event_info) { /* Hook to take necessary actions before main event loop starts. Initialize Application base resources and application's data @@ -14,8 +14,10 @@ app_create(void *data) } static bool -app_control(app_control_h app_control, void *user_data) +app_control(void *user_data, void *event_info) { + //app_control_h app_control = (app_control_h) event_info; + /* Handle the launch request. */ return true; @@ -24,7 +26,11 @@ app_control(app_control_h app_control, void *user_data) int main(int argc, char *argv[]) { - ui_application_lifecycle_cb_s app_lifecycle_cb = {0, }; + ui_application_event_s events[]= { + {UI_APPLICATION_EVENT_CREATE, app_create}, + {UI_APPLICATION_EVENT_CONTROL, app_control}, + {UI_APPLICATION_EVENT_LAST, NULL} + }; //Initialize ui_app. ui_app initializes basic resources including ui_viewmgr internally. if (!ui_application_init(PACKAGE, LOCALE_DIR)) @@ -33,12 +39,8 @@ main(int argc, char *argv[]) return 0; } - //Register life cycle callback functions. - app_lifecycle_cb.create = app_create; - app_lifecycle_cb.control = app_control; - //Run ui_app. Now it requests to run an application mainloop. - if (!ui_application_run(argc, argv, &app_lifecycle_cb, NULL)) + if (!ui_application_run(argc, argv, events, NULL)) { dlog_print(DLOG_ERROR, LOG_TAG, "ui_app_run() is failed"); return 0; diff --git a/src/examples/efl/c/page1.cpp b/src/examples/efl/c/page1.cpp index 7ac56d5..52ab799 100644 --- a/src/examples/efl/c/page1.cpp +++ b/src/examples/efl/c/page1.cpp @@ -63,7 +63,6 @@ create_page1() { int ret = 0; ui_standard_view *view = NULL; - ui_view_lifecycle_cb_s lifecycle_cb = {0, }; //Create a view. view = ui_standard_view_create("page1"); @@ -73,11 +72,10 @@ create_page1() return; } - //Set View Life-Cycle callbacks. - lifecycle_cb.load = view1_load_cb; - if (!(ret = ui_view_set_lifecycle_cb(view, &lifecycle_cb, NULL))) + //Set View Load callback. + if (!(ret = ui_view_set_event_cb(view, UI_VIEW_EVENT_LOAD, view1_load_cb, NULL))) { - dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_lifecycle_cb() is failed. err = %d", ret); + dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_event_cb() is failed. err = %d", ret); ui_view_destroy(view); return; } diff --git a/src/examples/efl/c/page10.cpp b/src/examples/efl/c/page10.cpp index c1ab302..c6559f5 100644 --- a/src/examples/efl/c/page10.cpp +++ b/src/examples/efl/c/page10.cpp @@ -79,7 +79,6 @@ create_page10() { int ret = 0; ui_standard_view *view = NULL; - ui_view_lifecycle_cb_s view_lifecycle_cb = {0, }; //Create a view. view = ui_standard_view_create("page10"); @@ -89,16 +88,15 @@ create_page10() return; } - //Set View Life-Cycle callbacks. - view_lifecycle_cb.load = view10_load_cb; - if (!(ret = ui_view_set_lifecycle_cb(view, &view_lifecycle_cb, NULL))) + //Set View Load callback. + if (!(ret = ui_view_set_event_cb(view, UI_VIEW_EVENT_LOAD, view10_load_cb, NULL))) { - dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_lifecycle_cb() is failed. err = %d", ret); + dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_event_cb() is failed. err = %d", ret); ui_view_destroy(view); return; } - //Set Rotation Event callbacks. + //Set Rotation callback. if (!(ret = ui_view_set_event_cb(view, UI_VIEW_EVENT_ROTATE, view10_rotate_cb, NULL))) { dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_event_cb() is failed. err = %d", ret); diff --git a/src/examples/efl/c/page11.cpp b/src/examples/efl/c/page11.cpp index 56f685f..d3e46e1 100644 --- a/src/examples/efl/c/page11.cpp +++ b/src/examples/efl/c/page11.cpp @@ -108,7 +108,6 @@ create_page11() { int ret = 0; ui_standard_view *view = NULL; - ui_view_lifecycle_cb_s view_lifecycle_cb = {0, }; //Create a view. view = ui_standard_view_create("page11"); @@ -118,16 +117,15 @@ create_page11() return; } - //Set View Life-Cycle callback. - view_lifecycle_cb.load = view11_load_cb; - if (!(ret = ui_view_set_lifecycle_cb(view, &view_lifecycle_cb, NULL))) + //Set View Load callback. + if (!(ret = ui_view_set_event_cb(view, UI_VIEW_EVENT_LOAD, view11_load_cb, NULL))) { - dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_lifecycle_cb() is failed. err = %d", ret); + dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_event_cb() is failed. err = %d", ret); ui_view_destroy(view); return; } - //Set Menu Event callback. + //Set Menu callback. if (!(ret = ui_view_set_event_cb(view, UI_VIEW_EVENT_MENU, view11_menu_cb, NULL))) { dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_event_cb() is failed. err = %d", ret); diff --git a/src/examples/efl/c/page12.cpp b/src/examples/efl/c/page12.cpp index 8ca7a98..514a44e 100644 --- a/src/examples/efl/c/page12.cpp +++ b/src/examples/efl/c/page12.cpp @@ -133,7 +133,6 @@ create_page12() { int ret = 0; ui_standard_view *view = NULL; - ui_view_lifecycle_cb_s view_lifecycle_cb = {0, }; //Create a view view = ui_standard_view_create("page12"); @@ -143,11 +142,10 @@ create_page12() return; } - //Set View Life-Cycle callbacks. - view_lifecycle_cb.load = view12_load_cb; - if (!(ret = ui_view_set_lifecycle_cb(view, &view_lifecycle_cb, NULL))) + //Set View Load callback. + if (!(ret = ui_view_set_event_cb(view, UI_VIEW_EVENT_LOAD, view12_load_cb, NULL))) { - dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_lifecycle_cb() is failed. err = %d", ret); + dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_event_cb() is failed. err = %d", ret); ui_view_destroy(view); return; } diff --git a/src/examples/efl/c/page13.cpp b/src/examples/efl/c/page13.cpp index a2f5321..bb89924 100644 --- a/src/examples/efl/c/page13.cpp +++ b/src/examples/efl/c/page13.cpp @@ -62,7 +62,6 @@ create_page13() { int ret = 0; ui_standard_view *view = NULL; - ui_view_lifecycle_cb_s view_lifecycle_cb = {0, }; //Create a view. view = ui_standard_view_create("page13"); @@ -75,11 +74,10 @@ create_page13() //Set Fade Transition Effect. ui_view_set_transition_style(view, "fade"); - //Set View Life-Cycle callbacks. - view_lifecycle_cb.load = view13_load_cb; - if (!(ret = ui_view_set_lifecycle_cb(view, &view_lifecycle_cb, NULL))) + //Set View Load callback. + if (!(ret = ui_view_set_event_cb(view, UI_VIEW_EVENT_LOAD, view13_load_cb, NULL))) { - dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_lifecycle_cb() is failed. err = %d", ret); + dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_event_cb() is failed. err = %d", ret); ui_view_destroy(view); return; } diff --git a/src/examples/efl/c/page14.cpp b/src/examples/efl/c/page14.cpp index ee6cc41..b790450 100644 --- a/src/examples/efl/c/page14.cpp +++ b/src/examples/efl/c/page14.cpp @@ -62,7 +62,6 @@ create_page14() { int ret = 0; ui_standard_view *view = NULL; - ui_view_lifecycle_cb_s view_lifecycle_cb = {0, }; //Create a view. view = ui_standard_view_create("page14"); @@ -75,11 +74,10 @@ create_page14() //Turn off Transition Effect. ui_view_set_transition_style(view, "none"); - //Set View Life-Cycle callbacks. - view_lifecycle_cb.load = view14_load_cb; - if (!(ret = ui_view_set_lifecycle_cb(view, &view_lifecycle_cb, NULL))) + //Set View Load callback. + if (!(ret = ui_view_set_event_cb(view, UI_VIEW_EVENT_LOAD, view14_load_cb, NULL))) { - dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_lifecycle_cb() is failed. err = %d", ret); + dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_event_cb() is failed. err = %d", ret); ui_view_destroy(view); return; } diff --git a/src/examples/efl/c/page15.cpp b/src/examples/efl/c/page15.cpp index 495acf9..11b4e06 100644 --- a/src/examples/efl/c/page15.cpp +++ b/src/examples/efl/c/page15.cpp @@ -62,7 +62,6 @@ create_page15() { int ret = 0; ui_standard_view *view = NULL; - ui_view_lifecycle_cb_s view_lifecycle_cb = {0, }; view = ui_standard_view_create("page15"); if (!view) @@ -71,11 +70,10 @@ create_page15() return; } - //Set View Life-Cycle callbacks. - view_lifecycle_cb.load = view15_load_cb; - if (!(ret = ui_view_set_lifecycle_cb(view, &view_lifecycle_cb, NULL))) + //Set View Load callback. + if (!(ret = ui_view_set_event_cb(view, UI_VIEW_EVENT_LOAD, view15_load_cb, NULL))) { - dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_lifecycle_cb() is failed. err = %d", ret); + dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_event_cb() is failed. err = %d", ret); ui_view_destroy(view); return; } diff --git a/src/examples/efl/c/page16.cpp b/src/examples/efl/c/page16.cpp index d472bd1..4427a9e 100644 --- a/src/examples/efl/c/page16.cpp +++ b/src/examples/efl/c/page16.cpp @@ -90,7 +90,6 @@ create_page16() { int ret = 0; ui_standard_view *view = NULL; - ui_view_lifecycle_cb_s view_lifecycle_cb = {0, }; //Create a view. view = ui_standard_view_create("page16"); @@ -100,11 +99,10 @@ create_page16() return; } - //Set View Life-Cycle callbacks. - view_lifecycle_cb.load = view16_load_cb; - if (!(ret = ui_view_set_lifecycle_cb(view, &view_lifecycle_cb, NULL))) + //Set View Load callback. + if (!(ret = ui_view_set_event_cb(view, UI_VIEW_EVENT_LOAD, view16_load_cb, NULL))) { - dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_lifecycle_cb() is failed. err = %d", ret); + dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_event_cb() 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 76d6b33..ba66fd8 100644 --- a/src/examples/efl/c/page2.cpp +++ b/src/examples/efl/c/page2.cpp @@ -76,7 +76,6 @@ create_page2() { int ret = 0; ui_standard_view *view = NULL; - ui_view_lifecycle_cb_s view_lifecycle_cb = {0, }; //Create a view. view = ui_standard_view_create("page2"); @@ -86,11 +85,10 @@ create_page2() return; } - //Set View Life-Cycle callbacks. - view_lifecycle_cb.load = view2_load_cb; - if (!(ret = ui_view_set_lifecycle_cb(view, &view_lifecycle_cb, NULL))) + //Set View Load callback. + if (!(ret = ui_view_set_event_cb(view, UI_VIEW_EVENT_LOAD, view2_load_cb, NULL))) { - dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_lifecycle_cb() is failed. err = %d", ret); + dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_event_cb() is failed. err = %d", ret); ui_view_destroy(view); return; } diff --git a/src/examples/efl/c/page3.cpp b/src/examples/efl/c/page3.cpp index a85581a..fd1c464 100644 --- a/src/examples/efl/c/page3.cpp +++ b/src/examples/efl/c/page3.cpp @@ -63,7 +63,6 @@ create_page3() { int ret = 0; ui_standard_view *view = NULL; - ui_view_lifecycle_cb_s view_lifecycle_cb = {0, }; //Create a view. view = ui_standard_view_create("page3"); @@ -73,11 +72,10 @@ create_page3() return; } - //Set View Life-Cycle callbacks. - view_lifecycle_cb.load = view3_load_cb; - if (!(ret = ui_view_set_lifecycle_cb(view, &view_lifecycle_cb, NULL))) + //Set View Load callback. + if (!(ret = ui_view_set_event_cb(view, UI_VIEW_EVENT_LOAD, view3_load_cb, NULL))) { - dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_lifecycle_cb() is failed. err = %d", ret); + dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_event_cb() is failed. err = %d", ret); ui_view_destroy(view); return; } diff --git a/src/examples/efl/c/page4.cpp b/src/examples/efl/c/page4.cpp index 01c6449..1c2ddf7 100644 --- a/src/examples/efl/c/page4.cpp +++ b/src/examples/efl/c/page4.cpp @@ -63,7 +63,6 @@ create_page4() { int ret = 0; ui_standard_view *view = NULL; - ui_view_lifecycle_cb_s view_lifecycle_cb = {0, }; //Create a view. view = ui_standard_view_create("page4"); @@ -73,11 +72,10 @@ create_page4() return; } - //Set View Life-Cycle callbacks. - view_lifecycle_cb.load = view4_load_cb; - if (!(ret = ui_view_set_lifecycle_cb(view, &view_lifecycle_cb, NULL))) + //Set View Load callback. + if (!(ret = ui_view_set_event_cb(view, UI_VIEW_EVENT_LOAD, view4_load_cb, NULL))) { - dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_lifecycle_cb() is failed. err = %d", ret); + dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_event_cb() is failed. err = %d", ret); ui_view_destroy(view); return; } diff --git a/src/examples/efl/c/page5.cpp b/src/examples/efl/c/page5.cpp index 8a5095f..17b03fd 100644 --- a/src/examples/efl/c/page5.cpp +++ b/src/examples/efl/c/page5.cpp @@ -63,7 +63,6 @@ create_page5() { int ret = 0; ui_view *view = NULL; - ui_view_lifecycle_cb_s view_lifecycle_cb = {0, }; //Create a view. view = ui_view_create("page5"); @@ -73,11 +72,10 @@ create_page5() return; } - //Set View Life-Cycle callbacks. - view_lifecycle_cb.load = view5_load_cb; - if (!(ret = ui_view_set_lifecycle_cb(view, &view_lifecycle_cb, NULL))) + //Set View Load callback. + if (!(ret = ui_view_set_event_cb(view, UI_VIEW_EVENT_LOAD, view5_load_cb, NULL))) { - dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_lifecycle_cb() is failed. err = %d", ret); + dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_event_cb() is failed. err = %d", ret); ui_view_destroy(view); return; } diff --git a/src/examples/efl/c/page6.cpp b/src/examples/efl/c/page6.cpp index bdaa662..5e4db64 100644 --- a/src/examples/efl/c/page6.cpp +++ b/src/examples/efl/c/page6.cpp @@ -66,7 +66,6 @@ create_page6() { int ret = 0; ui_standard_view *view = NULL; - ui_view_lifecycle_cb_s view_lifecycle_cb = {0, }; //Create a view. view = ui_standard_view_create("page6"); @@ -76,11 +75,10 @@ create_page6() return; } - //Set View Life-Cycle callbacks. - view_lifecycle_cb.load = view6_load_cb; - if (!(ret = ui_view_set_lifecycle_cb(view, &view_lifecycle_cb, NULL))) + //Set View Load callback. + if (!(ret = ui_view_set_event_cb(view, UI_VIEW_EVENT_LOAD, view6_load_cb, NULL))) { - dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_lifecycle_cb() is failed. err = %d", ret); + dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_event_cb() is failed. err = %d", ret); ui_view_destroy(view); return; } diff --git a/src/examples/efl/c/page7.cpp b/src/examples/efl/c/page7.cpp index 7026186..d17ee64 100644 --- a/src/examples/efl/c/page7.cpp +++ b/src/examples/efl/c/page7.cpp @@ -66,7 +66,6 @@ create_page7() { int ret = 0; ui_standard_view *view = NULL; - ui_view_lifecycle_cb_s view_lifecycle_cb = {0, }; //Create a view. view = ui_standard_view_create("page7"); @@ -76,11 +75,10 @@ create_page7() return; } - //Set View Life-Cycle callbacks. - view_lifecycle_cb.load = view7_load_cb; - if (!(ret = ui_view_set_lifecycle_cb(view, &view_lifecycle_cb, NULL))) + //Set View Load callback. + if (!(ret = ui_view_set_event_cb(view, UI_VIEW_EVENT_LOAD, view7_load_cb, NULL))) { - dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_lifecycle_cb() is failed. err = %d", ret); + dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_event_cb() is failed. err = %d", ret); ui_view_destroy(view); return; } diff --git a/src/examples/efl/c/page9.cpp b/src/examples/efl/c/page9.cpp index e77c42f..479c145 100644 --- a/src/examples/efl/c/page9.cpp +++ b/src/examples/efl/c/page9.cpp @@ -103,7 +103,6 @@ create_page9() { int ret = 0; ui_standard_view *view = NULL; - ui_view_lifecycle_cb_s view_lifecycle_cb = {0, }; //Create a view. view = ui_standard_view_create("page9"); @@ -113,22 +112,21 @@ create_page9() return; } - //Set View Life-Cycle callbacks. - view_lifecycle_cb.load = view9_load_cb; - if (!(ret = ui_view_set_lifecycle_cb(view, &view_lifecycle_cb, NULL))) + //Set View Load callback. + if (!(ret = ui_view_set_event_cb(view, UI_VIEW_EVENT_LOAD, view9_load_cb, NULL))) { - dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_lifecycle_cb() is failed. err = %d", ret); + dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_event_cb() is failed. err = %d", ret); ui_view_destroy(view); return; } - //Set Portrait Event callback. + //Set Portrait callback. if (!(ret = ui_view_set_event_cb(view, UI_VIEW_EVENT_PORTRAIT, view9_portrait_cb, NULL))) { dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_event_cb() is failed. err = %d", ret); } - //Set Landscape Event callback. + //Set Landscape callback. if (!(ret = ui_view_set_event_cb(view, UI_VIEW_EVENT_LANDSCAPE, view9_landscape_cb, NULL))) { dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_set_event_cb() is failed. err = %d", ret); diff --git a/src/include/efl/mobile/c/_ui_common_view_capi.h b/src/include/efl/mobile/c/_ui_common_view_capi.h index 231bb01..bc5c565 100644 --- a/src/include/efl/mobile/c/_ui_common_view_capi.h +++ b/src/include/efl/mobile/c/_ui_common_view_capi.h @@ -23,16 +23,13 @@ namespace efl_viewmanager class ui_common_view_capi { public: - ui_view_lifecycle_cb_s lifecycle_cb = {nullptr, }; - void *lifecycle_data = nullptr; - //TODO: Optimize memory? We don't need all slots. ui_view_event_cb event_cb[UI_VIEW_EVENT_LAST] = {nullptr, }; void* event_data[UI_VIEW_EVENT_LAST] = {nullptr, }; const char *type = nullptr; - ui_common_view_capi(const char *type) : lifecycle_data(NULL), type(type) + ui_common_view_capi(const char *type) : type(type) { } diff --git a/src/include/efl/mobile/c/ui_application.h b/src/include/efl/mobile/c/ui_application.h index 2de61ff..dd77ff2 100644 --- a/src/include/efl/mobile/c/ui_application.h +++ b/src/include/efl/mobile/c/ui_application.h @@ -5,22 +5,30 @@ extern "C" { #endif -typedef bool (*ui_application_create_cb)(void *user_data); -typedef bool (*ui_application_terminate_cb)(void *user_data); -typedef bool (*ui_application_pause_cb)(void *user_data); -typedef bool (*ui_application_resume_cb)(void *user_data); -typedef bool (*ui_application_control_cb)(app_control_h app_control, void *user_data); +typedef bool (*ui_application_event_cb)(void *user_data, void *event_info); + +typedef enum { + UI_APPLICATION_EVENT_CREATE = 0, + UI_APPLICATION_EVENT_TERMINATE, + UI_APPLICATION_EVENT_PAUSE , + UI_APPLICATION_EVENT_RESUME, + UI_APPLICATION_EVENT_CONTROL, + + UI_APPLICATION_EVENT_CREATE_PRE, + UI_APPLICATION_EVENT_TERMINATE_PRE, + UI_APPLICATION_EVENT_PAUSE_PRE, + UI_APPLICATION_EVENT_RESUME_PRE, + UI_APPLICATION_EVENT_CONTROL_PRE, + + UI_APPLICATION_EVENT_LAST +} ui_application_event_type_e; typedef struct { - ui_application_create_cb create; - ui_application_terminate_cb terminate; - ui_application_pause_cb pause; - ui_application_resume_cb resume; - ui_application_control_cb control; - -} ui_application_lifecycle_cb_s; + ui_application_event_type_e event_type; + ui_application_event_cb event_cb; +} ui_application_event_s; /** * @defgroup CAPI_UI_APPLICATION UI Application @@ -54,14 +62,14 @@ EAPI bool ui_application_init(const char *pkg, const char *locale_dir); * * @param argc The argument count. * @param argv The argument vector. - * @param lifecycle_callback The set of callback functions to handle application lifecycle events. - * @param user_data The user data to be passed to the given @a life_cycle_callback functions. + * @param events event callback list. + * @param user_data user data for event callbacks * * @return @c true if it succeeds, @c false otherwise. * * @since_tizen 3.0 */ -EAPI bool ui_application_run(int argc, char **argv, ui_application_lifecycle_cb_s *app_lifecycle_cb, void *user_data); +EAPI bool ui_application_run(int argc, char **argv, ui_application_event_s *events, void *user_data); /** * @brief This is ui_application destructor. diff --git a/src/include/efl/mobile/c/ui_view.h b/src/include/efl/mobile/c/ui_view.h index 935ff42..50aa348 100644 --- a/src/include/efl/mobile/c/ui_view.h +++ b/src/include/efl/mobile/c/ui_view.h @@ -12,13 +12,6 @@ extern "C" { * @{ */ -/** - * @brief ui_view's lifecycle callback function signature. - * - * @since_tizen 3.0 - */ -typedef bool (*ui_view_lifecycle_cb)(ui_view *view, void *user_data); - /** * @brief ui_view's rotate event callback function signature. * @@ -26,34 +19,40 @@ typedef bool (*ui_view_lifecycle_cb)(ui_view *view, void *user_data); */ typedef bool (*ui_view_event_cb)(ui_view *view, void *user_data); -/** - * @brief The structure type containing the set of callback functions for handling view's lifecycle events. - * - * @since_tizen 3.0 - */ -typedef struct -{ - ui_view_lifecycle_cb load; - ui_view_lifecycle_cb unload; - ui_view_lifecycle_cb pause; - ui_view_lifecycle_cb resume; - ui_view_lifecycle_cb activate; - ui_view_lifecycle_cb deactivate; - ui_view_lifecycle_cb destroy; -} ui_view_lifecycle_cb_s; - - /** * @brief The Enumeration for view events. * * @since_tizen 3.0 */ typedef enum { - UI_VIEW_EVENT_ROTATE = 0, + UI_VIEW_EVENT_LOAD = 0, + UI_VIEW_EVENT_UNLOAD, + UI_VIEW_EVENT_PAUSE, + UI_VIEW_EVENT_RESUME, + UI_VIEW_EVENT_ACTIVATE, + UI_VIEW_EVENT_DEACTIVATE, + UI_VIEW_EVENT_DESTROY, + + UI_VIEW_EVENT_LOAD_POST, + UI_VIEW_EVENT_UNLOAD_POST, + UI_VIEW_EVENT_PAUSE_POST, + UI_VIEW_EVENT_RESUME_POST, + UI_VIEW_EVENT_ACTIVATE_POST, + UI_VIEW_EVENT_DEACTIVATE_POST, + UI_VIEW_EVENT_DESTROY_POST, + + UI_VIEW_EVENT_ROTATE, UI_VIEW_EVENT_PORTRAIT, UI_VIEW_EVENT_LANDSCAPE, UI_VIEW_EVENT_BACK, UI_VIEW_EVENT_MENU, + + UI_VIEW_EVENT_ROTATE_POST, + UI_VIEW_EVENT_PORTRAIT_POST, + UI_VIEW_EVENT_LANDSCAPE_POST, + UI_VIEW_EVENT_BACK_POST, + UI_VIEW_EVENT_MENU_POST, + UI_VIEW_EVENT_LAST } ui_view_event_type_e; @@ -86,19 +85,6 @@ EAPI ui_view *ui_view_create(const char *name); */ EAPI bool ui_view_set_content(ui_view *view, Eo *content); -/** - * @brief Set callback functions for handling view's lifecycle events. - * - * @param view An ui_view instance. - * @param lifecycle_cb The set of callback functions to handle application lifecycle events. - * @param user_data The user data to be passed to the given @a lifecycle_callback functions. - * - * @return @c true if it succeeds, @c false otherwise. - * - * @since_tizen 3.0 - */ -EAPI bool ui_view_set_lifecycle_cb(ui_view *view, ui_view_lifecycle_cb_s *lifecycle_cb, void *user_data); - /** * @brief Set callback functions for handling view events. * diff --git a/src/lib/efl/mobile/c/ui_application.cpp b/src/lib/efl/mobile/c/ui_application.cpp index c3c2995..412fcd3 100644 --- a/src/lib/efl/mobile/c/ui_application.cpp +++ b/src/lib/efl/mobile/c/ui_application.cpp @@ -4,16 +4,22 @@ class ui_app_capi : public UiApp { public: - ui_application_lifecycle_cb_s app_lifecycle_cb; - void *user_data; + + ui_application_event_cb event_cb[UI_APPLICATION_EVENT_LAST] = {nullptr, }; + void *user_data[UI_APPLICATION_EVENT_LAST] = {nullptr, }; bool onCreate() { + if (this->event_cb[UI_APPLICATION_EVENT_CREATE_PRE]) + { + if (!this->event_cb[UI_APPLICATION_EVENT_CREATE_PRE](this->user_data[UI_APPLICATION_EVENT_CREATE_PRE], nullptr)) return true; + } + if (!UiApp::onCreate()) return false; - if (this->app_lifecycle_cb.create) + if (this->event_cb[UI_APPLICATION_EVENT_CREATE]) { - return this->app_lifecycle_cb.create(this->user_data); + return this->event_cb[UI_APPLICATION_EVENT_CREATE](this->user_data[UI_APPLICATION_EVENT_CREATE], nullptr); } return true; @@ -21,47 +27,66 @@ public: void onTerminate() { + if (this->event_cb[UI_APPLICATION_EVENT_TERMINATE_PRE]) + { + if (!this->event_cb[UI_APPLICATION_EVENT_TERMINATE_PRE](this->user_data[UI_APPLICATION_EVENT_TERMINATE_PRE], nullptr)) return; + } + UiApp::onTerminate(); - if (this->app_lifecycle_cb.terminate) + if (this->event_cb[UI_APPLICATION_EVENT_TERMINATE]) { - this->app_lifecycle_cb.terminate(this->user_data); + this->event_cb[UI_APPLICATION_EVENT_TERMINATE](this->user_data[UI_APPLICATION_EVENT_TERMINATE], nullptr); } } void onPause() { + if (this->event_cb[UI_APPLICATION_EVENT_PAUSE_PRE]) + { + if (!this->event_cb[UI_APPLICATION_EVENT_PAUSE_PRE](this->user_data[UI_APPLICATION_EVENT_PAUSE_PRE], nullptr)) return; + } + UiApp::onPause(); - if (this->app_lifecycle_cb.pause) + if (this->event_cb[UI_APPLICATION_EVENT_PAUSE]) { - this->app_lifecycle_cb.pause(this->user_data); + this->event_cb[UI_APPLICATION_EVENT_PAUSE](this->user_data[UI_APPLICATION_EVENT_PAUSE], nullptr); } - } void onResume() { + if (this->event_cb[UI_APPLICATION_EVENT_RESUME_PRE]) + { + if (!this->event_cb[UI_APPLICATION_EVENT_RESUME_PRE](this->user_data[UI_APPLICATION_EVENT_RESUME_PRE], nullptr)) return; + } + UiApp::onResume(); - if (this->app_lifecycle_cb.resume) + if (this->event_cb[UI_APPLICATION_EVENT_RESUME]) { - this->app_lifecycle_cb.resume(this->user_data); + this->event_cb[UI_APPLICATION_EVENT_RESUME](this->user_data[UI_APPLICATION_EVENT_RESUME], nullptr); } } void onControl(app_control_h app_control) { + if (this->event_cb[UI_APPLICATION_EVENT_CONTROL_PRE]) + { + if (!this->event_cb[UI_APPLICATION_EVENT_CONTROL_PRE](this->user_data[UI_APPLICATION_EVENT_CONTROL_PRE], static_cast(app_control))) return; + } + UiApp::onControl(app_control); - if (this->app_lifecycle_cb.control) + if (this->event_cb[UI_APPLICATION_EVENT_CONTROL]) { - this->app_lifecycle_cb.control(app_control, this->user_data); + this->event_cb[UI_APPLICATION_EVENT_CONTROL](this->user_data[UI_APPLICATION_EVENT_CONTROL], static_cast(app_control)); } } ui_app_capi(const char *pkg, const char *locale_dir) - : UiApp(pkg, locale_dir), user_data(nullptr) + : UiApp(pkg, locale_dir) { } @@ -69,19 +94,16 @@ public: { } - bool run(int argc, char **argv, ui_application_lifecycle_cb_s* app_lifecycle_cb, void* user_data) + bool set_event_cb(ui_application_event_type_e event_type, ui_application_event_cb event_cb, void *user_data) { - if (app_lifecycle_cb) - { - this->app_lifecycle_cb = *app_lifecycle_cb; - } - else - { - memset(&this->app_lifecycle_cb, 0x0, sizeof(this->app_lifecycle_cb)); - } + this->event_cb[event_type] = event_cb; + this->user_data[event_type] = user_data; - this->user_data = user_data; + return true; + } + bool run(int argc, char **argv) + { return UiApp::run(argc, argv); } }; @@ -105,7 +127,7 @@ EAPI bool ui_application_init(const char *pkg, const char *locale_dir) return true; } -EAPI bool ui_application_run(int argc, char **argv, ui_application_lifecycle_cb_s* app_lifecycle_cb, void* user_data) +EAPI bool ui_application_run(int argc, char **argv, ui_application_event_s *events, void *user_data) { ui_app_capi *app = g_app; if (!app) @@ -114,7 +136,30 @@ EAPI bool ui_application_run(int argc, char **argv, ui_application_lifecycle_cb_ return false; } - return app->run(argc, argv, app_lifecycle_cb, user_data); + bool ret = true; + + int i = 0; + + while (true) + { + if (events[i].event_type == UI_APPLICATION_EVENT_LAST) break; + + if (events[i].event_type < UI_APPLICATION_EVENT_CREATE) + { + LOGE("events[%d] is invalid(%d)", i, events[i].event_type); + ret = false; + } + else + { + app->set_event_cb(events[i].event_type, events[i].event_cb, user_data); + } + + ++i; + } + + if (!ret) return false; + + return app->run(argc, argv); } EAPI bool ui_application_term(void) diff --git a/src/lib/efl/mobile/c/ui_standard_view.cpp b/src/lib/efl/mobile/c/ui_standard_view.cpp index a87fccf..c63d94b 100644 --- a/src/lib/efl/mobile/c/ui_standard_view.cpp +++ b/src/lib/efl/mobile/c/ui_standard_view.cpp @@ -10,65 +10,107 @@ class ui_standard_view_capi: public ui_standard_view, public ui_common_view_capi public: void onLoad() { - if (this->lifecycle_cb.load) + if (this->event_cb[UI_VIEW_EVENT_LOAD]) { - if (!this->lifecycle_cb.load(this, this->lifecycle_data)) return; + if (!this->event_cb[UI_VIEW_EVENT_LOAD](this, this->event_data[UI_VIEW_EVENT_LOAD])) return; } + ui_standard_view::onLoad(); + + if (this->event_cb[UI_VIEW_EVENT_LOAD_POST]) + { + if (!this->event_cb[UI_VIEW_EVENT_LOAD_POST](this, this->event_data[UI_VIEW_EVENT_LOAD_POST])) return; + } } void onUnload() { - if (this->lifecycle_cb.unload) + if (this->event_cb[UI_VIEW_EVENT_UNLOAD]) { - if (!this->lifecycle_cb.unload(this, this->lifecycle_data)) return; + if (!this->event_cb[UI_VIEW_EVENT_UNLOAD](this, this->event_data[UI_VIEW_EVENT_UNLOAD])) return; } + ui_standard_view::onUnload(); + + if (this->event_cb[UI_VIEW_EVENT_UNLOAD_POST]) + { + if (!this->event_cb[UI_VIEW_EVENT_UNLOAD_POST](this, this->event_data[UI_VIEW_EVENT_UNLOAD_POST])) return; + } } void onPause() { - if (this->lifecycle_cb.pause) + if (this->event_cb[UI_VIEW_EVENT_PAUSE]) { - if (!this->lifecycle_cb.pause(this, this->lifecycle_data)) return; + if (!this->event_cb[UI_VIEW_EVENT_PAUSE](this, this->event_data[UI_VIEW_EVENT_PAUSE])) return; } + ui_standard_view::onPause(); + + if (this->event_cb[UI_VIEW_EVENT_PAUSE_POST]) + { + if (!this->event_cb[UI_VIEW_EVENT_PAUSE_POST](this, this->event_data[UI_VIEW_EVENT_PAUSE_POST])) return; + } } void onResume() { - if (this->lifecycle_cb.resume) + if (this->event_cb[UI_VIEW_EVENT_RESUME]) { - if (!this->lifecycle_cb.resume(this, this->lifecycle_data)) return; + if (!this->event_cb[UI_VIEW_EVENT_RESUME](this, this->event_data[UI_VIEW_EVENT_RESUME])) return; } + ui_standard_view::onResume(); + + if (this->event_cb[UI_VIEW_EVENT_RESUME_POST]) + { + if (!this->event_cb[UI_VIEW_EVENT_RESUME_POST](this, this->event_data[UI_VIEW_EVENT_RESUME_POST])) return; + } } void onActivate() { - if (this->lifecycle_cb.activate) + if (this->event_cb[UI_VIEW_EVENT_ACTIVATE]) { - if (!this->lifecycle_cb.activate(this, this->lifecycle_data)) return; + if (!this->event_cb[UI_VIEW_EVENT_ACTIVATE](this, this->event_data[UI_VIEW_EVENT_ACTIVATE])) return; } + ui_standard_view::onActivate(); + + if (this->event_cb[UI_VIEW_EVENT_ACTIVATE_POST]) + { + if (!this->event_cb[UI_VIEW_EVENT_ACTIVATE_POST](this, this->event_data[UI_VIEW_EVENT_ACTIVATE_POST])) return; + } } void onDeactivate() { - if (this->lifecycle_cb.deactivate) + if (this->event_cb[UI_VIEW_EVENT_DEACTIVATE]) { - if (!this->lifecycle_cb.deactivate(this, this->lifecycle_data)) return; + if (!this->event_cb[UI_VIEW_EVENT_DEACTIVATE](this, this->event_data[UI_VIEW_EVENT_DEACTIVATE])) return; } + ui_standard_view::onDeactivate(); + + if (this->event_cb[UI_VIEW_EVENT_DEACTIVATE_POST]) + { + if (!this->event_cb[UI_VIEW_EVENT_DEACTIVATE_POST](this, this->event_data[UI_VIEW_EVENT_DEACTIVATE_POST])) return; + } } void onDestroy() { - if (this->lifecycle_cb.destroy) + if (this->event_cb[UI_VIEW_EVENT_DESTROY]) { - if (!this->lifecycle_cb.destroy(this, this->lifecycle_data)) return; + if (!this->event_cb[UI_VIEW_EVENT_DESTROY](this, this->event_data[UI_VIEW_EVENT_DESTROY])) return; } + ui_standard_view::onDestroy(); + + if (this->event_cb[UI_VIEW_EVENT_DESTROY_POST]) + { + if (!this->event_cb[UI_VIEW_EVENT_DESTROY_POST](this, this->event_data[UI_VIEW_EVENT_DESTROY_POST])) return; + } } void onPortrait() @@ -77,7 +119,13 @@ public: { if (!(*this->event_cb[UI_VIEW_EVENT_PORTRAIT])(this, this->event_data[UI_VIEW_EVENT_PORTRAIT])) return; } + ui_standard_view::onPortrait(); + + if (this->event_cb[UI_VIEW_EVENT_PORTRAIT_POST]) + { + if (!(*this->event_cb[UI_VIEW_EVENT_PORTRAIT_POST])(this, this->event_data[UI_VIEW_EVENT_PORTRAIT_POST])) return; + } } void onLandscape() @@ -86,7 +134,13 @@ public: { if (!(*this->event_cb[UI_VIEW_EVENT_LANDSCAPE])(this, this->event_data[UI_VIEW_EVENT_LANDSCAPE])) return; } + ui_standard_view::onLandscape(); + + if (this->event_cb[UI_VIEW_EVENT_LANDSCAPE_POST]) + { + if (!(*this->event_cb[UI_VIEW_EVENT_LANDSCAPE_POST])(this, this->event_data[UI_VIEW_EVENT_LANDSCAPE_POST])) return; + } } void onRotate(int degree) @@ -95,7 +149,13 @@ public: { if (!(*this->event_cb[UI_VIEW_EVENT_ROTATE])(this, this->event_data[UI_VIEW_EVENT_ROTATE])) return; } + ui_standard_view::onRotate(degree); + + if (this->event_cb[UI_VIEW_EVENT_ROTATE_POST]) + { + if (!(*this->event_cb[UI_VIEW_EVENT_ROTATE_POST])(this, this->event_data[UI_VIEW_EVENT_ROTATE_POST])) return; + } } void onBack() @@ -104,7 +164,13 @@ public: { if (!(*this->event_cb[UI_VIEW_EVENT_BACK])(this, this->event_data[UI_VIEW_EVENT_BACK])) return; } + ui_standard_view::onBack(); + + if (this->event_cb[UI_VIEW_EVENT_BACK_POST]) + { + if (!(*this->event_cb[UI_VIEW_EVENT_BACK_POST])(this, this->event_data[UI_VIEW_EVENT_BACK_POST])) return; + } } void onMenu(ui_menu *menu) @@ -113,7 +179,13 @@ public: { if (!(*this->event_cb[UI_VIEW_EVENT_MENU])(this, this->event_data[UI_VIEW_EVENT_MENU])) return; } + ui_standard_view::onMenu(menu); + + if (this->event_cb[UI_VIEW_EVENT_MENU_POST]) + { + if (!(*this->event_cb[UI_VIEW_EVENT_MENU_POST])(this, this->event_data[UI_VIEW_EVENT_MENU_POST])) return; + } } ui_standard_view_capi(const char *name) diff --git a/src/lib/efl/mobile/c/ui_view.cpp b/src/lib/efl/mobile/c/ui_view.cpp index 66bc07b..1315e5a 100644 --- a/src/lib/efl/mobile/c/ui_view.cpp +++ b/src/lib/efl/mobile/c/ui_view.cpp @@ -9,65 +9,107 @@ class ui_view_capi: public ui_view, public ui_common_view_capi public: void onLoad() { - if (this->lifecycle_cb.load) + if (this->event_cb[UI_VIEW_EVENT_LOAD]) { - if (!this->lifecycle_cb.load(this, this->lifecycle_data)) return; + if (!this->event_cb[UI_VIEW_EVENT_LOAD](this, this->event_data[UI_VIEW_EVENT_LOAD])) return; } + ui_view::onLoad(); + + if (this->event_cb[UI_VIEW_EVENT_LOAD_POST]) + { + if (!this->event_cb[UI_VIEW_EVENT_LOAD_POST](this, this->event_data[UI_VIEW_EVENT_LOAD_POST])) return; + } } void onUnload() { - if (this->lifecycle_cb.unload) + if (this->event_cb[UI_VIEW_EVENT_UNLOAD]) { - if (!this->lifecycle_cb.unload(this, this->lifecycle_data)) return; + if (!this->event_cb[UI_VIEW_EVENT_UNLOAD](this, this->event_data[UI_VIEW_EVENT_UNLOAD])) return; } + ui_view::onUnload(); + + if (this->event_cb[UI_VIEW_EVENT_UNLOAD_POST]) + { + if (!this->event_cb[UI_VIEW_EVENT_UNLOAD_POST](this, this->event_data[UI_VIEW_EVENT_UNLOAD_POST])) return; + } } void onPause() { - if (this->lifecycle_cb.pause) + if (this->event_cb[UI_VIEW_EVENT_PAUSE]) { - if (!this->lifecycle_cb.pause(this, this->lifecycle_data)) return; + if (!this->event_cb[UI_VIEW_EVENT_PAUSE](this, this->event_data[UI_VIEW_EVENT_PAUSE])) return; } + ui_view::onPause(); + + if (this->event_cb[UI_VIEW_EVENT_PAUSE_POST]) + { + if (!this->event_cb[UI_VIEW_EVENT_PAUSE_POST](this, this->event_data[UI_VIEW_EVENT_PAUSE_POST])) return; + } } void onResume() { - if (this->lifecycle_cb.resume) + if (this->event_cb[UI_VIEW_EVENT_RESUME]) { - if (!this->lifecycle_cb.resume(this, this->lifecycle_data)) return; + if (!this->event_cb[UI_VIEW_EVENT_RESUME](this, this->event_data[UI_VIEW_EVENT_RESUME])) return; } + ui_view::onResume(); + + if (this->event_cb[UI_VIEW_EVENT_RESUME_POST]) + { + if (!this->event_cb[UI_VIEW_EVENT_RESUME_POST](this, this->event_data[UI_VIEW_EVENT_RESUME_POST])) return; + } } void onActivate() { - if (this->lifecycle_cb.activate) + if (this->event_cb[UI_VIEW_EVENT_ACTIVATE]) { - if (!this->lifecycle_cb.activate(this, this->lifecycle_data)) return; + if (!this->event_cb[UI_VIEW_EVENT_ACTIVATE](this, this->event_data[UI_VIEW_EVENT_ACTIVATE])) return; } + ui_view::onActivate(); + + if (this->event_cb[UI_VIEW_EVENT_ACTIVATE_POST]) + { + if (!this->event_cb[UI_VIEW_EVENT_ACTIVATE_POST](this, this->event_data[UI_VIEW_EVENT_ACTIVATE_POST])) return; + } } void onDeactivate() { - if (this->lifecycle_cb.deactivate) + if (this->event_cb[UI_VIEW_EVENT_DEACTIVATE]) { - if (!this->lifecycle_cb.deactivate(this, this->lifecycle_data)) return; + if (!this->event_cb[UI_VIEW_EVENT_DEACTIVATE](this, this->event_data[UI_VIEW_EVENT_DEACTIVATE])) return; } + ui_view::onDeactivate(); + + if (this->event_cb[UI_VIEW_EVENT_DEACTIVATE_POST]) + { + if (!this->event_cb[UI_VIEW_EVENT_DEACTIVATE_POST](this, this->event_data[UI_VIEW_EVENT_DEACTIVATE_POST])) return; + } } void onDestroy() { - if (this->lifecycle_cb.destroy) + if (this->event_cb[UI_VIEW_EVENT_DESTROY]) { - if (!this->lifecycle_cb.destroy(this, this->lifecycle_data)) return; + if (!this->event_cb[UI_VIEW_EVENT_DESTROY](this, this->event_data[UI_VIEW_EVENT_DESTROY])) return; } + ui_view::onDestroy(); + + if (this->event_cb[UI_VIEW_EVENT_DESTROY_POST]) + { + if (!this->event_cb[UI_VIEW_EVENT_DESTROY_POST](this, this->event_data[UI_VIEW_EVENT_DESTROY_POST])) return; + } } void onPortrait() @@ -76,7 +118,13 @@ public: { if (!(*this->event_cb[UI_VIEW_EVENT_PORTRAIT])(this, this->event_data[UI_VIEW_EVENT_PORTRAIT])) return; } + ui_view::onPortrait(); + + if (this->event_cb[UI_VIEW_EVENT_PORTRAIT_POST]) + { + if (!(*this->event_cb[UI_VIEW_EVENT_PORTRAIT_POST])(this, this->event_data[UI_VIEW_EVENT_PORTRAIT_POST])) return; + } } void onLandscape() @@ -85,7 +133,13 @@ public: { if (!(*this->event_cb[UI_VIEW_EVENT_LANDSCAPE])(this, this->event_data[UI_VIEW_EVENT_LANDSCAPE])) return; } + ui_view::onLandscape(); + + if (this->event_cb[UI_VIEW_EVENT_LANDSCAPE_POST]) + { + if (!(*this->event_cb[UI_VIEW_EVENT_LANDSCAPE_POST])(this, this->event_data[UI_VIEW_EVENT_LANDSCAPE_POST])) return; + } } void onRotate(int degree) @@ -94,7 +148,13 @@ public: { if (!(*this->event_cb[UI_VIEW_EVENT_ROTATE])(this, this->event_data[UI_VIEW_EVENT_ROTATE])) return; } + ui_view::onRotate(degree); + + if (this->event_cb[UI_VIEW_EVENT_ROTATE_POST]) + { + if (!(*this->event_cb[UI_VIEW_EVENT_ROTATE_POST])(this, this->event_data[UI_VIEW_EVENT_ROTATE_POST])) return; + } } void onBack() @@ -103,7 +163,13 @@ public: { if (!(*this->event_cb[UI_VIEW_EVENT_BACK])(this, this->event_data[UI_VIEW_EVENT_BACK])) return; } + ui_view::onBack(); + + if (this->event_cb[UI_VIEW_EVENT_BACK_POST]) + { + if (!(*this->event_cb[UI_VIEW_EVENT_BACK_POST])(this, this->event_data[UI_VIEW_EVENT_BACK_POST])) return; + } } void onMenu(ui_menu *menu) @@ -112,7 +178,13 @@ public: { if (!(*this->event_cb[UI_VIEW_EVENT_MENU])(this, this->event_data[UI_VIEW_EVENT_MENU])) return; } + ui_view::onMenu(menu); + + if (this->event_cb[UI_VIEW_EVENT_MENU_POST]) + { + if (!(*this->event_cb[UI_VIEW_EVENT_MENU_POST])(this, this->event_data[UI_VIEW_EVENT_MENU_POST])) return; + } } ui_view_capi(const char *name) @@ -145,30 +217,11 @@ EAPI ui_view* ui_view_create(const char *name) return new ui_view_capi(name); } -EAPI bool ui_view_set_lifecycle_cb(ui_view *view, ui_view_lifecycle_cb_s *lifecycle_cb, void *user_data) -{ - if (!validate_view(view)) return false; - - auto event_attr = dynamic_cast(view); - if (!event_attr) - { - LOGE("This view(%p) doesn't allow lifecycle callback?!"); - return false; - } - - if (lifecycle_cb) - { - event_attr->lifecycle_cb = *lifecycle_cb; - } - event_attr->lifecycle_data = user_data; - - return true; -} - EAPI bool ui_view_set_event_cb(ui_view *view, ui_view_event_type_e event_type, ui_view_event_cb event_cb, void *user_data) { if (!validate_view(view)) return false; - if (event_type < UI_VIEW_EVENT_ROTATE || event_type >= UI_VIEW_EVENT_LAST) + + if (event_type < UI_VIEW_EVENT_LOAD || event_type >= UI_VIEW_EVENT_LAST) { LOGE("This view(%p) event_type is invalid(%d)", view, event_type); return false;