Add capi for C# binding 02/262102/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Fri, 7 May 2021 07:13:00 +0000 (16:13 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 3 Aug 2021 02:16:35 +0000 (11:16 +0900)
Change-Id: I60606a84623da9c9f62cb91981a563c596bf5547
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
12 files changed:
CMakeLists.txt
capi/CMakeLists.txt [new file with mode: 0644]
capi/include/cscl-ui-controller.h [new file with mode: 0644]
capi/include/cscl-ui-event-callback.h [new file with mode: 0644]
capi/include/cscl-ui-graphics-backend.h [new file with mode: 0644]
capi/include/cscl-ui-nui.h [new file with mode: 0644]
capi/include/cscl-ui-win.h [new file with mode: 0644]
capi/include/cscl-ui-window-backend.h [new file with mode: 0644]
capi/scl-ui-nui-capi.pc.in [new file with mode: 0644]
capi/src/cscl-ui-controller.cpp [new file with mode: 0644]
capi/src/cscl-ui-nui.cpp [new file with mode: 0644]
packaging/libscl-ui-nui.spec

index 295f780..897ccab 100644 (file)
@@ -145,3 +145,5 @@ INSTALL(FILES "${CMAKE_SOURCE_DIR}/scl/sclcontext.h" DESTINATION include/${name}
 
 CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
 INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIBDIR}/pkgconfig)
