Add wrapper library 38/190038/19
authorhyunho Kang <gotoxtreme@gmail.com>
Wed, 26 Sep 2018 14:52:39 +0000 (23:52 +0900)
committerhyunho <hhstark.kang@samsung.com>
Tue, 2 Oct 2018 02:13:56 +0000 (11:13 +0900)
Change-Id: I8006d69cc2364fe59a83aaa5b3f123266e5a091e
Signed-off-by: hyunho Kang <gotoxtreme@gmail.com>
CMakeLists.txt
packaging/libwatchface-complication.spec
watchface-complication-wrapper/CMakeLists.txt [new file with mode: 0644]
watchface-complication-wrapper/complication-wrapper.cc [new file with mode: 0644]
watchface-complication-wrapper/include/watchface-common.h [new file with mode: 0644]
watchface-complication-wrapper/include/watchface-complication.h [new file with mode: 0644]
watchface-complication-wrapper/include/watchface-editable.h [new file with mode: 0644]
watchface-complication-wrapper/watchface-complication-wrapper.pc.in [new file with mode: 0644]

index 567915f..30a1270 100644 (file)
@@ -6,6 +6,7 @@ ADD_SUBDIRECTORY(watchface-complication)
 ADD_SUBDIRECTORY(watchface-editor)
 ADD_SUBDIRECTORY(parser)
 ADD_SUBDIRECTORY(unittest)
+ADD_SUBDIRECTORY(watchface-complication-wrapper)
 
 ADD_DEPENDENCIES(watchface-complication watchface-common)
 ADD_DEPENDENCIES(watchface-editor watchface-complication)
index e991f2d..40a7ea8 100644 (file)
@@ -209,6 +209,36 @@ Header & package configuration files to support development of the watchface lib
 %{_libdir}/pkgconfig/watchface-common.pc
 %attr(0644,root,root) %{_libdir}/libwatchface-common.so
 
