c: integerate lifecycle interfaces with events. 58/90158/1
authorHermet Park <hermet@hermet.pe.kr>
Wed, 28 Sep 2016 14:06:31 +0000 (23:06 +0900)
committerHermet Park <hermet@hermet.pe.kr>
Wed, 28 Sep 2016 15:14:56 +0000 (00:14 +0900)
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

22 files changed:
src/examples/efl/c/main.cpp
src/examples/efl/c/page1.cpp
src/examples/efl/c/page10.cpp
src/examples/efl/c/page11.cpp
src/examples/efl/c/page12.cpp
src/examples/efl/c/page13.cpp
src/examples/efl/c/page14.cpp
src/examples/efl/c/page15.cpp
src/examples/efl/c/page16.cpp
src/examples/efl/c/page2.cpp
src/examples/efl/c/page3.cpp
src/examples/efl/c/page4.cpp
src/examples/efl/c/page5.cpp
src/examples/efl/c/page6.cpp
src/examples/efl/c/page7.cpp
src/examples/efl/c/page9.cpp
src/include/efl/mobile/c/_ui_common_view_capi.h
src/include/efl/mobile/c/ui_application.h
src/include/efl/mobile/c/ui_view.h
src/lib/efl/mobile/c/ui_application.cpp
src/lib/efl/mobile/c/ui_standard_view.cpp
src/lib/efl/mobile/c/ui_view.cpp

index 203674f2769804bd36130a128eb2bb3f27da66f1..e4765f68090b18161cfc9b5118f51645bd210629 100644 (file)
@@ -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;
index 7ac56d53c6ba2728d9020a8198141570b324893f..52ab799d35014337aef4dfb7b0748da1e231c9b5 100644 (file)
@@ -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;
        }
index c1ab302d6c382243d7f846ae4681530ff7249c46..c6559f542b9136508d888d0da8213ada7275c0ad 100644 (file)
@@ -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);
index 56f685f27554f7574dcdbc179b0fc2902408cb36..d3e46e12e240bb9414d56031a99e009c99cc3de7 100644 (file)
@@ -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);
index 8ca7a98efd63a2f67b5c241e4442357c9d468b49..514a44e52a50ef296bba73a53d4e3cf579485329 100644 (file)
@@ -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;
        }
index a2f5321013314b872012bcc78b75fa346b069b8e..bb8992433b4a58110597cb2f353140de1e8d1d15 100644 (file)
@@ -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;
        }
index ee6cc41ef7c61a86265d735ee242ccb8a0d8cb66..b790450a26b08a2f1a7fce7ee7c7c7c9d58d43d8 100644 (file)
@@ -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;
        }
index 495acf9abeb5c2f828eb78ddccdb338d83fc5717..11b4e063683d623d2f57af2bdaabb538c2e3da30 100644 (file)
@@ -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;
        }
index d472bd1ce7bdbf2a71f6f8511c20c7cc2042b46f..4427a9e7a65b0444a84279b0874baf28d926b729 100644 (file)
@@ -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;
        }
index 76d6b3351c485ff3b681c5f93e9265f67201872c..ba66fd8ed6193ce10caa8a5c529669518ba3ee1c 100644 (file)
@@ -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;
        }
index a85581acac5de75d7eaf9f6378105c6c0e21510e..fd1c464880b6c9732ae813b9cd61ade45420bdff 100644 (file)
@@ -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;
        }
index 01c64492fbb47c69f67c9e8bfe16482a99515942..1c2ddf78f1691ec5d6c4bea7f02b04c8526f7af7 100644 (file)
@@ -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;
        }
index 8a5095f0ecbbe0490e51eeb8f3b3427a3dbf4449..17b03fdad18f74bc4890acbd680882323b904414 100644 (file)
@@ -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;
        }
index bdaa662e869e2aaf57ebb886e8d1804945f0b05f..5e4db642dcf5afedea047909eb73a07d8724f13c 100644 (file)
@@ -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;
        }
index 702618611996556543c9a58355b7fc3a8ff1f05a..d17ee6432edf3039c8e878074a65d59a762cce24 100644 (file)
@@ -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;
        }
index e77c42ffdf81e58decadf2eb83d5159e71d642e5..479c14574b03147ff5934070bd3c69d3473691e8 100644 (file)
@@ -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);
index 231bb015264051e41ee67d131dfffc7d8046bb72..bc5c5650a4c6bc3f7b80819c1bb6e37b3d83578d 100644 (file)
@@ -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)
        {
        }
 
index 2de61ffe1515072d15de3e05fc6af9cef50055a8..dd77ff29954a36f41c261fe2497c4ba286cab214 100644 (file)
@@ -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.
index 935ff42a4914a9ae6ca967ffbff3989366718774..50aa348afbd82085a7568363069ac9f710e8109b 100644 (file)
@@ -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.
  *
index c3c2995cbfb79a456e9d247644dd8f14a3530011..412fcd3fe85540610dfa0249470d655a90b60096 100644 (file)
@@ -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<void*>(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<void*>(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)
index a87fccfd79e68c55805d6ef241ab1e76a74719f8..c63d94b566f6bfa1ecb0c4b0fc42cdc623b86926 100644 (file)
@@ -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)
index 66bc07bd7f90a479cf704b34382898ea6f70319b..1315e5a529e98db4dc92bd8d8ce94c8a794502d4 100644 (file)
@@ -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<ui_common_view_capi *>(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;