+
+ADD_SUBDIRECTORY(capi)
diff --git a/capi/CMakeLists.txt b/capi/CMakeLists.txt
new file mode 100644 (file)
index 0000000..f7beb66
--- /dev/null
@@ -0,0 +1,76 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(scl-ui-nui-capi CXX)
+
+# Find Packages
+INCLUDE(FindPkgConfig)
+pkg_check_modules(pkgs REQUIRED
+    elementary
+    glib-2.0
+    feedback
+    dlog
+    libxml-2.0
+    tts
+    vconf
+    eldbus
+    libscl-common
+    ecore-wl2
+)
+
+FOREACH(flag ${pkgs_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall -Werror")
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fPIE")
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Werror")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -std=c++11")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}")
+
+#SET(CAPI_LIBSCL_UI_NUI inputmethod_unittests)
+
+SET(fw_name "scl-ui-nui-capi")
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-DTIZEN_DEBUG")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib")
+
+AUX_SOURCE_DIRECTORY(src SOURCES)
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../scl LIBSCL_SOURCES)
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../res LIBSCL_RES_SOURCES)
+ADD_LIBRARY(${fw_name} SHARED 
+        ${SOURCES}
+        ${LIBSCL_SOURCES}
+        ${LIBSCL_RES_SOURCES}
+        )
+TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS} ${pkgs_LDFLAGS})
+
+SET_TARGET_PROPERTIES(${fw_name}
+     PROPERTIES
+     VERSION ${FULLVER}
+     SOVERSION ${MAJORVER}
+     CLEAN_DIRECT_OUTPUT 1
+)
+
+INSTALL(TARGETS ${fw_name} DESTINATION ${LIBDIR})
+
+INSTALL(FILES "${CMAKE_SOURCE_DIR}/capi/include/cscl-ui-nui.h" DESTINATION include)
+INSTALL(FILES "${CMAKE_SOURCE_DIR}/capi/include/cscl-ui-controller.h" DESTINATION include)
+
+SET(PC_NAME ${fw_name})
+SET(PC_REQUIRED ${dependents})
+SET(PC_LDFLAGS -l${fw_name})
+
+CONFIGURE_FILE(
+    scl-ui-nui-capi.pc.in
+    ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
+    @ONLY
+)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIBDIR}/pkgconfig)
+
+SET(INC_DIR include)
+INCLUDE_DIRECTORIES(${INC_DIR})
+
+ADD_DEFINITIONS("-DFULLVER=\"${FULLVER}\"")
diff --git a/capi/include/cscl-ui-controller.h b/capi/include/cscl-ui-controller.h
new file mode 100644 (file)
index 0000000..94d2103
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2021 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 __SCL_CAPI_CONTROLLER_H__
+#define __SCL_CAPI_CONTROLLER_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int scl_controller_mouse_press(int x, int y);
+int scl_controller_mouse_release(int x, int y);
+int scl_controller_mouse_move(int x, int y, int touch_id);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __SCL_CAPI_CONTROLLER_H__ */
diff --git a/capi/include/cscl-ui-event-callback.h b/capi/include/cscl-ui-event-callback.h
new file mode 100644 (file)
index 0000000..55b3080
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2021 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 __SCL_EVENT_CALLBACK_H__
+#define __SCL_EVENT_CALLBACK_H__
+
+#include <sclui.h>
+
+class CUIEventCallback : public ISCLUIEventCallback
+{
+public :
+    SCLEventReturnType on_event_key_clicked(SclUIEventDesc event_desc);
+    SCLEventReturnType on_event_drag_state_changed(SclUIEventDesc event_desc);
+    SCLEventReturnType on_event_notification(SCLUINotiType noti_type, SclNotiDesc *etc_info);
+};
+
+#endif /* __SCL_EVENT_CALLBACK_H__ */
diff --git a/capi/include/cscl-ui-graphics-backend.h b/capi/include/cscl-ui-graphics-backend.h
new file mode 100644 (file)
index 0000000..5da8688
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2021 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 __SCL_GRAPHICS_BACKEND_H__
+#define __SCL_GRAPHICS_BACKEND_H__
+
+#include <sclui.h>
+
+class CUIGraphicsBackendCallback : public ISCLUIGraphicsBackendCallback
+{
+public :
+    void on_draw_text(const SclFontInfo& font_info, const SclColor& color, const char *str, int pos_x, int pos_y, int w, int h,
+                      SCLLabelAlignment align, int padding_x, int padding_y, int inner_width, int inner_height, void* user_data);
+
+    void on_draw_image(const char *image_path, int dest_x, int dest_y, int dest_weight, int dest_height, int src_x, int src_y, int src_width, int src_height, void* user_data);
+
+    void on_draw_rectangle(int pos_x, int pos_y, int width, int height, bool fill, int fill_color_r, int fill_color_g, int fill_color_b, int fill_color_a, void* user_data);
+};
+
+#endif /* __SCL_GRAPHICS_BACKEND_H__ */
diff --git a/capi/include/cscl-ui-nui.h b/capi/include/cscl-ui-nui.h
new file mode 100644 (file)
index 0000000..2449626
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2021 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 __SCL_CSHARP_NUI_H__
+#define __SCL_CSHARP_NUI_H__
+
+#include <tizen.h>
+#include <cscl-ui-controller.h>
+
+#define MAX_FONT_NAME_LEN 32
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum _LabelAlignment {
+    LABEL_ALIGN_LEFT_TOP = 0,
+    LABEL_ALIGN_CENTER_TOP,
+    LABEL_ALIGN_RIGHT_TOP,
+    LABEL_ALIGN_LEFT_MIDDLE,
+    LABEL_ALIGN_CENTER_MIDDLE,
+    LABEL_ALIGN_RIGHT_MIDDLE,
+    LABEL_ALIGN_LEFT_BOTTOM,
+    LABEL_ALIGN_CENTER_BOTTOM,
+    LABEL_ALIGN_RIGHT_BOTTOM,
+    MAX_LABEL_ALIGNMENT
+} LabelAlignment;
+
+/* graphics backend */
+typedef void (*scl_nui_draw_text_cb)(const char *font_name, short font_size, bool is_italic, bool is_bold, int r, int g, int b, int a,
+                                     const char *str, int pos_x, int pos_y, int w, int h,
+                                     LabelAlignment align, int padding_x, int padding_y, int inner_width, int inner_height, void* user_data);
+
+typedef void (*scl_nui_draw_image_cb)(const char *image_path, int dest_x, int dest_y, int dest_weight, int dest_height, int src_x, int src_y, int src_width, int src_height, void* user_data);
+typedef void (*scl_nui_draw_rectangle_cb)(int pos_x, int pos_y, int width, int height, bool fill, int fill_color_r, int fill_color_g, int fill_color_b, int fill_color_a, void* user_data);
+
+/* window backend */
+typedef void (*scl_nui_update_window_cb)(int x, int y, int width, int height, void* user_data);
+
+int scl_nui_init(const char *entry_filepath);
+int scl_nui_fini();
+
+int scl_nui_set_input_mode(const char *input_mode);
+int scl_nui_set_update_pending(bool pend);
+
+int scl_nui_set_draw_text_cb(scl_nui_draw_text_cb callback, void *user_data);
+int scl_nui_set_draw_image_cb(scl_nui_draw_image_cb callback, void *user_data);
+int scl_nui_set_draw_rectangle_cb(scl_nui_draw_rectangle_cb callback, void *user_data);
+
+int scl_nui_set_cur_sublayout(const char *sub_layout_name);
+int scl_nui_set_string_substitution(const char *original, const char *substitute);
+
+int scl_nui_set_update_window_cb(scl_nui_update_window_cb callback, void *user_data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __SCL_CSHARP_NUI_H__ */
diff --git a/capi/include/cscl-ui-win.h b/capi/include/cscl-ui-win.h
new file mode 100644 (file)
index 0000000..f971ed9
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2021 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 __SCL_CAPI_WIN_H__
+#define __SCL_CAPI_WIN_H__
+
+#include "Evas.h"
+
+Evas_Object *get_main_window();
+
+#endif /* __SCL_CAPI_WIN_H__ */
diff --git a/capi/include/cscl-ui-window-backend.h b/capi/include/cscl-ui-window-backend.h
new file mode 100644 (file)
index 0000000..337e4e9
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2021 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 __SCL_WINDOW_BACKEND_H__
+#define __SCL_WINDOW_BACKEND_H__
+
+#include <sclui.h>
+
+class CUIWindowBackendCallback : public ISCLUIWindowBackendCallback
+{
+public :
+    void update_window(int x, int y, int width, int height, void* user_data);
+};
+
+#endif /* __SCL_WINDOW_BACKEND_H__ */
diff --git a/capi/scl-ui-nui-capi.pc.in b/capi/scl-ui-nui-capi.pc.in
new file mode 100644 (file)
index 0000000..7740411
--- /dev/null
@@ -0,0 +1,14 @@
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=/usr
+libdir=@LIBDIR@
+includedir=/usr/include
+
+Name: @PC_NAME@
+Description: @PACKAGE_DESCRIPTION@
+Version: @VERSION@
+Requires: @PC_REQUIRED@
+Libs: -L${libdir} @PC_LDFLAGS@
+Cflags: -I${includedir}
+
diff --git a/capi/src/cscl-ui-controller.cpp b/capi/src/cscl-ui-controller.cpp
new file mode 100644 (file)
index 0000000..ea18a27
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <dlog.h>
+#include <tizen.h>
+#include "cscl-ui-controller.h"
+#include "sclcontroller.h"
+#include "cscl-ui-win.h"
+
+using namespace std;
+using namespace scl;
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "CSCLUINUI"
+
+EXPORT_API int scl_controller_mouse_press(int x, int y)
+{
+    CSCLController *controller = CSCLController::get_instance();
+    if (controller) {
+        LOGD("mouse down x:%d, y:%d", x, y);
+        controller->mouse_press(get_main_window(), x, y);
+        return 0;
+    }
+    else {
+        LOGW("No controller");
+        return 1;
+    }
+}
+
+
+EXPORT_API int scl_controller_mouse_release(int x, int y)
+{
+    CSCLController *controller = CSCLController::get_instance();
+    if (controller) {
+        LOGD("mouse release x:%d, y:%d", x, y);
+        controller->mouse_release(get_main_window(), x, y);
+        return 0;
+    }
+    else {
+        LOGW("No controller");
+        return 1;
+    }
+}
+
+EXPORT_API int scl_controller_mouse_move(int x, int y, int touch_id)
+{
+    CSCLController *controller = CSCLController::get_instance();
+    if (controller) {
+        LOGD("mouse move x:%d, y:%d", x, y);
+        controller->mouse_move(get_main_window(), x, y, touch_id);
+        return 0;
+    }
+    else {
+        LOGW("No controller");
+        return 1;
+    }
+}
diff --git a/capi/src/cscl-ui-nui.cpp b/capi/src/cscl-ui-nui.cpp
new file mode 100644 (file)
index 0000000..02f4d7d
--- /dev/null
@@ -0,0 +1,268 @@
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <dlog.h>
+#include <sclui.h>
+#include <Elementary.h>
+#include "cscl-ui-nui.h"
+#include "cscl-ui-graphics-backend.h"
+#include "cscl-ui-window-backend.h"
+#include "cscl-ui-event-callback.h"
+
+using namespace std;
+using namespace scl;
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "CSCLUINUI"
+
+#define USE_ELM_WIN 1
+
+#ifdef USE_ELM_WIN
+static Evas_Object *g_win = NULL;
+#endif
+
+static CSCLUI *g_ui = NULL;
+
+static scl_nui_draw_text_cb g_draw_text_cb;
+static void *g_draw_text_cb_data = NULL;
+
+static scl_nui_draw_image_cb g_draw_image_cb = NULL;
+static void *g_draw_image_cb_data = NULL;
+
+static scl_nui_draw_rectangle_cb g_draw_rectangle_cb = NULL;
+static void *g_draw_rectangle_cb_data = NULL;
+
+static scl_nui_update_window_cb g_update_window_cb = NULL;
+static void *g_update_window_cb_data = NULL;
+
+void CUIGraphicsBackendCallback::on_draw_text(const SclFontInfo& font_info, const SclColor& color, const char *str, int pos_x, int pos_y, int w, int h,
+                                      SCLLabelAlignment align, int padding_x, int padding_y, int inner_width, int inner_height, void* user_data)
+                      //const char *str, int x, int y, int w, int h, int fontsize, void* user_data)
+{
+    LOGD("draw text : %p", g_draw_text_cb);
+    if (g_draw_text_cb) {
+        //g_draw_text_cb(str, pos_x, pos_y, w, h, font_info.font_size, user_data);
+        /*
+        FontInfo fi;
+        strcpy(fi.font_name, font_info.font_name);
+        fi.font_size = font_info.font_size;
+        fi.is_bold = font_info.is_bold;
+        fi.is_italic = font_info.is_italic;
+
+        Color ci;
+        ci.a = color.a;
+        ci.b = color.b;
+        ci.g = color.g;
+        ci.r = color.r;
+        */
+
+        /*
+        g_draw_text_cb(fi, ci, str, pos_x, pos_y, w, h,
+                       (LabelAlignment)align, padding_x, padding_y, inner_width, inner_height, user_data);
+        */
+        g_draw_text_cb(font_info.font_name, font_info.font_size, font_info.is_bold, font_info.is_italic,
+                       color.r, color.g, color.b, color.a,
+                       str, pos_x, pos_y, w, h,
+                       (LabelAlignment)align, padding_x, padding_y, inner_width, inner_height, user_data);
+    }
+}
+
+void CUIGraphicsBackendCallback::on_draw_image(const char *image_path, int dest_x, int dest_y, int dest_weight, int dest_height, int src_x, int src_y, int src_width, int src_height, void* user_data)
+{
+    LOGD("draw image : %p", g_draw_image_cb);
+    if (g_draw_image_cb) {
+        g_draw_image_cb(image_path, dest_x, dest_y, dest_weight, dest_height, src_x, src_y, src_width, src_height, user_data);
+    }
+}
+
+void CUIGraphicsBackendCallback::on_draw_rectangle(int pos_x, int pos_y, int width, int height, bool fill, int fill_color_r, int fill_color_g, int fill_color_b, int fill_color_a, void* user_data)
+{
+    LOGD("draw rectangle : %p", g_draw_rectangle_cb);
+    if (g_draw_rectangle_cb) {
+        g_draw_rectangle_cb(pos_x, pos_y, width, height,
+                            fill, fill_color_r, fill_color_g, fill_color_b, fill_color_a, user_data);
+    }
+}
+
+void CUIWindowBackendCallback::update_window(int x, int y, int width, int height, void* user_data)
+{
+    LOGD("update_window : %p", g_update_window_cb);
+    if (g_update_window_cb) {
+        g_update_window_cb(x, y, width, height, user_data);
+    }
+}
+
+SCLEventReturnType CUIEventCallback::on_event_key_clicked(SclUIEventDesc event_desc)
+{
+    LOGI("");
+    return SCL_EVENT_PASS_ON;
+}
+
+SCLEventReturnType CUIEventCallback::on_event_notification(SCLUINotiType noti_type, SclNotiDesc *etc_info)
+{
+    LOGI("");
+    return SCL_EVENT_PASS_ON;
+}
+
+SCLEventReturnType CUIEventCallback::on_event_drag_state_changed(SclUIEventDesc event_desc)
+{
+    LOGI("");
+    return SCL_EVENT_PASS_ON;
+}
+
+static CUIGraphicsBackendCallback callback;
+
+static CUIWindowBackendCallback window_callback;
+
+static CUIEventCallback event_callback;
+
+Evas_Object *get_main_window()
+{
+    return g_win;
+}
+
+EXPORT_API int scl_nui_init(const char *entry_filepath)
+{
+#ifdef USE_ELM_WIN
+    elm_init(0, NULL);
+#endif
+
+    //LOGI("################## Hello ################");
+
+    //sleep(10);
+
+    if (!g_ui) {
+        g_ui = new CSCLUI;
+    }
+
+    if (!g_ui)
+        return 1;
+
+#ifdef USE_ELM_WIN
+    g_win = elm_win_add(NULL, "test", ELM_WIN_UTILITY);
+#endif
+
+    g_ui->init(g_win, SCL_PARSER_TYPE_XML, entry_filepath);
+
+    g_ui->set_graphics_backend_callback(&callback, NULL);
+
+    g_ui->set_window_backend_callback(&window_callback, NULL);
+
+    /* Default ISE callback */
+    g_ui->set_ui_event_callback(&event_callback);
+
+    return 0;
+}
+
+EXPORT_API int scl_nui_fini()
+{
+    int ret = 0;
+
+#ifdef USE_ELM_WIN
+    if (g_win)
+        evas_object_del(g_win);
+
+    g_win = NULL;
+#endif
+
+    if (g_ui)
+        g_ui->fini();
+    else
+        ret = 1;
+
+#ifdef USE_ELM_WIN
+    elm_shutdown();
+#endif
+
+    return ret;
+}
+
+EXPORT_API int scl_nui_set_input_mode(const char *input_mode)
+{
+    if (!g_ui)
+        return 1;
+
+    g_ui->set_input_mode(input_mode);
+
+    return 0;
+}
+
+EXPORT_API int scl_nui_set_update_pending(bool pend)
+{
+    if (!g_ui)
+        return 1;
+
+    g_ui->set_update_pending(pend);
+    return 0;
+}
+
+EXPORT_API int scl_nui_set_draw_text_cb(scl_nui_draw_text_cb callback, void *user_data)
+{
+    g_draw_text_cb = callback;
+    g_draw_text_cb_data = user_data;
+
+    return 0;
+}
+
+EXPORT_API int scl_nui_set_draw_image_cb(scl_nui_draw_image_cb callback, void *user_data)
+{
+    g_draw_image_cb = callback;
+    g_draw_image_cb_data = user_data;
+
+    return 0;
+}
+
+EXPORT_API int scl_nui_set_draw_rectangle_cb(scl_nui_draw_rectangle_cb callback, void *user_data)
+{
+    g_draw_rectangle_cb = callback;
+    g_draw_rectangle_cb_data = user_data;
+
+    return 0;
+}
+
+EXPORT_API int scl_nui_set_cur_sublayout(const char *sub_layout_name)
+{
+    if (!g_ui)
+        return 1;
+
+    LOGD("cur sublayout : %s", sub_layout_name);
+
+    g_ui->set_cur_sublayout(sub_layout_name);
+
+    return 0;
+}
+
+EXPORT_API int scl_nui_set_string_substitution(const char *original, const char *substitute)
+{
+    if (!g_ui)
+        return 1;
+
+    LOGD("original : %s, substitute : %s", original, substitute);
+
+    g_ui->set_string_substitution(original, substitute);
+
+    return 0;
+}
+
+EXPORT_API int scl_nui_set_update_window_cb(scl_nui_update_window_cb callback, void *user_data)
+{
+    g_update_window_cb = callback;
+    g_update_window_cb_data = user_data;
+
+    return 0;
+}
index ea9f996..40b8f66 100644 (file)
@@ -73,10 +73,11 @@ rm -rf %{buildroot}
 %files
 %manifest %{name}.manifest
 %defattr(-,root,root,-)
-%{_libdir}/%{name}.so
+%{_libdir}/*.so
+%{_libdir}/*.so.*
 %license LICENSE
 
 %files devel
 %defattr(-,root,root,-)
 %{_includedir}/*
-%{_libdir}/pkgconfig/%{name}.pc
+%{_libdir}/pkgconfig/*.pc