CAPI implement. 09/71809/9
authorWoochan Lee <wc0917.lee@samsung.com>
Fri, 27 May 2016 07:13:06 +0000 (16:13 +0900)
committerWoochan Lee <wc0917.lee@samsung.com>
Tue, 31 May 2016 04:36:56 +0000 (13:36 +0900)
Change-Id: Iffe12c90e2a92f44120ef3bf03660ed959145ab5

14 files changed:
src/CMakeLists.txt
src/examples/efl/c/main.cpp
src/include/efl/mobile/c/ui_app.h
src/include/efl/mobile/c/ui_mobile_viewmanager.h [new file with mode: 0644]
src/include/efl/mobile/c/ui_view.h
src/include/efl/mobile/c/ui_viewmgr.h
src/include/efl/mobile/ui_mobile_viewmanager.h
src/include/ui_viewmanager.h
src/lib/CMakeLists.txt
src/lib/efl/mobile/c/ui_app.cpp
src/lib/efl/mobile/c/ui_menu.cpp
src/lib/efl/mobile/c/ui_popup.cpp
src/lib/efl/mobile/c/ui_view.cpp
src/lib/efl/mobile/c/ui_viewmgr.cpp [new file with mode: 0644]

index ef2796c..52a2bb9 100644 (file)
@@ -3,4 +3,4 @@ LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/lib)
 
 ADD_SUBDIRECTORY(include)
 ADD_SUBDIRECTORY(lib)
-ADD_SUBDIRECTORY(examples/efl/cpp)
+ADD_SUBDIRECTORY(examples/efl/c)
index 9146310..ac1882f 100644 (file)
 //This is to check CAPIs.
 #include "main.h"
 