+#################################################
+# libwatchface-complication-wrapper
+#################################################
+%package -n libwatchface-complication-wrapper
+Summary: Library for developing the watchface
+Group: Applications/Application Utility
+License: Apache-2.0
+
+%description -n libwatchface-complication-wrapper
+Provide utility to develop the watchface.
+
+%package -n libwatchface-complication-wrapper-devel
+Summary: Watchface common development library (dev)
+Group: Development/Libraries
+Requires: libwatchface-complication-wrapper
+
+%description -n libwatchface-complication-wrapper-devel
+Header & package configuration files to support development of the watchface editor.
+
+%post -n libwatchface-complication-wrapper -p /sbin/ldconfig
+%postun -n libwatchface-complication-wrapper -p /sbin/ldconfig
+
+%files -n libwatchface-complication-wrapper
+%manifest libwatchface-common.manifest
+%license LICENSE
+
+%files -n libwatchface-complication-wrapper-devel
+%{_includedir}/watchface-complication-wrapper/*.h
+%{_libdir}/pkgconfig/watchface-complication-wrapper.pc
+
 
 #################################################
 # gtest-watchface-complication
@@ -223,4 +253,5 @@ GTest for watchface-complication
 %files -n gtest-watchface-complication
 %{_bindir}/gtest-watchface-complication
 
+
 # End of a file
diff --git a/watchface-complication-wrapper/CMakeLists.txt b/watchface-complication-wrapper/CMakeLists.txt
new file mode 100644 (file)
index 0000000..48b3024
--- /dev/null
@@ -0,0 +1,44 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(watchface-complication-wrapper CXX)
+
+SET(PREFIX "${CMAKE_INSTALL_PREFIX}")
+SET(EXEC_PREFIX "\${prefix}")
+SET(PROJECT_NAME "${PROJECT_NAME}")
+SET(LIBDIR ${LIB_INSTALL_DIR})
+SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}")
+SET(VERSION_MAJOR 1)
+SET(VERSION "${VERSION_MAJOR}.0.0")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(watchface-complication-wrapper REQUIRED
+       glib-2.0
+       gio-2.0
+       bundle
+       dlog
+       capi-appfw-app-control
+)
+
+FOREACH(flag ${watchface-complication-wrapper_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall -Werror -Winline -std=c++11")
+
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}")
+SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
+SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
+
+ADD_LIBRARY(${PROJECT_NAME} STATIC complication-wrapper.cc)
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
+
+CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIBDIR})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIBDIR}/pkgconfig)
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${watchface-complication-wrapper_LDFLAGS} "-ldl")
+
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/watchface-complication.h DESTINATION include/${PROJECT_NAME})
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/watchface-common.h DESTINATION include/${PROJECT_NAME})
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/watchface-editable.h DESTINATION include/${PROJECT_NAME})
\ No newline at end of file
diff --git a/watchface-complication-wrapper/complication-wrapper.cc b/watchface-complication-wrapper/complication-wrapper.cc
new file mode 100644 (file)
index 0000000..4155259
--- /dev/null
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * 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 <stdio.h>
+#include <bundle.h>
+#include <dlog.h>
+#include <dlfcn.h>
+
+#include "include/watchface-complication.h"
+#include "include/watchface-editable.h"
+
+#define EXPORT __attribute__ ((visibility("default")))
+#undef PATH_LIB
+#define PATH_LIB  "/usr/lib/libwatchface-complication.so"
+#define STRING(arg) #arg
+#define TO_STRING(arg) STRING(arg)
+
+#define FUNC_CALL(func_name, ...) \
+do { \
+       if (__so_lib_handle == NULL) { \
+               __so_lib_handle = dlopen(PATH_LIB, RTLD_LAZY | RTLD_GLOBAL); \
+               if (!__so_lib_handle) { \
+                       LOGE("not supported"); \
+                       return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED; \
+               } \
+       } \
+       int (*func)(...) = (int (*)(...))dlsym(__so_lib_handle, TO_STRING(func_name)); \
+       if (func == NULL) { \
+               LOGE("not supported func (%s)", TO_STRING(func_name)); \
+               return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED; \
+       } \
+       int result = func(__VA_ARGS__);\
+       return result; \
+} while(0)
+
+#define FUNC_DEF1(name, arg1_type) \
+       extern "C" EXPORT int name(arg1_type arg1) { \
+               FUNC_CALL(name, arg1); \
+       }
+#define FUNC_DEF2(name, arg1_type, arg2_type) \
+       extern "C" EXPORT int name(arg1_type arg1, arg2_type arg2) { \
+               FUNC_CALL(name, arg1, arg2); \
+       }
+#define FUNC_DEF3(name, arg1_type, arg2_type, arg3_type) \
+       extern "C" EXPORT int name(arg1_type arg1, arg2_type arg2, arg3_type arg3) { \
+               FUNC_CALL(name, arg1, arg2, arg3); \
+       }
+#define FUNC_DEF4(name, arg1_type, arg2_type, arg3_type, arg4_type) \
+       extern "C" EXPORT int name(arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4) { \
+               FUNC_CALL(name, arg1, arg2, arg3, arg4); \
+       }
+#define FUNC_DEF5(name, arg1_type, arg2_type, arg3_type, arg4_type, arg5_type) \
+       extern "C" EXPORT int name(arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, arg5_type arg5) { \
+               FUNC_CALL(name, arg1, arg2, arg3, arg4, arg5); \
+       }
+#define FUNC_DEF6(name, arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type) \
+       extern "C" EXPORT int name(arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, arg5_type arg5, arg6_type arg6) { \
+               FUNC_CALL(name, arg1, arg2, arg3, arg4, arg5, arg6); \
+       }
+
+static void* __so_lib_handle = NULL;
+
+FUNC_DEF2(watchface_complication_get_current_provider_id, complication_h, char**)
+FUNC_DEF2(watchface_complication_get_current_type, complication_h,
+               watchface_complication_type_e*)
+FUNC_DEF4(watchface_complication_add_updated_cb, complication_h,
+               watchface_complication_updated_cb, watchface_complication_error_cb, void*)
+FUNC_DEF2(watchface_complication_remove_updated_cb, complication_h,
+               watchface_complication_updated_cb)
+FUNC_DEF1(watchface_complication_send_update_request, complication_h)
+FUNC_DEF6(watchface_complication_create, int, const char*,
+               watchface_complication_type_e, int, int, complication_h*)
+FUNC_DEF1(watchface_complication_destroy, complication_h)
+FUNC_DEF2(watchface_complication_data_get_type, const bundle*,
+               watchface_complication_type_e*)
+FUNC_DEF2(watchface_complication_data_get_short_text, const bundle*, char**)
+FUNC_DEF2(watchface_complication_data_get_long_text, const bundle*, char**)
+FUNC_DEF2(watchface_complication_data_get_title, const bundle*, char**)
+FUNC_DEF2(watchface_complication_data_get_timestamp, const bundle*, long*)
+FUNC_DEF2(watchface_complication_data_get_image_path, const bundle*, char**)
+FUNC_DEF4(watchface_complication_data_get_ranged_value, const bundle*, double*,
+               double* , double*)
+FUNC_DEF2(watchface_complication_data_get_icon_path, const bundle*, char**)
+FUNC_DEF2(watchface_complication_data_get_extra_data, const bundle*, char**)
+FUNC_DEF2(watchface_complication_data_get_screen_reader_text,
+               const bundle*, char**)
+FUNC_DEF2(watchface_complication_transfer_event, complication_h,
+               watchface_complication_event_type_e)
+FUNC_DEF1(watchface_complication_allowed_list_create, complication_allowed_list_h*)
+FUNC_DEF1(watchface_complication_allowed_list_destroy, complication_allowed_list_h)
+FUNC_DEF3(watchface_complication_allowed_list_add, complication_allowed_list_h,
+               const char*, int)
+FUNC_DEF2(watchface_complication_allowed_list_delete, complication_allowed_list_h,
+               const char*)
+FUNC_DEF4(watchface_complication_allowed_list_get_nth, complication_allowed_list_h,
+               int, char**, int*)
+FUNC_DEF2(watchface_complication_allowed_list_apply, complication_h,
+               complication_allowed_list_h)
+FUNC_DEF1(watchface_complication_allowed_list_clear, complication_h)
+FUNC_DEF1(watchface_editable_candidates_list_create, complication_candidates_list_h*)
+FUNC_DEF2(watchface_editable_candidates_list_add, complication_candidates_list_h,
+               bundle*)
+FUNC_DEF1(watchface_editable_candidates_list_destroy,
+               complication_candidates_list_h)
+FUNC_DEF6(watchface_editable_add_design_element, watchface_editable_container_h,
+               int, int, complication_candidates_list_h, watchface_editable_highlight_h,
+               const char*)
+FUNC_DEF4(watchface_editable_add_complication, watchface_editable_container_h,
+               int, complication_h, watchface_editable_highlight_h)
+FUNC_DEF3(watchface_editable_request_edit, watchface_editable_container_h,
+               watchface_editable_update_requested_cb, void*)
+FUNC_DEF2(watchface_editable_add_edit_ready_cb,
+               watchface_editable_edit_ready_cb, void*)
+FUNC_DEF1(watchface_editable_remove_edit_ready_cb,
+               watchface_editable_edit_ready_cb)
+FUNC_DEF2(watchface_editable_get_editable_name,
+               const watchface_editable_h, char**)
+FUNC_DEF2(watchface_editable_set_editable_name,
+               const watchface_editable_h, const char*)
+FUNC_DEF3(watchface_editable_get_nth_data,
+               const watchface_editable_h, int, bundle**)
+FUNC_DEF2(watchface_editable_get_current_data,
+               const watchface_editable_h, bundle**)
+FUNC_DEF2(watchface_editable_get_current_data_idx,
+               const watchface_editable_h, int*)
+FUNC_DEF2(watchface_editable_get_editable_id, const watchface_editable_h, int*)
+FUNC_DEF2(watchface_editable_load_current_data, int, bundle**)
+FUNC_DEF2(watchface_editable_highlight_create, watchface_editable_highlight_h*,
+               watchface_editable_shape_type_e)
+FUNC_DEF5(watchface_editable_highlight_set_geometry,
+               watchface_editable_highlight_h, int, int, int, int)
+FUNC_DEF5(watchface_editable_highlight_get_geometry,
+               watchface_editable_highlight_h, int*, int*, int*, int*)
+FUNC_DEF2(watchface_editable_highlight_set_shape_type,
+               watchface_editable_highlight_h, watchface_editable_shape_type_e)
+FUNC_DEF2(watchface_editable_highlight_get_shape_type,
+               watchface_editable_highlight_h, watchface_editable_shape_type_e*)
+FUNC_DEF1(watchface_editable_highlight_destroy, watchface_editable_highlight_h)
+FUNC_DEF2(watchface_editable_get_highlight,
+               const watchface_editable_h, watchface_editable_highlight_h*)
\ No newline at end of file
diff --git a/watchface-complication-wrapper/include/watchface-common.h b/watchface-complication-wrapper/include/watchface-common.h
new file mode 100644 (file)
index 0000000..3b8483d
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2018 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.
+ */
+
+#pragma once
+
+#include <tizen.h>
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "WATCHFACE_COMPLICATION"
+
+#ifndef TIZEN_ERROR_COMPLICATION
+#define TIZEN_ERROR_COMPLICATION -0x02FC0000
+#endif
+
+typedef enum _complication_error {
+       WATCHFACE_COMPLICATION_ERROR_NONE = TIZEN_ERROR_NONE, /**< Success */
+       WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
+       WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+       WATCHFACE_COMPLICATION_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */
+       WATCHFACE_COMPLICATION_ERROR_NO_DATA = TIZEN_ERROR_NO_DATA, /**< No data available */
+       WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
+       WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */
+       WATCHFACE_COMPLICATION_ERROR_DB = TIZEN_ERROR_COMPLICATION | 0x1, /**< Database error */
+       WATCHFACE_COMPLICATION_ERROR_DBUS = TIZEN_ERROR_COMPLICATION | 0x2, /**< DBUS error */
+       WATCHFACE_COMPLICATION_ERROR_EDIT_NOT_READY = TIZEN_ERROR_COMPLICATION | 0x3, /**< Edit not ready */
+       WATCHFACE_COMPLICATION_ERROR_EXIST_ID = TIZEN_ERROR_COMPLICATION | 0x4, /**< ID already exist */
+       WATCHFACE_COMPLICATION_ERROR_NOT_EXIST = TIZEN_ERROR_COMPLICATION | 0x5, /**< Not exist */
+       WATCHFACE_COMPLICATION_ERROR_PROVIDER_NOT_AVAILABLE = TIZEN_ERROR_COMPLICATION | 0x6, /**< Provider is not available, it could be uninstalled or disabled */
+} watchface_complication_error_e;
+
+typedef enum _complication_type {
+       WATCHFACE_COMPLICATION_TYPE_NO_DATA = 0x01, /**< No Data */
+       WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT = 0x02, /**< Short Text */
+       WATCHFACE_COMPLICATION_TYPE_LONG_TEXT = 0x04, /**< Long Text */
+       WATCHFACE_COMPLICATION_TYPE_RANGED_VALUE = 0x08, /**< Ranged Value */
+       WATCHFACE_COMPLICATION_TYPE_TIME = 0x10, /**< Time */
+       WATCHFACE_COMPLICATION_TYPE_ICON = 0x20, /**< Icon */
+       WATCHFACE_COMPLICATION_TYPE_IMAGE = 0x40, /**< Image */
+} watchface_complication_type_e;
+
+typedef enum _complication_event_type {
+       WATCHFACE_COMPLICATION_EVENT_NONE = 0x01, /**< Complication is not tapped */
+       WATCHFACE_COMPLICATION_EVENT_TAP = 0x02, /**< Tap */
+       WATCHFACE_COMPLICATION_EVENT_DOUBLE_TAP = 0x04 /**< Double Tap */
+} watchface_complication_event_type_e;
diff --git a/watchface-complication-wrapper/include/watchface-complication.h b/watchface-complication-wrapper/include/watchface-complication.h
new file mode 100644 (file)
index 0000000..794c053
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2018 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.
+ */
+
+#pragma once
+
+#include "watchface-common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void *complication_h;
+typedef void (*watchface_complication_updated_cb)(
+                       int complication_id,
+                       const char *provider_id,
+                       watchface_complication_type_e type,
+                       const bundle *data,
+                       void *user_data);
+
+typedef void (*watchface_complication_error_cb)(
+                       int complication_id,
+                       const char *provider_id,
+                       watchface_complication_type_e type,
+                       watchface_complication_error_e error,
+                       void *user_data);
+
+int watchface_complication_get_current_provider_id(complication_h handle,
+                       char **cur_provider);
+
+int watchface_complication_get_current_type(complication_h handle,
+                       watchface_complication_type_e *cur_type);
+
+int watchface_complication_add_updated_cb(complication_h handle,
+                       watchface_complication_updated_cb cb,
+                       watchface_complication_error_cb error_cb,
+                       void *user_data);
+
+int watchface_complication_remove_updated_cb(complication_h handle,
+                       watchface_complication_updated_cb cb);
+
+int watchface_complication_send_update_request(complication_h handle);
+
+int watchface_complication_create(int complication_id,
+                       const char *default_provider_id,
+                       watchface_complication_type_e default_type,
+                       int supported_types,
+                       int supported_event_types,
+                       complication_h *created_handle);
+
+int watchface_complication_destroy(complication_h handle);
+
+int watchface_complication_data_get_type(const bundle *data,
+                       watchface_complication_type_e *type);
+
+int watchface_complication_data_get_short_text(const bundle *data,
+                       char **short_text);
+
+int watchface_complication_data_get_long_text(const bundle *data,
+                       char **long_text);
+
+int watchface_complication_data_get_title(const bundle *data, char **title);
+
+int watchface_complication_data_get_timestamp(const bundle *data,
+                       long *timestamp);
+
+int watchface_complication_data_get_image_path(const bundle *data,
+                       char **image_path);
+
+int watchface_complication_data_get_ranged_value(const bundle *data,
+               double *current_value, double *min_value, double *max_value);
+
+int watchface_complication_data_get_icon_path(const bundle *data,
+                       char **icon_path);
+
+int watchface_complication_data_get_extra_data(const bundle *data,
+                       char **extra_data);
+
+int watchface_complication_data_get_screen_reader_text(const bundle *data,
+                       char **screen_reader_text);
+
+int watchface_complication_transfer_event(complication_h handle,
+                       watchface_complication_event_type_e event_type);
+
+typedef struct complication_allowed_list_ *complication_allowed_list_h;
+
+int watchface_complication_allowed_list_create(
+               complication_allowed_list_h *handle);
+
+int watchface_complication_allowed_list_destroy(
+               complication_allowed_list_h handle);
+
+int watchface_complication_allowed_list_add(complication_allowed_list_h handle,
+               const char *provider_id, int types);
+
+int watchface_complication_allowed_list_delete(complication_allowed_list_h handle,
+               const char *provider_id);
+
+int watchface_complication_allowed_list_get_nth(
+               complication_allowed_list_h handle, int index,
+               char **provider_id, int *types);
+
+int watchface_complication_allowed_list_apply(complication_h handle,
+               complication_allowed_list_h list_handle);
+int watchface_complication_allowed_list_clear(complication_h handle);
+
+#ifdef __cplusplus
+}
+#endif
\ No newline at end of file
diff --git a/watchface-complication-wrapper/include/watchface-editable.h b/watchface-complication-wrapper/include/watchface-editable.h
new file mode 100644 (file)
index 0000000..1d11932
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2018 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.
+ */
+
+#pragma once
+
+#include <bundle.h>
+#include "watchface-complication.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void *watchface_editable_h;
+typedef void *watchface_editable_container_h;
+typedef struct editable_highlight_ *watchface_editable_highlight_h;
+
+typedef enum _editable_edit_state {
+       WATCHFACE_EDITABLE_EDIT_STATE_COMPLETE, /**< Complete */
+       WATCHFACE_EDITABLE_EDIT_STATE_ONGOING, /**< Ongoing */
+       WATCHFACE_EDITABLE_EDIT_STATE_CANCEL /**< Cancel */
+} watchface_editable_edit_state_e;
+
+typedef enum _editable_shape_type {
+       WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE, /**< Circle */
+       WATCHFACE_EDITABLE_SHAPE_TYPE_RECT /**< Rectangle */
+} watchface_editable_shape_type_e;
+
+typedef void (*watchface_editable_update_requested_cb)(
+                       const watchface_editable_h handle,
+                       int selected_idx,
+                       const watchface_editable_edit_state_e state,
+                       void *user_data);
+
+typedef void (*watchface_editable_edit_ready_cb)(
+                       watchface_editable_container_h handle,
+                       const char *editor_appid,
+                       void *user_data);
+
+typedef struct complication_candidates_list_ *complication_candidates_list_h;
+
+int watchface_editable_candidates_list_create(
+                       complication_candidates_list_h *handle);
+
+int watchface_editable_candidates_list_add(
+                       complication_candidates_list_h handle, bundle *candidate);
+
+int watchface_editable_candidates_list_destroy(
+                       complication_candidates_list_h handle);
+
+int watchface_editable_add_design_element(watchface_editable_container_h handle,
+                       int editable_id, int cur_data_idx,
+                       complication_candidates_list_h list_handle,
+                       watchface_editable_highlight_h highlight, const char *editable_name);
+
+int watchface_editable_add_complication(watchface_editable_container_h handle,
+                       int editable_id, complication_h comp,
+                       watchface_editable_highlight_h highlight);
+
+int watchface_editable_request_edit(watchface_editable_container_h handle,
+                       watchface_editable_update_requested_cb cb,
+                       void *user_data);
+
+int watchface_editable_add_edit_ready_cb(watchface_editable_edit_ready_cb cb,
+                       void *user_data);
+
+int watchface_editable_remove_edit_ready_cb(watchface_editable_edit_ready_cb cb);
+
+int watchface_editable_get_editable_name(const watchface_editable_h handle,
+                       char **editable_name);
+
+int watchface_editable_set_editable_name(const watchface_editable_h handle,
+                       const char *editable_name);
+
+int watchface_editable_get_nth_data(const watchface_editable_h handle, int n,
+                       bundle **nth_data);
+
+int watchface_editable_get_current_data(const watchface_editable_h handle,
+                       bundle **cur_data);
+
+int watchface_editable_get_current_data_idx(
+                       const watchface_editable_h handle, int *idx);
+
+int watchface_editable_get_editable_id(const watchface_editable_h handle,
+                       int *editable_id);
+
+int watchface_editable_load_current_data(int editable_id,
+                       bundle **current_data);
+
+int watchface_editable_highlight_create(watchface_editable_highlight_h *handle,
+               watchface_editable_shape_type_e shape_type);
+
+int watchface_editable_highlight_set_geometry(
+       watchface_editable_highlight_h handle, int x, int y, int w, int h);
+
+int watchface_editable_highlight_get_geometry(
+       watchface_editable_highlight_h handle, int *x, int *y, int *w, int *h);
+
+int watchface_editable_highlight_set_shape_type(
+       watchface_editable_highlight_h handle,
+       watchface_editable_shape_type_e shape);
+
+int watchface_editable_highlight_get_shape_type(
+       watchface_editable_highlight_h handle,
+       watchface_editable_shape_type_e *shape);
+
+int watchface_editable_highlight_destroy(watchface_editable_highlight_h handle);
+
+int watchface_editable_get_highlight(const watchface_editable_h handle,
+       watchface_editable_highlight_h *highlight);
+
+#ifdef __cplusplus
+}
+#endif
\ No newline at end of file
diff --git a/watchface-complication-wrapper/watchface-complication-wrapper.pc.in b/watchface-complication-wrapper/watchface-complication-wrapper.pc.in
new file mode 100644 (file)
index 0000000..16ce10b
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: watchface-complication-wrapper
+Description: Support development of the watchface library
+Version: @VERSION@
+Libs: -L${libdir}
+Cflags: -I${includedir}
+cppflags: -I${includedir}
\ No newline at end of file