+Evas_Object*
+create_content(Evas_Object *parent, const char *text, Evas_Smart_Cb prev_btn_clicked_cb, Evas_Smart_Cb next_btn_clicked_cb)
+{
+       Elm_Grid *grid;
+       Elm_Box *box;
+       Elm_Layout *layout;
+       Elm_Scroller *scroller;
+       Elm_Button *btn;
+
+       /* Scroller */
+       scroller = elm_scroller_add(parent);
+       elm_scroller_bounce_set(scroller, EINA_FALSE, EINA_TRUE);
+       elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
+
+       /* Grid */
+       grid = elm_grid_add(scroller);
+       evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL);
+       evas_object_show(grid);
+
+       /* NoContent Layout */
+       layout = elm_layout_add(grid);
+       elm_layout_theme_set(layout, "layout", "nocontents", "default");
+       elm_object_part_text_set(layout, "elm.text", text);
+       evas_object_show(layout);
+       elm_grid_pack(grid, layout, 0, 0, 100, 100);
+
+       /* Box */
+       box = elm_box_add(grid);
+       elm_box_horizontal_set(box, EINA_TRUE);
+       evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
+       elm_box_padding_set(box, ELM_SCALE_SIZE(50), 0);
+       evas_object_show(box);
+       elm_grid_pack(grid, box, 0, 0, 100, 100);
+
+       /* Previous Page Button */
+       btn = elm_button_add(grid);
+       evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 1.0);
+       elm_object_text_set(btn, "Prev");
+       evas_object_smart_callback_add(btn, "clicked", prev_btn_clicked_cb, NULL);
+       evas_object_show(btn);
+       elm_box_pack_end(box, btn);
+
+       /* Next Page Button */
+       btn = elm_button_add(grid);
+       evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 1.0);
+       elm_object_text_set(btn, "Next");
+       evas_object_smart_callback_add(btn, "clicked", next_btn_clicked_cb, NULL);
+       evas_object_show(btn);
+       elm_box_pack_end(box, btn);
+
+       elm_object_content_set(scroller, grid);
+
+       return scroller;
+}
+
+//================================================================================
+//================================== View 4 ======================================
+//================================================================================
+
+static void
+view4_prev_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       UI_VIEWMGR_VIEW_POP();
+}
+
+static void
+view4_next_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       //create_page5();
+}
+
+static void
+view4_load_cb(ui_view *view, void *data)
+{
+       Evas_Object *base_layout = ui_view_base_get(view);
+
+       Evas_Object *content = create_content(base_layout, "ViewMgr Demo<br>Title Badge",
+                       view4_prev_btn_clicked_cb, view4_next_btn_clicked_cb);
+
+       ui_standard_view_content_set(view, content, "Page4 We put a long title here intentionally", NULL, NULL, NULL);
+       ui_standard_view_title_badge_set(view, "999+");
+}
+
+static void
+create_page4()
+{
+       ui_view_lifecycle_callback_s lifecycle_callback = {0, };
+       lifecycle_callback.load = view4_load_cb;
+
+       ui_view *view = ui_standard_view_create("page4");
+
+       int ret = ui_view_lifecycle_callbacks_set(view, &lifecycle_callback, NULL);
+       if (!ret)
+       {
+               dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_lifecycle_callback_set is failed. err = %d", ret);
+       }
+
+       UI_VIEWMGR_VIEW_PUSH(view);
+}
+
+//================================================================================
+//================================== View 3 ======================================
+//================================================================================
+
+static void
+view3_prev_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       UI_VIEWMGR_VIEW_POP();
+}
+
+static void
+view3_next_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       create_page4();
+}
+
+static void
+view3_load_cb(ui_view *view, void *data)
+{
+       Evas_Object *base_layout = ui_view_base_get(view);
+
+       Evas_Object *content = create_content(base_layout, "ViewMgr Demo<br>Subtitle",
+                       view3_prev_btn_clicked_cb, view3_next_btn_clicked_cb);
+
+       ui_standard_view_content_set(view, content, "Page3", "Subtitle", NULL, NULL);
+}
+
+static void
+create_page3()
+{
+       ui_view_lifecycle_callback_s lifecycle_callback = {0, };
+
+       lifecycle_callback.load = view3_load_cb;
+
+       ui_view *view = ui_standard_view_create("page3");
+
+       int ret = ui_view_lifecycle_callbacks_set(view, &lifecycle_callback, NULL);
+       if (!ret)
+       {
+               dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_lifecycle_callback_set is failed. err = %d", ret);
+       }
+
+
+       UI_VIEWMGR_VIEW_PUSH(view);
+}
+
+//================================================================================
+//================================== View 2 ======================================
+//================================================================================
+
+static void
+view2_prev_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       UI_VIEWMGR_VIEW_POP();
+}
+
+static void
+view2_next_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       create_page3();
+}
+
+static void
+view2_load_cb(ui_view *view, void *data)
+{
+       Evas_Object *base_layout = ui_view_base_get(view);
+
+       Evas_Object *content = create_content(base_layout, "ViewMgr Demo<br>Title Buttons",
+                       view2_prev_btn_clicked_cb, view2_next_btn_clicked_cb);
+
+       //Title left button
+       Elm_Button *left_title_btn = elm_button_add(base_layout);
+       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");
+
+       ui_standard_view_content_set(view, content, "Page2", NULL, left_title_btn, right_title_btn);
+}
+
+static void
+create_page2()
+{
+       ui_view_lifecycle_callback_s lifecycle_callback = {0, };
+
+       lifecycle_callback.load = view2_load_cb;
+
+       ui_view *view = ui_standard_view_create("page2");
+
+       int ret = ui_view_lifecycle_callbacks_set(view, &lifecycle_callback, NULL);
+       if (!ret)
+       {
+               dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_lifecycle_callback_set is failed. err = %d", ret);
+       }
+
+       UI_VIEWMGR_VIEW_PUSH(view);
+}
+
+//================================================================================
+//================================== View 1 ======================================
+//================================================================================
+
+static void
+view1_prev_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       UI_VIEWMGR_DEACTIVATE();
+}
+
+static void
+view1_next_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       create_page2();
+}
+
+static void
+view1_load_cb(ui_view *view, void *data)
+{
+       Evas_Object *base_layout = ui_view_base_get(view);
+
+       Evas_Object *content = create_content(base_layout, "ViewMgr Demo<br>Basic View",
+                       view1_prev_btn_clicked_cb, view1_next_btn_clicked_cb);
+
+       ui_standard_view_content_set(view, content, "Page1", NULL, NULL, NULL);
+}
+
+static void
+create_page1()
+{
+       ui_view_lifecycle_callback_s lifecycle_callback = {0, };
+
+       lifecycle_callback.load = view1_load_cb;
+
+       ui_view *view = ui_standard_view_create("page1");
+
+       int ret = ui_view_lifecycle_callbacks_set(view, &lifecycle_callback, NULL);
+       if (!ret)
+       {
+               dlog_print(DLOG_ERROR, LOG_TAG, "ui_view_lifecycle_callback_set is failed. err = %d", ret);
+       }
+
+       UI_VIEWMGR_VIEW_PUSH(view);
+
+}
+
 static bool
 app_create(void *data)
 {
-       ui_app_init(NULL, NULL);
-       ui_app_run(0, NULL, NULL, NULL);
-       ui_menu_content_set(NULL, NULL);
-       ui_popup_content_set(NULL, NULL);
-       ui_popup_activate(NULL);
-       ui_popup_del(NULL);
-       ui_standard_view_create(NULL);
-       ui_view_lifecycle_callbacks_set(NULL, NULL, NULL);
-       ui_view_base_get(NULL);
-       ui_view_content_set(NULL, NULL);
-       ui_standard_view_content_set(NULL, NULL, NULL, NULL, NULL, NULL);
-       ui_standard_view_title_badge_set(NULL, NULL);
-       ui_view_indicator_set(NULL, UI_VIEW_INDICATOR_DEFAULT);
-       ui_standard_view_toolbar_set(NULL, NULL);
-       ui_view_removable_content(NULL, false);
-       ui_view_event_callbacks_set(NULL, NULL, NULL);
-       ui_standard_view_title_right_btn_set(NULL, NULL);
-       ui_standard_view_title_visible_set(NULL, false, false);
-       UI_VIEWMGR_VIEW_DEACTIVATE();
-       UI_VIEWMGR_VIEW_PUSH(NULL);
-       UI_VIEWMGR_VIEW_POP();
+       create_page1();
 
-    return true;
+       return true;
 }
 
 int
@@ -38,12 +267,15 @@ main(int argc, char *argv[])
        ui_app_lifecycle_callback_s event_callback = {0,};
 
        ret = ui_app_init(PACKAGE, LOCALE_DIR);
+       if (!ret) {
+               dlog_print(DLOG_ERROR, LOG_TAG, "ui_app_init() is failed. err = %d", ret);
+       }
 
        event_callback.create = app_create;
 
-       ret = ui_app_main(argc, argv, &event_callback, &ad);
+       ret = ui_app_run(argc, argv, &event_callback, &ad);
        if (ret != APP_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "ui_app_main() is failed. err = %d", ret);
+               dlog_print(DLOG_ERROR, LOG_TAG, "ui_app_run() is failed. err = %d", ret);
        }
 
        return ret;
index 12f0eb9..8083f64 100644 (file)
@@ -7,8 +7,9 @@ namespace efl_viewmanager
 #ifdef __cplusplus
 extern "C" {
 #endif
-       int ui_app_init(const char *pkg, const char *locale_dir);
+       bool ui_app_init(const char *pkg, const char *locale_dir);
        int ui_app_run(int argc, char **argv, ui_app_lifecycle_callback_s *event_callback, void *data);
+       ui_viewmgr *ui_app_viewmgr_get();
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/include/efl/mobile/c/ui_mobile_viewmanager.h b/src/include/efl/mobile/c/ui_mobile_viewmanager.h
new file mode 100644 (file)
index 0000000..230e1f8
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *               http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+#ifndef _UI_MOBILE_VIEWMANAGER_CAPI_H_
+#define _UI_MOBILE_VIEWMANAGER_CAPI_H_
+
+#include "../ui_mobile_viewmanager.h"
+#include "ui_app.h"
+#include "ui_menu.h"
+#include "ui_popup.h"
+#include "ui_viewmgr.h"
+#include "ui_view.h"
+
+
+#endif /* UI_MOBILE_VIEWMANAGER_CAPI_H */
index 1441edb..9ccee87 100644 (file)
@@ -7,19 +7,19 @@ namespace efl_viewmananger
 #ifdef __cplusplus
 extern "C" {
 #endif
-       typedef bool (*ui_view_lifecycle_load_cb) (ui_view *view, void *data);
-       typedef bool (*ui_view_lifecycle_unload_cb) (ui_view *view, void *data);
-       typedef bool (*ui_view_lifecycle_pause_cb) (ui_view *view, void *data);
-       typedef bool (*ui_view_lifecycle_resume_cb) (ui_view *view, void *data);
-       typedef bool (*ui_view_lifecycle_activate_cb) (ui_view *view, void *data);
-       typedef bool (*ui_view_lifecycle_deactivate_cb) (ui_view *view, void *data);
-       typedef bool (*ui_view_lifecycle_destroy_cb) (ui_view *view, void *data);
+       typedef void (*ui_view_lifecycle_load_cb) (ui_view *view, void *data);
+       typedef void (*ui_view_lifecycle_unload_cb) (ui_view *view, void *data);
+       typedef void (*ui_view_lifecycle_pause_cb) (ui_view *view, void *data);
+       typedef void (*ui_view_lifecycle_resume_cb) (ui_view *view, void *data);
+       typedef void (*ui_view_lifecycle_activate_cb) (ui_view *view, void *data);
+       typedef void (*ui_view_lifecycle_deactivate_cb) (ui_view *view, void *data);
+       typedef void (*ui_view_lifecycle_destroy_cb) (ui_view *view, void *data);
 
-       typedef bool (*ui_view_event_rotate_cb) (ui_view *view, int degree, void *data);
-       typedef bool (*ui_view_event_portrait_cb) (ui_view *view, void *data);
-       typedef bool (*ui_view_event_landscape_cb) (ui_view *view, void *data);
-       typedef bool (*ui_view_event_back_cb) (ui_view *view, void *data);
-       typedef bool (*ui_view_event_menu_cb) (ui_menu *menu, void *data);
+       typedef void (*ui_view_event_rotate_cb) (ui_view *view, int degree, void *data);
+       typedef void (*ui_view_event_portrait_cb) (ui_view *view, void *data);
+       typedef void (*ui_view_event_landscape_cb) (ui_view *view, void *data);
+       typedef void (*ui_view_event_back_cb) (ui_view *view, void *data);
+       typedef void (*ui_view_event_menu_cb) (ui_menu *menu, void *data);
 
        typedef struct
        {
@@ -42,6 +42,7 @@ extern "C" {
        } ui_view_event_callback_s;
 
        ui_view* ui_standard_view_create(const char *name);
+       ui_view* ui_view_create(const char *name);
        bool ui_view_lifecycle_callbacks_set(ui_view *view,
                                                                        ui_view_lifecycle_callback_s *lifecycle_callback, void *data);
        Evas_Object* ui_view_base_get(ui_view *view);
index e25dca1..610ff8c 100644 (file)
@@ -6,10 +6,14 @@ using namespace efl_viewmananger;
 #ifdef __cplusplus
 extern "C" {
 #endif
+       ui_view *ui_viewmgr_view_push(ui_viewmgr *viewmgr, ui_view *view);
+       bool ui_viewmgr_view_pop(ui_viewmgr *viewmgr);
+       bool ui_viewmgr_deactivate(ui_viewmgr *viewmgr);
+
        //TODO
-       #define UI_VIEWMGR_VIEW_DEACTIVATE() (ui_app::get_instance()->get_viewmgr())->deactivate()
-       #define UI_VIEWMGR_VIEW_PUSH(x) (ui_app::get_instance()->get_viewmgr())->push_view(x)
-       #define UI_VIEWMGR_VIEW_POP() (ui_app::get_instance()->get_viewmgr())->pop_view()
+       #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()))
 #ifdef __cplusplus
 }
 #endif
index 4680cb3..62841ea 100644 (file)
@@ -17,7 +17,6 @@
 #ifndef _UI_MOBILE_VIEWMANAGER_H_
 #define _UI_MOBILE_VIEWMANAGER_H_
 
-#include <app.h>
 #include "../ui_base_viewmanager.h"
 #include "ui_view.h"
 #include "ui_standard_view.h"
 #include "ui_menu.h"
 #include "ui_popup.h"
 #include "ui_app.h"
-#include "c/ui_app.h"
-#include "c/ui_menu.h"
-#include "c/ui_popup.h"
-#include "c/ui_viewmgr.h"
-#include "c/ui_view.h"
 
 #define UI_VIEWMGR (ui_app::get_instance()->get_viewmgr())
 
index 92a7067..be890fa 100644 (file)
@@ -14,4 +14,6 @@
  *  limitations under the License.
  *
  */
-#include "efl/mobile/ui_mobile_viewmanager.h"
+//FIXME: C++ app include below.
+//#include "efl/mobile/ui_mobile_viewmanager.h"
+#include "efl/mobile/c/ui_mobile_viewmanager.h"
index b4878e1..0edf575 100644 (file)
@@ -17,6 +17,7 @@ SET(SRCS
      efl/mobile/c/ui_menu.cpp
      efl/mobile/c/ui_popup.cpp
      efl/mobile/c/ui_view.cpp
+     efl/mobile/c/ui_viewmgr.cpp
     )
 
 ADD_LIBRARY(${LIBNAME} SHARED ${SRCS})
index f3b0cf1..7020224 100644 (file)
-#include "../../../../include/efl/mobile/ui_mobile_viewmanager.h"
+#include "../../../../include/efl/mobile/c/ui_mobile_viewmanager.h"
 #include "../../../../include/efl/mobile/c/ui_app.h"
 
 using namespace efl_viewmanager;
 
+class ui_app_capi : public ui_app
+{
+private:
+       ui_app_lifecycle_callback_s capi_event_callback;
+       void *data;
+
+protected:
+       bool on_create()
+       {
+               if (!ui_app::on_create())
+               {
+                       return false;
+               }
+
+               if (this->capi_event_callback.create)
+                       this->capi_event_callback.create(this->data);
+
+               return true;
+       }
+
+       void on_terminate()
+       {
+               if (this->capi_event_callback.terminate)
+                       this->capi_event_callback.terminate(this->data);
+       }
+
+       void on_pause()
+       {
+               if (this->capi_event_callback.pause)
+                       this->capi_event_callback.pause(this->data);
+       }
+
+       void on_resume()
+       {
+               if (this->capi_event_callback.resume)
+                       this->capi_event_callback.resume(this->data);
+       }
+
+       void on_control(app_control_h app_control)
+       {
+               ui_app::on_control(app_control);
+
+               if (this->capi_event_callback.app_control)
+                       this->capi_event_callback.app_control(app_control, this->data);
+       }
+
+public:
+       ui_app_capi(const char *pkg, const char *locale_dir)
+               : ui_app(pkg, locale_dir)
+       {
+       }
+
+       ~ui_app_capi()
+       {
+       }
+
+       int run(int argc, char **argv, ui_app_lifecycle_callback_s *event_callback, void *data)
+       {
+               this->capi_event_callback = *event_callback;
+               this->data = data;
+
+               return ui_app::run(argc, argv);
+       }
+
+       ui_app_lifecycle_callback_s get_app_lifecycle_callback()
+       {
+               return this->capi_event_callback;
+       }
+
+       void* get_data()
+       {
+               return this->data;
+       }
+};
+
 extern "C" {
-       int ui_app_init(const char *pkg, const char *locale_dir)
+       static ui_app_capi *app = NULL;
+
+       bool ui_app_init(const char *pkg, const char *locale_dir)
        {
-               //TODO
-               return 1;
+               app = new ui_app_capi(pkg, locale_dir);
+
+               if (app) return true;
+               else return false;
        }
 
        int ui_app_run(int argc, char **argv, ui_app_lifecycle_callback_s *event_callback, void *data)
        {
-               //TODO
-               return 1;
+               return app->run(argc, argv, event_callback, data);
+       }
+
+       ui_viewmgr *ui_app_viewmgr_get()
+       {
+               return app->get_viewmgr();
        }
 }
index 68e353f..cde727f 100644 (file)
@@ -1,4 +1,4 @@
-#include "../../../../include/efl/mobile/ui_mobile_viewmanager.h"
+#include "../../../../include/efl/mobile/c/ui_mobile_viewmanager.h"
 #include "../../../../include/efl/mobile/c/ui_menu.h"
 
 using namespace efl_viewmanager;
index 0bc829f..14ec71d 100644 (file)
@@ -1,4 +1,4 @@
-#include "../../../../include/efl/mobile/ui_mobile_viewmanager.h"
+#include "../../../../include/efl/mobile/c/ui_mobile_viewmanager.h"
 #include "../../../../include/efl/mobile/c/ui_popup.h"
 
 using namespace efl_viewmanager;
index 491086e..3f0d457 100644 (file)
-#include "../../../../include/efl/mobile/ui_mobile_viewmanager.h"
+#include "../../../../include/efl/mobile/c/ui_mobile_viewmanager.h"
 #include "../../../../include/efl/mobile/c/ui_view.h"
 
 using namespace efl_viewmanager;
 
+class ui_standard_view_capi : public ui_standard_view
+{
+private:
+       ui_view_lifecycle_callback_s lifecycle_callback;
+       void *data;
+
+protected:
+       void on_load()
+       {
+               ui_standard_view::on_load();
+
+               if (this->lifecycle_callback.load) {
+                       this->lifecycle_callback.load(this, this->data);
+               }
+       }
+
+public:
+       ui_standard_view_capi(const char *name)
+               : ui_standard_view(name)
+       {
+               this->lifecycle_callback = {0,};
+               this->data = NULL;
+       }
+
+       ~ui_standard_view_capi()
+       {
+       }
+
+       void set_lifecycle_callback(ui_view_lifecycle_callback_s *callback)
+       {
+               this->lifecycle_callback = *callback;
+       }
+
+       void set_data(void *data)
+       {
+               this->data = data;
+       }
+};
+
+class ui_view_capi : public ui_view
+{
+private:
+       ui_view_lifecycle_callback_s lifecycle_callback;
+       void *data;
+
+protected:
+       void on_load()
+       {
+               ui_view::on_load();
+
+               if (this->lifecycle_callback.load) {
+                       this->lifecycle_callback.load(this, this->data);
+               }
+       }
+
+public:
+       ui_view_capi(const char *name)
+               : ui_view(name)
+       {
+               this->lifecycle_callback = {0,};
+               this->data = NULL;
+       }
+
+       ~ui_view_capi()
+       {
+       }
+
+       void set_lifecycle_callback(ui_view_lifecycle_callback_s *callback)
+       {
+               this->lifecycle_callback = *callback;
+       }
+
+       void set_data(void *data)
+       {
+               this->data = data;
+       }
+};
+
 extern "C" {
        ui_view* ui_standard_view_create(const char *name)
        {
-               //TODO
-               return NULL;
+               return new ui_standard_view_capi(name);
+       }
+
+       ui_view* ui_view_create(const char *name)
+       {
+               return new ui_view_capi(name);
        }
 
        bool ui_view_lifecycle_callbacks_set(ui_view *view,
                                                                                 ui_view_lifecycle_callback_s *lifecycle_callback, void *data)
        {
-               //TODO
-               return 1;
+               if (!view)
+               {
+                       LOGE("Invalid View");
+                       return false;
+               }
+
+               ui_standard_view_capi *capi_view = static_cast<ui_standard_view_capi *>(view);
+
+               if (lifecycle_callback) capi_view->set_lifecycle_callback(lifecycle_callback);
+               if (data) capi_view->set_data(data);
+
+               return true;
        }
        Evas_Object* ui_view_base_get(ui_view *view)
        {
-               //TODO
-               return NULL;
+               if (!view)
+               {
+                       LOGE("Invalid View");
+                       return false;
+               }
+
+               ui_standard_view_capi *capi_view = static_cast<ui_standard_view_capi *>(view);
+
+               return capi_view->get_base();
        }
 
        bool ui_view_content_set(ui_view *view, Evas_Object *content)
        {
-               //TODO
-               return 1;
+               if (!view)
+               {
+                       LOGE("Invalid View");
+                       return false;
+               }
+
+               ui_view_capi *capi_view = static_cast<ui_view_capi *>(view);
+
+               return capi_view->set_content(content);
        }
 
        bool ui_standard_view_content_set(ui_view *view, Evas_Object *content,
                                                                          const char *title, const char *subtitle,
                                                                          Evas_Object *title_left_btn, Evas_Object *title_right_btn)
        {
-               //TODO
-               return 1;
+               if (!view)
+               {
+                       LOGE("Invalid View");
+                       return false;
+               }
+
+               ui_standard_view_capi *capi_view = static_cast<ui_standard_view_capi *>(view);
+
+               return capi_view->set_content(content, title, subtitle, title_left_btn, title_right_btn);
        }
 
        bool ui_standard_view_title_badge_set(ui_view *view, const char *badge_text)
        {
-               //TODO
-               return 1;
+               if (!view)
+               {
+                       LOGE("Invalid View");
+                       return false;
+               }
+
+               ui_standard_view_capi *capi_view = static_cast<ui_standard_view_capi *>(view);
+
+               return capi_view->set_title_badge(badge_text);
        }
 
        bool ui_view_indicator_set(ui_view *view, ui_view_indicator indicator)
diff --git a/src/lib/efl/mobile/c/ui_viewmgr.cpp b/src/lib/efl/mobile/c/ui_viewmgr.cpp
new file mode 100644 (file)
index 0000000..56b994c
--- /dev/null
@@ -0,0 +1,21 @@
+#include "../../../../include/efl/mobile/c/ui_mobile_viewmanager.h"
+#include "../../../../include/efl/mobile/c/ui_viewmgr.h"
+
+using namespace efl_viewmanager;
+
+extern "C" {
+       ui_view *ui_viewmgr_view_push(ui_viewmgr *viewmgr, ui_view *view)
+       {
+               return static_cast<ui_view *>(viewmgr->push_view(view));
+       }
+
+       bool ui_viewmgr_view_pop(ui_viewmgr *viewmgr)
+       {
+               return viewmgr->pop_view();
+       }
+
+       bool ui_viewmgr_deactivate(ui_viewmgr *viewmgr)
+       {
+               return viewmgr->deactivate();
+       }
+}