summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHyungKyu Song <hk76.song@samsung.com>2013-02-16 00:11:35 +0900
committerHyungKyu Song <hk76.song@samsung.com>2013-02-16 00:11:35 +0900
commitb32dea69029f492083f2b11f3a087300ddb2b9e0 (patch)
treecc97cc634e3234446670bc6c7d455bd1be5dd806
parentc3875cbe2f8e945b837a76ac5f8e6d57bde940bb (diff)
downloadui-gadget-1-tizen_2.0.tar.gz
ui-gadget-1-tizen_2.0.tar.bz2
ui-gadget-1-tizen_2.0.zip
-rwxr-xr-xCMakeLists.txt52
-rw-r--r--LICENSE204
-rw-r--r--NOTICE1
-rwxr-xr-xclient/CMakeLists.txt46
-rwxr-xr-xclient/ug-client.c442
-rw-r--r--client/ug-client.edc49
-rwxr-xr-xclient/ug-client.h58
-rw-r--r--image/SLP_UI_Gadget_PG_image00.pngbin0 -> 12673 bytes
-rw-r--r--image/SLP_UI_Gadget_PG_image01.pngbin0 -> 51733 bytes
-rw-r--r--image/SLP_UI_Gadget_PG_image02.pngbin0 -> 34998 bytes
-rw-r--r--image/SLP_UI_Gadget_PG_image03.pngbin0 -> 19266 bytes
-rwxr-xr-ximage/SLP_UI_Gadget_PG_image2-1.pngbin0 -> 26054 bytes
-rwxr-xr-ximage/SLP_UI_Gadget_PG_image2-11.pngbin0 -> 29452 bytes
-rwxr-xr-ximage/SLP_UI_Gadget_PG_image2-12.pngbin0 -> 13046 bytes
-rwxr-xr-ximage/SLP_UI_Gadget_PG_image2-13.pngbin0 -> 13229 bytes
-rwxr-xr-ximage/SLP_UI_Gadget_PG_image2-14.pngbin0 -> 13287 bytes
-rwxr-xr-ximage/SLP_UI_Gadget_PG_image2-15.pngbin0 -> 12165 bytes
-rwxr-xr-ximage/SLP_UI_Gadget_PG_image2-16.pngbin0 -> 12322 bytes
-rwxr-xr-ximage/SLP_UI_Gadget_PG_image2-17.pngbin0 -> 12802 bytes
-rwxr-xr-ximage/SLP_UI_Gadget_PG_image2-2.pngbin0 -> 26880 bytes
-rwxr-xr-ximage/SLP_UI_Gadget_PG_image2-3.pngbin0 -> 12346 bytes
-rwxr-xr-ximage/SLP_UI_Gadget_PG_image2-4.pngbin0 -> 11924 bytes
-rwxr-xr-ximage/SLP_UI_Gadget_PG_image2-5.pngbin0 -> 12351 bytes
-rwxr-xr-ximage/SLP_UI_Gadget_PG_image2-6.pngbin0 -> 13078 bytes
-rwxr-xr-ximage/SLP_UI_Gadget_PG_image2-7.pngbin0 -> 12529 bytes
-rwxr-xr-ximage/SLP_UI_Gadget_PG_image2-8.pngbin0 -> 12976 bytes
-rwxr-xr-ximage/SLP_UI_Gadget_PG_image2-9.pngbin0 -> 13120 bytes
-rwxr-xr-xinclude/SLP_UI_Gadget_PG.h895
-rw-r--r--include/ug-dbg.h37
-rw-r--r--include/ug-engine.h36
-rwxr-xr-xinclude/ug-manager.h49
-rw-r--r--include/ug-module.h36
-rwxr-xr-xinclude/ug.h76
-rwxr-xr-xinclude/ui-gadget-engine.h69
-rwxr-xr-xinclude/ui-gadget-module.h169
-rwxr-xr-xinclude/ui-gadget.h750
-rwxr-xr-xpackaging/ui-gadget-1.spec66
-rwxr-xr-xsrc/engine.c128
-rwxr-xr-xsrc/manager.c848
-rw-r--r--src/module.c138
-rwxr-xr-xsrc/ug.c283
-rwxr-xr-xug-efl-engine/CMakeLists.txt37
-rwxr-xr-xug-efl-engine/ug-efl-engine.c348
-rw-r--r--ug-efl-engine/ug-efl-engine.h32
-rw-r--r--ug-efl-engine/ug_effect.edc137
-rw-r--r--ui-gadget-1.manifest5
-rw-r--r--ui-gadget-1.pc.in11
47 files changed, 5002 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100755
index 0000000..f6a577a
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,52 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(ui-gadget-1)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(EXEC_PREFIX "\${prefix}")
+SET(LIBDIR "\${prefix}/lib")
+SET(INCLUDEDIR "\${prefix}/include")
+SET(VERSION_MAJOR 0)
+SET(VERSION "${VERSION_MAJOR}.1.0")
+
+SET(CMAKE_SKIP_BUILD_RPATH TRUE)
+
+IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+ SET(CMAKE_BUILD_TYPE "Release")
+ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-DDATAFS=\"${DATADIR}\"")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -Wall")
+
+INCLUDE(FindPkgConfig)
+SET(SRCS src/ug.c
+ src/manager.c
+ src/module.c
+ src/engine.c)
+
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
+
+PKG_CHECK_MODULES(PKGS REQUIRED glib-2.0 utilX bundle dlog x11 capi-appfw-application appsvc capi-appfw-app-manager elementary)
+FOREACH(flag ${PKGS_CFLAGS})
+ SET(CFLAGS "${CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CFLAGS "${CFLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}/include")
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${CFLAGS}")
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${PKGS_LDFLAGS} -ldl)
+
+CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib)
+INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/ui-gadget-module.h DESTINATION include/ug-1)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/ui-gadget-engine.h DESTINATION include/ug-1)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/ui-gadget.h DESTINATION include/ug-1)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/SLP_UI_Gadget_PG.h DESTINATION include/ug-1)
+
+ADD_SUBDIRECTORY(ug-efl-engine)
+ADD_SUBDIRECTORY(client)
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..bae7f54
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,204 @@
+Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
+
diff --git a/NOTICE b/NOTICE
new file mode 100644
index 0000000..4c49449
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1 @@
+Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt
new file mode 100755
index 0000000..cd31296
--- /dev/null
+++ b/client/CMakeLists.txt
@@ -0,0 +1,46 @@
+SET(CLIENT ug-client)
+SET(CLIENT_SRCS ug-client.c)
+SET(CLIENT_VENDOR samsung)
+SET(CLIENT_DIR /usr/bin)
+SET(CLIENT_LOCALEDIR /usr/share/locale)
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(CLIENT_PKGS REQUIRED
+ capi-appfw-application
+ capi-system-runtime-info
+ appcore-efl
+ appsvc
+ bundle
+ ecore-x
+ edje
+ dlog
+ elementary
+ evas
+ x11)
+
+FOREACH(flag ${CLIENT_PKGS_CFLAGS})
+ SET(CLIENT_CFLAGS "${CLIENT_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CLIENT_CFLAGS, "${CLIENT_CFLAGS} -DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+SET(CLIENT_CFLAGS, "${CLIENT_CFLAGS} -DVENDOR=\"${CLIENT_VENDOR}\"")
+SET(CLIENT_CFLAGS, "${CLIENT_CFLAGS} -DAPP_NAME=\"${CLIENT}\"")
+SET(CLIENT_CFLAGS, "${CLIENT_CFLAGS} -DAPP_DIR=\"${CLIENT_DIR}\"")
+SET(CLIENT_CFLAGS, "${CLIENT_CFLAGS} -DAPP_LOCALEDIR=\"${CLIENT_LOCALEDIR}\"")
+
+ADD_EXECUTABLE(${CLIENT} ${CLIENT_SRCS})
+SET_TARGET_PROPERTIES(${CLIENT} PROPERTIES COMPILE_FLAGS "${CLIENT_CFLAGS}")
+TARGET_LINK_LIBRARIES(${CLIENT} ${PROJECT_NAME} ${CLIENT_PKGS_LDFLAGS})
+
+ADD_CUSTOM_TARGET(ug-client.edj
+ COMMAND edje_cc -id ${CMAKE_CURRENT_SOURCE_DIR}/images
+ ${CMAKE_CURRENT_SOURCE_DIR}/ug-client.edc ${CMAKE_CURRENT_BINARY_DIR}/ug-client.edj
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ug-client.edc
+)
+ADD_DEPENDENCIES(${CLIENT} ug-client.edj)
+
+INSTALL(TARGETS ${CLIENT} DESTINATION bin)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/ug-client.edj DESTINATION share/edje/ug-client)
+
diff --git a/client/ug-client.c b/client/ug-client.c
new file mode 100755
index 0000000..1125ef0
--- /dev/null
+++ b/client/ug-client.c
@@ -0,0 +1,442 @@
+/*
+ * UI Gadget
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>
+ *
+ * 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 <appcore-efl.h>
+#include <ui-gadget.h>
+#include <Ecore_X.h>
+#include <dlog.h>
+#include <aul.h>
+#include <appsvc.h>
+#include <app.h>
+#include <runtime_info.h>
+
+#include "ug-client.h"
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "UI_GADGET_CLIENT"
+
+static void prt_usage(const char *cmd)
+{
+ fprintf(stderr, "Usage: %s [-f] [-F] -n <UG NAME> [-d <Arguments>]\n",
+ cmd);
+ fprintf(stderr, " Options:\n");
+ fprintf(stderr, " -d argument\n");
+ fprintf(stderr, " -F Fullview mode (Default)\n");
+ fprintf(stderr, " -f Frameview mode\n");
+ fprintf(stderr, " Example:\n");
+ fprintf(stderr,
+ " %s -F -n helloUG-efl -d \"name,John Doe\" -d \"age,30\"\n",
+ cmd);
+
+}
+
+static void win_del(void *data, Evas_Object *obj, void *event)
+{
+ elm_exit();
+}
+
+static void main_quit_cb(void *data, Evas_Object *obj,
+ const char *emission, const char *source)
+{
+ elm_exit();
+}
+
+static int rotate(enum appcore_rm m, void *data)
+{
+ struct appdata *ad = data;
+ int r;
+ bool is_rotation_lock = false;
+
+ if (ad == NULL || ad->win == NULL)
+ return 0;
+
+ switch (m) {
+ case APPCORE_RM_PORTRAIT_NORMAL:
+ ug_send_event(UG_EVENT_ROTATE_PORTRAIT);
+ r = 0;
+ break;
+ case APPCORE_RM_PORTRAIT_REVERSE:
+ r = 180;
+ ug_send_event(UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN);
+ break;
+ case APPCORE_RM_LANDSCAPE_NORMAL:
+ ug_send_event(UG_EVENT_ROTATE_LANDSCAPE);
+ r = 270;
+ break;
+ case APPCORE_RM_LANDSCAPE_REVERSE:
+ ug_send_event(UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN);
+ r = 90;
+ break;
+ default:
+ r = -1;
+ break;
+ }
+
+ LOGE("rotate cb / rm : %d , r : %d", m, r);
+
+ if(r >= 0)
+ elm_win_rotation_with_resize_set(ad->win, r);
+
+ return 0;
+}
+
+void _ug_client_layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv)
+{
+ struct appdata *ad;
+ Evas_Object *base;
+
+ if (!ug || !priv)
+ return;
+
+ ad = priv;
+
+ base = ug_get_layout(ug);
+ if (!base)
+ return;
+
+ switch (mode) {
+ case UG_MODE_FULLVIEW:
+ evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ ug_disable_effect(ug);
+ elm_object_content_set(ad->ly_main, base);
+ evas_object_show(base);
+ break;
+ case UG_MODE_FRAMEVIEW:
+ elm_object_part_content_set(ad->ly_main, "content", base);
+ break;
+ default:
+ break;
+ }
+}
+
+void _ug_client_result_cb(ui_gadget_h ug, service_h result, void *priv)
+{
+ struct appdata *ad;
+ int ret;
+
+ if (!ug || !priv)
+ return;
+ ad = priv;
+
+ ret = service_reply_to_launch_request(result, ad->request, SERVICE_RESULT_SUCCEEDED);
+ if (ret != SERVICE_ERROR_NONE)
+ LOGE("service_reply_to_launch_request failed, %d", ret);
+}
+
+void _ug_client_destroy_cb(ui_gadget_h ug, void *priv)
+{
+ if (!ug)
+ return;
+
+ ug_destroy(ug);
+ elm_exit();
+}
+
+static void profile_changed_cb(void *data, Evas_Object * obj, void *event)
+{
+ const char *profile = elm_config_profile_get();
+
+ if (strcmp(profile, "desktop") == 0)
+ elm_win_indicator_mode_set (obj, ELM_WIN_INDICATOR_HIDE);
+ else
+ elm_win_indicator_mode_set (obj, ELM_WIN_INDICATOR_SHOW);
+}
+
+static Evas_Object *create_win(const char *name)
+{
+ Evas_Object *eo;
+ int w, h;
+
+ eo = elm_win_add(NULL, name, ELM_WIN_BASIC);
+ if (eo) {
+ elm_win_title_set(eo, name);
+ elm_win_conformant_set(eo, EINA_TRUE);
+ evas_object_smart_callback_add(eo, "delete,request",
+ win_del, NULL);
+ evas_object_smart_callback_add(eo, "profile,changed", profile_changed_cb, NULL);
+ ecore_x_window_size_get(ecore_x_window_root_first_get(),
+ &w, &h);
+ evas_object_resize(eo, w, h);
+ }
+
+ return eo;
+}
+
+static Evas_Object *_ug_client_load_edj(Evas_Object *parent, const char *file,
+ const char *group)
+{
+ Evas_Object *eo;
+ int r;
+ eo = elm_layout_add(parent);
+ if (eo) {
+ r = elm_layout_file_set(eo, file, group);
+ if (!r) {
+ evas_object_del(eo);
+ return NULL;
+ }
+ evas_object_size_hint_weight_set(eo,
+ EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ }
+ return eo;
+}
+
+static int low_memory(void *data)
+{
+ return ug_send_event(UG_EVENT_LOW_MEMORY);
+}
+
+static int low_battery(void *data)
+{
+ return ug_send_event(UG_EVENT_LOW_BATTERY);
+}
+
+static int lang_changed(void *data)
+{
+ return ug_send_event(UG_EVENT_LANG_CHANGE);
+}
+
+static int app_create(void *data)
+{
+ struct appdata *ad = data;
+ enum appcore_rm rm;
+ Evas_Object *win;
+ Evas_Object *ly;
+ Evas_Object *conform;
+ Evas_Object *bg;
+
+ /* create window */
+ win = create_win(PACKAGE);
+ if (win == NULL)
+ return -1;
+ ad->win = win;
+ UG_INIT_EFL(ad->win, UG_OPT_INDICATOR_ENABLE);
+
+ bg = elm_bg_add(win);
+ evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bg);
+ evas_object_show(bg);
+
+ conform = elm_conformant_add(win);
+ evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ ad->conform = conform;
+
+ /* load edje */
+ ly = _ug_client_load_edj(conform, EDJ_FILE, GRP_MAIN);
+ if (ly == NULL)
+ return -1;
+ elm_win_resize_object_add(win, conform);
+
+ evas_object_show(conform);
+ elm_object_content_set(conform, ly);
+ edje_object_signal_callback_add(elm_layout_edje_get(ly),
+ "EXIT", "*", main_quit_cb, NULL);
+ ad->ly_main = ly;
+ elm_win_indicator_mode_set(win, ELM_WIN_INDICATOR_SHOW);
+ lang_changed(ad);
+
+ if (appcore_get_rotation_state(&rm) == 0)
+ rotate(rm, ad);
+
+ appcore_set_rotation_cb(rotate, ad);
+ appcore_set_event_callback(APPCORE_EVENT_LOW_MEMORY, low_memory, ad);
+ appcore_set_event_callback(APPCORE_EVENT_LOW_BATTERY, low_battery, ad);
+ appcore_set_event_callback(APPCORE_EVENT_LANG_CHANGE, lang_changed, ad);
+
+ return 0;
+}
+
+static int app_terminate(void *data)
+{
+ struct appdata *ad = data;
+
+ ug_destroy_all();
+
+ if (ad->ly_main) {
+ evas_object_del(ad->ly_main);
+ ad->ly_main = NULL;
+ }
+
+ if (ad->win) {
+ evas_object_del(ad->win);
+ ad->win = NULL;
+ }
+
+ return 0;
+}
+
+static int app_pause(void *data)
+{
+ struct appdata *ad = data;
+
+ ug_pause();
+ if (!ad->is_transient) {
+ LOGD("app_pause received. close ug service");
+ elm_exit();
+ }
+ return 0;
+}
+
+static int app_resume(void *data)
+{
+ ug_resume();
+ return 0;
+}
+
+static int svc_cb(void *data)
+{
+ LOGD("svc_cb called");
+ return 0;
+}
+
+static int app_reset(bundle *b, void *data)
+{
+ struct appdata *ad = data;
+ struct ug_cbs cbs = { 0, };
+ service_h service;
+ enum ug_mode mode = UG_MODE_FULLVIEW;
+ int ret;
+ Ecore_X_Window id2 = elm_win_xwindow_get(ad->win);
+
+ ret = appsvc_request_transient_app(b, id2, svc_cb, "svc test");
+ if (ret)
+ LOGD("fail to request transient app: return value(%d)", ret);
+ else
+ ad->is_transient = 1;
+
+ if (ad->win) {
+ elm_win_activate(ad->win);
+ evas_object_show(ad->win);
+ }
+
+ if (ad->data) /* ug-launcher */
+ service_create_event(ad->data, &service);
+ else
+ service_create_event(b, &service);
+
+ if(service) {
+ service_clone(&ad->request, service);
+ service_destroy(service);
+ }
+
+ cbs.layout_cb = _ug_client_layout_cb;
+ cbs.destroy_cb = _ug_client_destroy_cb;
+ cbs.result_cb = _ug_client_result_cb;
+ cbs.priv = ad;
+
+ mode = ad->is_frameview ? UG_MODE_FRAMEVIEW : UG_MODE_FULLVIEW;
+
+ ad->ug = ug_create(NULL, ad->name, mode, ad->request, &cbs);
+ if (ad->ug == NULL) {
+ LOGE("ug_create fail: %s", ad->name);
+ elm_exit();
+ }
+
+ return 0;
+}
+
+static int update_argument(const char *optarg, struct appdata *ad)
+{
+ const char *key;
+ const char *val;
+ key = strtok((char *)optarg, ",");
+ if (!key)
+ return -1;
+
+ val = optarg + strlen(key) + 1;
+ if (!val)
+ return -1;
+
+ if (!ad->data)
+ ad->data = bundle_create();
+ if (!ad->data)
+ return -1;
+ bundle_add(ad->data, key, val);
+ return 0;
+}
+
+int main(int argc, char *argv[])
+{
+ int opt;
+ struct appdata ad;
+ struct appcore_ops ops = {
+ .create = app_create,
+ .terminate = app_terminate,
+ .pause = app_pause,
+ .resume = app_resume,
+ .reset = app_reset,
+ };
+ int cmdlen = 0;
+
+ setenv("ELM_ENGINE", "gl", 1); //enabling the OpenGL as the backend of the EFL.
+
+ memset(&ad, 0x0, sizeof(struct appdata));
+ ops.data = &ad;
+
+ cmdlen = strlen(argv[0]);
+ if (strncmp(argv[0], "ug-launcher", cmdlen) == 0
+ || strncmp(argv[0], "/usr/bin/ug-launcher", cmdlen) == 0) {
+ while ((opt = getopt(argc, argv, "n:d:")) != -1) {
+ switch (opt) {
+ case 'n':
+ if (optarg)
+ ad.name = strdup(optarg);
+ break;
+ case 'f':
+ ad.is_frameview = 1;
+ break;
+ case 'F':
+ ad.is_frameview = 0;
+ break;
+ case 'd':
+ if (update_argument(optarg, &ad)) {
+ if (ad.data)
+ bundle_free(ad.data);
+ prt_usage(argv[0]);
+ return -1;
+ }
+ break;
+ default:
+ prt_usage(argv[0]);
+ return -1;
+ }
+ }
+
+ if (!ad.name) {
+ prt_usage(argv[0]);
+ return -1;
+ }
+ argc = 1; // remove appsvc bundle
+ } else { /* ug-client */
+ char *name = NULL;
+ name = strrchr(argv[0], '/');
+ if (name == NULL)
+ return -1;
+ /* .../bin/{name} */
+ ad.name = strdup(&name[1]);
+ }
+ return appcore_efl_main(PACKAGE, &argc, &argv, &ops);
+}
diff --git a/client/ug-client.edc b/client/ug-client.edc
new file mode 100644
index 0000000..398bb77
--- /dev/null
+++ b/client/ug-client.edc
@@ -0,0 +1,49 @@
+/*
+ * UI Gadget
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>
+ *
+ * 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.
+ *
+ */
+
+collections {
+ group {
+ name: "main";
+
+ parts {
+ part { name: "background";
+ type: RECT;
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; offset: 0 0; }
+ rel2 { relative: 1.0 1.0; offset: -1 -1; }
+ color: 0 0 0 255;
+ }
+ }
+
+ part { name: "content";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.2 0.2; to: background; }
+ rel2 { relative: 0.8 0.8; to: background; }
+ color: 255 255 255 255;
+ }
+ }
+ }
+ }
+}
diff --git a/client/ug-client.h b/client/ug-client.h
new file mode 100755
index 0000000..7c496fd
--- /dev/null
+++ b/client/ug-client.h
@@ -0,0 +1,58 @@
+/*
+ * UI Gadget
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>
+ *
+ * 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 __UG_CLIENT_H__
+#define __UG_CLIENT_H__
+
+#include <Elementary.h>
+#include <ui-gadget.h>
+#include <bundle.h>
+
+#if !defined(PACKAGE)
+#define PACKAGE "ug-client"
+#endif
+
+#if !defined(LOCALEDIR)
+#define LOCALEDIR "/usr/share/locale"
+#endif
+
+#if !defined(EDJDIR)
+#define EDJDIR "/usr/share/edje/ug-client"
+#endif
+
+#define EDJ_FILE EDJDIR "/" PACKAGE ".edj"
+#define GRP_MAIN "main"
+
+struct appdata {
+ Evas_Object *win;
+ Evas_Object *ly_main;
+ Evas_Object *conform;
+
+ ui_gadget_h ug;
+ const char *name;
+ int is_frameview;
+ int is_transient;
+
+ bundle *data;
+ service_h request;
+};
+
+#endif /* __UG_CLIENT_H__ */
diff --git a/image/SLP_UI_Gadget_PG_image00.png b/image/SLP_UI_Gadget_PG_image00.png
new file mode 100644
index 0000000..fec5e52
--- /dev/null
+++ b/image/SLP_UI_Gadget_PG_image00.png
Binary files differ
diff --git a/image/SLP_UI_Gadget_PG_image01.png b/image/SLP_UI_Gadget_PG_image01.png
new file mode 100644
index 0000000..8d4156f
--- /dev/null
+++ b/image/SLP_UI_Gadget_PG_image01.png
Binary files differ
diff --git a/image/SLP_UI_Gadget_PG_image02.png b/image/SLP_UI_Gadget_PG_image02.png
new file mode 100644
index 0000000..245bfb5
--- /dev/null
+++ b/image/SLP_UI_Gadget_PG_image02.png
Binary files differ
diff --git a/image/SLP_UI_Gadget_PG_image03.png b/image/SLP_UI_Gadget_PG_image03.png
new file mode 100644
index 0000000..0b69891
--- /dev/null
+++ b/image/SLP_UI_Gadget_PG_image03.png
Binary files differ
diff --git a/image/SLP_UI_Gadget_PG_image2-1.png b/image/SLP_UI_Gadget_PG_image2-1.png
new file mode 100755
index 0000000..3d08ea7
--- /dev/null
+++ b/image/SLP_UI_Gadget_PG_image2-1.png
Binary files differ
diff --git a/image/SLP_UI_Gadget_PG_image2-11.png b/image/SLP_UI_Gadget_PG_image2-11.png
new file mode 100755
index 0000000..eeb9ddb
--- /dev/null
+++ b/image/SLP_UI_Gadget_PG_image2-11.png
Binary files differ
diff --git a/image/SLP_UI_Gadget_PG_image2-12.png b/image/SLP_UI_Gadget_PG_image2-12.png
new file mode 100755
index 0000000..a476b23
--- /dev/null
+++ b/image/SLP_UI_Gadget_PG_image2-12.png
Binary files differ
diff --git a/image/SLP_UI_Gadget_PG_image2-13.png b/image/SLP_UI_Gadget_PG_image2-13.png
new file mode 100755
index 0000000..13199fe
--- /dev/null
+++ b/image/SLP_UI_Gadget_PG_image2-13.png
Binary files differ
diff --git a/image/SLP_UI_Gadget_PG_image2-14.png b/image/SLP_UI_Gadget_PG_image2-14.png
new file mode 100755
index 0000000..f75131e
--- /dev/null
+++ b/image/SLP_UI_Gadget_PG_image2-14.png
Binary files differ
diff --git a/image/SLP_UI_Gadget_PG_image2-15.png b/image/SLP_UI_Gadget_PG_image2-15.png
new file mode 100755
index 0000000..2cd6bfe
--- /dev/null
+++ b/image/SLP_UI_Gadget_PG_image2-15.png
Binary files differ
diff --git a/image/SLP_UI_Gadget_PG_image2-16.png b/image/SLP_UI_Gadget_PG_image2-16.png
new file mode 100755
index 0000000..ca8bbf8
--- /dev/null
+++ b/image/SLP_UI_Gadget_PG_image2-16.png
Binary files differ
diff --git a/image/SLP_UI_Gadget_PG_image2-17.png b/image/SLP_UI_Gadget_PG_image2-17.png
new file mode 100755
index 0000000..3b7ec40
--- /dev/null
+++ b/image/SLP_UI_Gadget_PG_image2-17.png
Binary files differ
diff --git a/image/SLP_UI_Gadget_PG_image2-2.png b/image/SLP_UI_Gadget_PG_image2-2.png
new file mode 100755
index 0000000..db457c9
--- /dev/null
+++ b/image/SLP_UI_Gadget_PG_image2-2.png
Binary files differ
diff --git a/image/SLP_UI_Gadget_PG_image2-3.png b/image/SLP_UI_Gadget_PG_image2-3.png
new file mode 100755
index 0000000..233ee64
--- /dev/null
+++ b/image/SLP_UI_Gadget_PG_image2-3.png
Binary files differ
diff --git a/image/SLP_UI_Gadget_PG_image2-4.png b/image/SLP_UI_Gadget_PG_image2-4.png
new file mode 100755
index 0000000..e471d8b
--- /dev/null
+++ b/image/SLP_UI_Gadget_PG_image2-4.png
Binary files differ
diff --git a/image/SLP_UI_Gadget_PG_image2-5.png b/image/SLP_UI_Gadget_PG_image2-5.png
new file mode 100755
index 0000000..3cf7e95
--- /dev/null
+++ b/image/SLP_UI_Gadget_PG_image2-5.png
Binary files differ
diff --git a/image/SLP_UI_Gadget_PG_image2-6.png b/image/SLP_UI_Gadget_PG_image2-6.png
new file mode 100755
index 0000000..041b837
--- /dev/null
+++ b/image/SLP_UI_Gadget_PG_image2-6.png
Binary files differ
diff --git a/image/SLP_UI_Gadget_PG_image2-7.png b/image/SLP_UI_Gadget_PG_image2-7.png
new file mode 100755
index 0000000..1dd1557
--- /dev/null
+++ b/image/SLP_UI_Gadget_PG_image2-7.png
Binary files differ
diff --git a/image/SLP_UI_Gadget_PG_image2-8.png b/image/SLP_UI_Gadget_PG_image2-8.png
new file mode 100755
index 0000000..662410b
--- /dev/null
+++ b/image/SLP_UI_Gadget_PG_image2-8.png
Binary files differ
diff --git a/image/SLP_UI_Gadget_PG_image2-9.png b/image/SLP_UI_Gadget_PG_image2-9.png
new file mode 100755
index 0000000..ccb6116
--- /dev/null
+++ b/image/SLP_UI_Gadget_PG_image2-9.png
Binary files differ
diff --git a/include/SLP_UI_Gadget_PG.h b/include/SLP_UI_Gadget_PG.h
new file mode 100755
index 0000000..70387f2
--- /dev/null
+++ b/include/SLP_UI_Gadget_PG.h
@@ -0,0 +1,895 @@
+/*
+ * UI Gadget
+ *
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+ *
+ * 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.
+ *
+ */
+
+/**
+ *
+ * @ingroup SLP_PG
+ * @defgroup SLP_PG_UI_GADGET UI gadget library
+ * @{
+
+<h1 class="pg">Introduction</h1>
+<h2 class="pg">Purpose of this document</h2>
+The purpose of this document is to describe how to develop/use UI gadget. This document gives programming guidelines to UI gadget devlopers and users.
+<h2 class="pg">Scope</h2>
+The scope of this document is limited to UI gadget component interface and API usage.
+
+<h1 class="pg">UI gadget architecture</h1>
+<h2 class="pg">UI gadget</h2>
+An UI gadget is a visual component providing views (or features) of other applications, e.g., contact, image viewer. Because UI gadgets are supposed to deliver most commonly used features that the platform can natively support, developers can avoid unnecessary massive code writing using UI gadgets. Hence an UI gadget eventually includes logics to handle simple request. UI gadget is able to be managed by UI gadget library.
+\image html SLP_UI_Gadget_PG_image00.png "Picture 1. UI gadget architecture diagram"
+
+<h2 class="pg">UI gadget features</h2>
+UI Gadget Library has the following features:
+- It provides component interfaces for UI Gadget
+- It manages UI gadget instances in an application according to their lifecycle
+
+<h2 class="pg">Lifecycle</h2>
+Essentially, an UI gadget has following five states (See Picture 2)
+- The initial state is \b Ready
+- If an UI gadget has been created, it is \b Created
+- If an UI gadget has been started, it is \b Running
+- If the application that is using an UI gadget is put into background, it is \b Stopped
+- If an UI gadget has been destroyed, it is \b Destroyed
+
+An UI gadget has five callback methods that you can implement to perform operations when the UI gadget moves between states
+- When an UI gadget is created, \b create() is invoked
+- When an UI gadget is started, \b start() is invoked
+- When the application that is using an UI gadget is put into background, \b pause() is invoked
+- When the application that is using an UI gadget is brought to the foreground, \b resume() is invoked.
+- When an UI gadget is destroyed, \b destroy() is invoked
+
+In addition, an UI gadget has callback methods for system events and message:
+- When an system event is generated, event() is invoked
+- When an UI gadget receives message from the caller, message() is invoked
+
+\image html SLP_UI_Gadget_PG_image01.png "Picture 2. UI gadget state diagram"
+
+<h2 class="pg">Management</h2>
+UI gadgets in an application are managed as a TREE structure (See Picture 3.) The features for the tree are:
+- Root of the tree is the UI gadget manager
+- UI gadget caller is parent of callees
+- Parents arrange the layout of their children
+
+Every application which is using UI gadgets has one UI gadget manager as a root of the tree. And the UI gadget manager propagates system events and task management events by post-order traversal. Available system events are <i>low memory, low battery, language changed, region changed and window rotate event</i>. And task management events are <i>pause and resume</i>.
+
+\image html SLP_UI_Gadget_PG_image02.png "Picture 3. UI gadget management policy"
+
+<h1 class="pg">Getting started</h1>
+<h2 class="pg">Overview</h2>
+For using UI gadget, you need to know the working procedure between caller and UI gadget module.<br><br>
+As an UI gadget module developer, the operations of UI gadget module are very important. These operations are called by UI gadget library when the caller requests something to UI gadget module and UI gadget module performs a proper job mainly related with lifecycle. “Section How to make UI gadget” describes detail of each operation.<br><br>
+As an UI gadget caller, you need to know the APIs for using UI gadget module and callback functions for dealing with UI gadget module. The caller can create UI gadget module using ug_create() API and have right to arrange layout of UI gadget module and destroy UI gadget module. These are performed by caller when caller requests something to UI gadget library and related callback functions are called by UI gadget library. “Section How to use UI gadget” describes detail of each APIs and callback functions.
+<h2 class="pg">How to make UI gadget</h2>
+In this section, we are going to write your first UI gadget called "helloUG-efl". Before we get started, make sure you have read the overview, especially, lifecycle section. We will mainly deal with the operations of lifecycle.
+
+\note <b>Sample codes</b> are included in the UI gadget source package. The samples for UI gadget developers are located in "samples/helloUG-efl/", and the samples for UI gadget users are in "samples/ugcaller/."
+
+<br>
+<h3 class="pg">UI gadget template</h3>
+To create an UI gadget, start by generating boilerplate code using UI gadget template as follow:
+@verbatim
+# ug-gen.sh helloUG-efl helloUG-efl EFL
+@endverbatim
+
+\note <b>How to install UI gadget template:</b>
+@verbatim
+# unrpm ui-gadget-template-xxx.rpm
+# or
+# rpm -Uvh ui-gadget-templat-xxx.rpm
+@endverbatim
+
+\note <b>How to use UI gadget template:</b>
+@verbatim
+# ug-gen.sh [destination] [name] [UI library]
+@endverbatim
+- destination: destination directory
+- name: UI gadget name
+- UI library: UI library to use. Only EFL is available for now
+
+After you generate code, you get following files:
+- <i>helloUG-efl.c</i> (Source)
+- <i>helloUG-efl.h</i> (Private header)
+- <i>CMakeList.txt</i> (Build script)
+- <i>po/*</i> (I18N files)
+
+<i>helloUG-efl.c</i> contains base code, and the most important parts are <i>UG_MODULE_INIT</i> and <i>UG_MODULE_EXIT</i> which are symbols to export for dynamic linking. <i>UG_MODULE_INIT</i> is invoked when the UI gadget is loading, and it sets operations, private data, and the option. <i>UG_MODULE_EXIT</i> is invoked when the UI gadget is unloading, and it clears private data.<br><br>
+Even if you don't understand generated code right now, don't worry about it. What you have to do is just implementation of operations according to their role (see next section.)
+@code
+// in helloUG-efl.c
+UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops)
+{
+ struct ug_data *ugd; // User defined private data
+
+ if (!ops)
+ return -1;
+
+ ugd = calloc(1, sizeof(struct ug_data));
+ if (!ugd)
+ return -1;
+
+ // create operation
+ ops->create = on_create;
+ // start operation
+ ops->start = on_start;
+ // pause operation
+ ops->pause = on_pause;
+ // resume operation
+ ops->resume = on_resume;
+ // destroy operation
+ ops->destroy = on_destroy;
+ // message operation
+ ops-> message = on_message;
+ // event operation
+ ops->event = on_event;
+ // private data
+ ops->priv = ugd;
+ // option
+ ops->opt = UG_OPT_INDICATOR_ENABLE;
+
+ return 0;
+}
+
+UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops)
+{
+ struct ug_data *ugd;
+
+ if (!ops)
+ return;
+
+ ugd = ops->priv;
+ if (ugd)
+ free(ugd); // clear private data
+}
+
+@endcode
+
+\note <b>struct ug_module_ops</b> is a data structure describing operations, private data, and the option of UI gadget:
+@code
+struct ug_module_ops {
+ void *(*create)(ui_gadget_h ug, enum ug_mode mode, service_h service, void *priv);
+ void (*start)(ui_gadget_h ug, service_h service, void *priv);
+ void (*pause)(ui_gadget_h ug, service_h service, void *priv);
+ void (*resume)(ui_gadget_h ug, service_h service, void *priv);
+ void (*destroy)(ui_gadget_h ug, service_h service, void *priv);
+ void (*message)(ui_gadget_h ug, service_h *msg, service_h service, void *priv);
+ void (*event)(ui_gadget_h ug, enum ug_event event, service_h service, void *priv);
+ void *reserved[5];
+ void *priv;
+ enum ug_option opt;
+};
+@endcode
+
+\note <b>enum ug_option</b> is UI gadget options, available options are:
+@code
+// Enable indicator
+UG_OPT_INDICATOR_ENABLE
+// Enable indicator with portrait window
+UG_OPT_INDICATOR_PORTRAIT_ONLY
+// Enable indicator with landscape window
+UG_OPT_INDICATOR_LANDSCAPE_ONLY
+// Disable indicator
+UG_OPT_INDICATOR_DISABLE
+// current indicator status will be held
+UG_OPT_INDICATOR_MANUAL
+// Enable indicator overlap
+UG_OPT_OVERLAP_ENABLE
+@endcode
+
+\note <b>struct ug_data</b> is a user defined private data structure describing base layout, own UI gadget handler, and whatever you need:
+@code
+struct ug_data {
+ Evas_Object *base;
+ ui_gadget_h ug;
+
+ // PUT WHATEVER YOU NEED
+}
+@endcode
+
+<br>
+<h3 class="pg">Operations</h3>
+There are five state operations, a message operation, and an event operation: <i>create, start, pause, resume, destroy, message, and event.</i>
+<br><br>
+When "helloUG-efl" is created, the create operation is invoked (See Picture 2-1).<br><br>
+
+\image html SLP_UI_Gadget_PG_image2-1.png "Picture 2-1. Create operation of UI gadget module"
+
+The implementation of create operation is <b>on_create()</b>. Basically, in the operation, we have to make a base layout and return it. Hence, we made base layout using <i>"window layout winset."</i> In case of fullview, we let indicator area be shown, otherwise, we don't (see <i>create_fullview()</i> and <i>create_frameview()</i>.) In addition, in the base layout, we put a box including a label and two buttons (see <i>create_content()</i>.) The label is labeled "Hello UI Gadget." And the first button, labeled "Send result", is for sending result to the "helloUG-efl" caller. The other button, labeled "Back", is for sending destroy request to the caller. For more information about two buttons, please see <i>Send results and request to destroy section</i>.
+
+\note <b>Arguments:</b> All operations receive servive type data which is named <i>service</i> (see \ref service_PG "Tizen Managed APi Reference Guide > Application Framework -> Application") And the argument <i>service</i> is automatically released by UI gadget manager after the UI gadget is destroyed.
+
+@code
+// in helloUG-efl.c
+static void *on_create(ui_gadget_h ug, enum ug_mode mode, service_h service, void *priv)
+{
+ Evas_Object *parent;
+ Evas_Object *content;
+ struct ug_data *ugd;
+
+ if (!ug || !priv)
+ return NULL;
+
+ ugd = priv;
+ ugd->ug = ug;
+
+ parent = ug_get_parent_layout(ug);
+ if (!parent)
+ return NULL;
+
+ if (mode == UG_MODE_FULLVIEW)
+ ugd->base = create_fullview(parent, ugd);
+ else
+ ugd->base = create_frameview(parent, ugd);
+
+ if (ugd->base) {
+ content = create_content(parent, ugd);
+ elm_layout_content_set(ugd->base, "elm.swallow.content", content);
+ }
+ return ugd->base;
+}
+
+static Evas_Object *create_fullview(Evas_Object *parent, struct ug_data *ugd)
+{
+ Evas_Object *base;
+
+ base = elm_layout_add(parent);
+ if (!base)
+ return NULL;
+ elm_layout_theme_set(base, "layout", "application", "default");
+ // In case of fullview, show indicator area
+ edje_object_signal_emit(_EDJ(base), "elm,state,show,indicator", "elm");
+ edje_object_signal_emit(_EDJ(base), "elm,state,show,content", "elm");
+
+ return base;
+}
+
+static Evas_Object *create_frameview(Evas_Object *parent, struct ug_data *ugd)
+{
+ Evas_Object *base;
+
+ base = elm_layout_add(parent);
+ if (!base)
+ return NULL;
+
+ elm_layout_theme_set(base, "layout", "application", "default");
+ // In case of frameview, do not show indicator area
+ edje_object_signal_emit(_EDJ(base), "elm,state,show,content", "elm");
+
+ return base;
+}
+
+static Evas_Object *create_content(Evas_Object *parent, struct ug_data *ugd)
+{
+ Evas_Object *bx, *eo;
+
+ // add box
+ bx = elm_box_add(parent);
+
+ // add label and pack it in the box
+ eo = elm_label_add(parent);
+ elm_object_text_set(eo, _("Hello UI Gadget"));
+ evas_object_size_hint_align_set(eo, 0.5, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(eo, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(eo);
+ elm_box_pack_end(bx, eo);
+
+ // add buttons and pack it in the box
+ eo = elm_button_add(parent);
+ elm_object_text_set(eo, _("Send result"));
+ evas_object_size_hint_align_set(eo, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(eo, "clicked", result_cb, ugd);
+ elm_object_style_set(eo, "bottom_btn");
+
+ evas_object_show(eo);
+ elm_box_pack_end(bx, eo);
+
+ eo = elm_button_add(parent);
+ elm_object_text_set(eo, _("Back"));
+ evas_object_size_hint_align_set(eo, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(eo, "clicked", back_cb, ugd);
+ elm_object_style_set(eo, "bottom_btn");
+
+ evas_object_show(eo);
+ elm_box_pack_end(bx, eo);
+ return bx;
+}
+
+@endcode
+
+When "helloUG-efl" starts, the start operation is invoked (See Picture 2-2).<br><br>
+
+\image html SLP_UI_Gadget_PG_image2-2.png "Picture 2-2. Start operation of UI gadget module"
+
+The implementation of start operation is <b>on_start()</b>. Usually every job would be completed before this operation, so just describe additional job you need to do in this operation.
+
+@code
+// in helloUG-efl.c
+static void on_start(ui_gadget_h ug, service_h service, void *priv)
+{
+
+}
+@endcode
+
+When "helloUG-efl" is destroyed, the destroy operation is invoked(See Picture 2-3). Ui gadget cannot destroy itself, so it moust be destroyed by caller using ug_destroy().<br><br>
+
+\image html SLP_UI_Gadget_PG_image2-3.png "Picture 2-3. Destroy operation of UI gadget module"
+
+The implementation of destroy operation is <b>on_destroy()</b>. We usually release the resources that have been used. In the following method, we delete base layout:
+
+@code
+// in helloUG-efl.c
+static void on_destroy(ui_gadget_h ug, service_h service, void *priv)
+{
+ struct ug_data *ugd;
+
+ if (!ug || !priv)
+ return;
+
+ ugd = priv;
+
+ evas_object_del(ugd->base);
+ ugd->base = NULL;
+}
+@endcode
+
+When the application using "helloUG-efl" is put into background, the pause operation is invoked (See Picture 2-4). But UI gadget could get state only from caller, so pause operation (e.g., on_pause) is called by caller using ug_pause().<br><br>
+
+\image html SLP_UI_Gadget_PG_image2-4.png "Picture 2-4. Pause operation of UI gadget module"
+
+When the application is brought to the foreground, the resume operation is invoked (See Picture 2-5). Resume operation (e.g.,on_resume) is called by caller using ug_resume().<br><br>
+
+\image html SLP_UI_Gadget_PG_image2-5.png "Picture 2-5. Resume operation of UI gadget module"
+
+Besides, when an UI gadget receives message from its caller suing ug_send_message(), the message operation(e.g., on_message) is invoked (See Picture 2-6).<br><br>
+
+\image html SLP_UI_Gadget_PG_image2-6.png "Picture 2-6. Send message to UI gadget module"
+
+And when a system event is generated and UI gadget receives event from caller using ug_send_event(), the event operation(e.g., on_event) is invoked (See Picture 2-7).<br><br>
+
+\image html SLP_UI_Gadget_PG_image2-7.png "Picture 2-7. Send system event to UI gadget module"
+
+The implementation of pause, resume, message, and event operations are on_pause(), on_resume(), on_message(), and on_event(). In on_pause() and on_resume(), you can describe actions performed when a state is changed to pause or resume. For example, music player UI gadget can stop playing music or restart playing music in these operations. In on_message(), you can get service type data from caller and deal with it. In on_event(), you can describe a proper job related to the passed system event.
+
+@code
+// in helloUG-efl.c
+static void on_pause(ui_gadget_h ug, service_h service, void *priv)
+{
+ // Do what you need to do when paused.
+}
+static void on_resume(ui_gadget_h ug, service_h service, void *priv)
+{
+ // Do what you need to do when paused.
+}
+
+static void on_message(ui_gadget_h ug, service msg, service_h service, void *priv)
+{
+ // Do what you need to do when paused.
+}
+
+static void on_event(ui_gadget_h ug, enum ug_event event, service_h service, void *priv)
+{
+ switch (event) {
+ case UG_EVENT_LOW_MEMORY:
+ break;
+ case UG_EVENT_LOW_BATTERY:
+ break;
+ case UG_EVENT_LANG_CHANGE:
+ break;
+ case UG_EVENT_ROTATE_PORTRAIT:
+ break;
+ case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
+ break;
+ case UG_EVENT_ROTATE_LANDSCAPE:
+ break;
+ case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
+ break;
+ case UG_EVENT_REGION_CHANGE:
+ break;
+ default:
+ break;
+ }
+}
+@endcode
+
+\warning Message data of message operation is service type data, named <i>msg.</i> <b>Because the message data is released after message operation is finished,</b> if you want to keep using it, please use <b>service_clone()()</b> which duplicates given service data (see \ref service_PG "Tizen Managed API Reference Guide")
+
+<br>
+<h3 class="pg">Send results and destroy request</h3>
+Usually, an UI gadget needs to send results or destroy request to the UI gadget caller.<br><br>
+To send result, use <b>ug_send_result()</b>, then UG library calls result callback function registered by caller (See Picture 2-8)(See <i>API reference guide</i>).<br><br>
+
+\image html SLP_UI_Gadget_PG_image2-8.png "Picture 2-8. Send result"
+
+And to send the destroy request, use <b>ug_destroy_me().</b>(), then UG library calls destroy callback function registered by caller (See Picture 2-9) (See <i>API reference quide</i>).<br><br>
+
+\image html SLP_UI_Gadget_PG_image2-9.png "Picture 2-9. UI gadget destroy request"
+
+We use service library for composing result data. The service provides us a few APIs to make a list of dictionary data that consists of key and value. (ex. {"name" "John Doe"}) To get more information of service, please see \ref service_PG "Tizen Managed API Reference Guide".
+
+\warning After send your result data, you have to release it using <b>service_destroy()</b> API.
+
+In our "helloUG-efl", we made two buttons for sending results and destroy request as below:
+@code
+// in helloUG-efl.c
+
+//Include to use service APIs
+#include <app.h>
+
+static void result_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ service_h result;
+ struct ug_data *ugd;
+ int ret;
+
+ if (!data)
+ return;
+
+ ugd = data;
+
+ ret = service_create(&result);
+
+ service_add_extra_data(result, "name", "hello-UG");
+ service_add_extra_data(result, "description", "sample UI gadget");
+
+ ug_send_result(ugd->ug, result);
+
+ // release service
+ service_destroy(result);
+}
+
+static void back_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ struct ug_data *ugd;
+ int i;
+
+ if (!data)
+ return;
+
+ ugd = data;
+
+ //Send destroy request
+ ug_destroy_me(ugd->ug);
+}
+@endcode
+
+\note <b>To use service</b>
+- Install capi-appfw-application-dev package (add in your RPM spec file)
+- Modify CMakeFile.txt to use capi package as follow:
+@code
+ …
+ pkg_check_modules(pkgs REQUIRED elementary ui-gadget-1 capi-appfw-application)
+ …
+@endcode
+
+<br>
+<h3 class="pg">Internationalization</h3>
+Basically, we use <b><i>dgettext</i></b> for translating a text string into the user's native language because each UI gadget uses different textdomain.
+@code
+// in helloUG-efl.h
+#define PKGNAME "ug-helloUG-efl"
+#define _(s) dgettext(PKGNAME, s)
+#define dgettext_noop(s) (s)
+#define N_(s) dgettext_noop(s)
+@endcode
+
+The PKGNAME is textdomain of "helloUG-efl", and _() is a dgettext wrapper, and N_() is dummy macro. In addition, _() and N_() are additional keywords for marking translatable string for xgettext. Especially, N_() is a dummy keyword for special case as follow:
+@code
+static const char *message[] = {
+ N_("translatable string"),
+};
+@endcode
+
+For more information, please see <a href="http://www.gnu.org/software/gettext/manual/gettext.html">GNU gettext utilities</a>.
+
+\note <b>xgettext</b> extracts gettext strings from given input files. The canonical keyword for marking translatable strings is 'gettext'. For convenience, many packages use '_' as a keyword instead of 'gettext', and write '_("translatable string")' instead of 'gettext("translatable string")'.
+
+<br>
+<h3 class="pg">Rotation and indicator</h3>
+When the UI gadget is created as fullview, we have to consider whether the indicator is shown or not. For instance, "Image viewer" shows the indicator on the portrait mode but not on the landscape mode. Hence, we provided option field named <i>opt</i> of <i>struct ug_module_ops</i> in UG_MODULE_INIT.
+Available options are as following:
+- UG_OPT_INDICATOR_ENABLE (default)
+- UG_OPT_INDICATOR_POTRAIT_ONLY
+- UG_OPT_LANDSCAPE_ONLY
+- UG_OPT_INDICATOR_DISABLE
+- UG_OPT_INDICATOR_MANUAL
+- UG_OPT_OVERLAP_ENABLE
+
+And we used UG_OPT_INDICATOR_POTRAIT_ONLY in "helloUG-efl"
+
+<br>
+<h3 class="pg">Build and test</h3>
+Before you build, you have to make sure whether translatable strings exist or not. IF translatable strings EXIST, please follow these steps before you build:
+@verbatim
+# cd po
+# ./update-po.sh
+# cd ..
+@endverbatim
+IF NOT, please remove the following line in your CMakeList.txt
+@verbatim
+ADD_SUBDIRECTORY(po)
+@endverbatim
+
+To build "helloUG-efl", follow these steps:
+@verbatim
+# mkdir build
+# cd build
+# cmake -DCMAKE_INSTALL_PREFIX=/usr ..
+# make
+# make install
+or
+make home project for your UI gadget in obs.
+you can find RPM spec file in packaging directory by template.
+@endverbatim
+
+\note <b>Naming rule:</b> The output library name is <b>"libug-helloUG-efl.so"</b>, and we use <b>"helloUG-efl"</b> as UI gadget name except prefix <b>"libug-"</b> and postfix ".so" In other word, when you make an UI gadget, the name of library MUST be <b>"libug-XXXXXX.so"</b>
+\note <b>Installation directory:</b> UI gadgets MUST be installed in "/usr/lib/ug/" which is preload Ug and "/opt/lib/ug/" is downloaded UG
+
+Finally, we made our first UI gadget, "helloUG-efl." Let's test it using <i>ug-launcher</i> which is simple UI gadget launcher.
+Fullview test
+@verbatim
+# ug-launcher -n helloUG-efl
+@endverbatim
+Frameview test
+@verbatim
+# ELM_THEME=beat ug-launcher -n helloUG-efl -f
+@endverbatim
+
+\note <b>How to use UG launcher</b>
+@verbatim
+# ug-launcher [-F] [-f] -n <UG_NAME> [-d <Argument>]
+@endverbatim
+- -d: argument, key, value pair.
+- -F: Fullview mode (default)
+- -f: frameview mode
+\note <b> Example: </b>
+@verbatim
+# ug-launcher -F -n helloUG-efl -d "name,John doe" -d "age,30"
+@endverbatim
+
+<br>
+<h2 class="pg">How to use UI gadget</h2>
+Now, we are going to use "helloUG-efl" of previous section.
+
+<br>
+<h3 class="pg">Initialize</h3>
+
+If you are UI gadget developer who is trying to use UI gadgets, please skip this section. This section is for application developers who use UI gadgets.
+You have to initialize UI gadget manager before you use UI gadgets. To initialize, use <b>ug_init()</b> with arguments: <i>disp, xid, win and opt</i>. <i>disp</i> is default display, and <i>xid</i> is X window id of win. <i>win</i> is window evas object for UI gadgets, and it is usually main window. <i>opt</i> is rotation and indicator option for your application (see <i>Rotation and indicator section</i>.)
+
+The <i>disp</i> and <i>xid</i> are used for indicator management. If you don't know how to get display and X window ID, just use following macro: <b>UG_INIT_EFL(win, opt);</b>
+
+\note <b>Prototype of ug_init() (See API Reference guide):</b>
+@code
+int ug_init (Display *disp, Window xid, void *win, enum ug_option opt);
+@endcode
+\note <b>Macros for convenience (see 3 API reference quide):</b>
+@code
+UG_INIT_EFL(win, opt);
+@endcode
+
+<br>
+<h3 class="pg">Create UI gadget instance</h3>
+
+To create UI gadget instance, you have to invoke <b>ug_create()</b> which has five arguments: <i>parent, name, mode, service, and cbs.</i>
+
+First, the <i>parent</i> is provided for specifying parent UI gadget, and it helps UI gadget manager to manage UI gadget tree (see <i>Management section.</i>) For instance, if the UI gadget 'A' uses other UI gadgets, the parent has to be the 'A.' Otherwise, if an application uses UI gadgets, the <i>parent</i> has to be NULL.
+
+Second, the <i>name</i> is the UI gadget's name (ex. "helloUG-efl")
+
+Third, the <i>mode</i> could be UG_MODE_FULLVIEW to show the UI gadget as fullview, or UG_MODE_FRAMEVIEW to show it as frameview.
+
+Fourth, the <i>service</i> is arguments for the UI gadget which is service type (see \ref service_PG "Tizen Managed API Reference Guide")
+
+\warning After create UI gadget, you have to release the argument using <b>service_destroy()</b> API.
+
+Fifth, the <i>cbs</i> is data describing layout callback, result callback, destroy callback, and private data. In detail, layout callback is used for layout arrangement, and it invoked after the UI gadget is created, and result callback is invoked to receive result from the UI gadget. And destroy callback is invoked to deal with destroy request from the UI gadget.
+
+\warning Result data of the result callback is service type data, named <i>result</i>. <b>Because the result data is released after result callback is finished</b>, if you want to keep using it, please use <b>service_clone()</b> which duplicates given service data (see \ref service_PG "Tizen Managed API Reference Guide")
+
+Using ug_create(), you can create UI gadget. After UI Gadget create operation is completed, layout callback function is called with base layout for layout arrangement (See Picture 2-11).<br><br>
+
+\image html SLP_UI_Gadget_PG_image2-11.png "Picture 2-11. Create UI gadget"
+
+The registered callback functions like result_cb or destroy_cb by caller is called when the UI gadget request sending result or destroy operation. <br><br>
+When UI gadget requests to UI gadget library for sending result to caller using ug_send_result(), UI gadget library calls result callback function which is registered by caller(See Picture 2-12).<br><br>
+
+\image html SLP_UI_Gadget_PG_image2-12.png "Picture 2-12. Send result"
+
+And using ug_destroy_me(), UI gadget sends the destroy request to caller (See Picture 2-13). UI gadget cannot destroy itself, so it should request to caller.<br><br>
+
+\image html SLP_UI_Gadget_PG_image2-13.png "Picture 2-13. Destroy request"
+
+\note <b>Prototype of ug_create() (See API reference guide):</b>
+@code
+ui_gadget_h ug_create (ui_gadget_h parent,
+ const char *name,
+ enum ug_mode mode,
+ service_h service,
+ struct ug_cbs *cbs);
+
+\note <b>struct ug_cbs</b> is describing some callbacks and private data:
+@code
+struct ug_cbs {
+ void (*layout_cb)(ui_gadget_h ug, enum ug_mode mode, void *priv);
+ void (*result_cb)(ui_gadget_h ug, service result, void *priv);
+ void (*destroy_cb)(ui_gadget_h ug, void *priv);
+ void *priv;
+};
+@endcode
+
+Here are some examples:
+
+@code
+// FULLVIEW example
+struct my_data {
+ ui_gadget_h ug;
+};
+
+static void layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv)
+{
+ Evas_Object *base, *win;
+
+ if (!ug || !priv)
+ return;
+
+ base = ug_get_layout(ug);
+ if (!base)
+ return;
+
+ switch (mode) {
+ case UG_MODE_FULLVIEW:
+ win = ug_get_window();
+ if (!win)
+ return;
+ evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ ug_disable_effect(ug);
+ evas_object_show(base);
+ break;
+ default:
+ break;
+ }
+}
+
+static void result_cb(ui_gadget_h ug, service result, void *priv)
+{
+ struct my_data *mydata;
+ const char *val;
+
+ if (!ug || !priv)
+ return;
+
+ mydata = priv;
+ if (result) {
+ service_get_extra_data(result, "name", val);
+ if (val)
+ fprintf(stderr, "The name of UI gadget that sends result is %s\n", val);
+ }
+ ug_destroy(ug);
+ mydata->ug = NULL;
+
+}
+
+static void destroy_cb(ui_gadget_h ug, void *priv)
+{
+ struct my_data *mydata;
+
+ if (!ug || !priv)
+ return;
+
+ mydata = priv;
+
+ ug_destroy(ug);
+ mydata->ug = NULL;
+}
+
+ui_gadget_h create_ug(struct my_data *data)
+{
+ ui_gadget_h ug;
+ struct ug_cbs cbs = {0, };
+
+ cbs.layout_cb = layout_cb;
+ cbs.result_cb = result_cb;
+ cbs.destroy_cb = destroy_cb;
+ cbs.priv = (void *)data;
+
+ ug = ug_create(NULL, "helloUG-efl", UG_MODE_FULLVIEW, NULL, &cbs);
+
+ return ug;
+}
+@endcode
+
+@code
+// FRAMEVIEW example
+struct my_data {
+ ui_gadget_h ug;
+ Evas_Object *main_layout;
+};
+
+static void layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv)
+{
+ Evas_Object *base, *win;
+ struct my_data *mydata;
+
+ if (!ug || !priv)
+ return;
+
+ mydata = priv;
+
+ base = ug_get_layout(ug);
+ if (!base)
+ return;
+
+ switch (mode) {
+ case UG_MODE_FRAMEVIEW:
+ elm_layout_content_set(mydata->main_layout, "content", base);
+ break;
+ default:
+ break;
+ }
+}
+
+static void result_cb(ui_gadget_h ug, service result, void *priv)
+{
+ struct my_data *mydata;
+ const char *val;
+
+ if (!ug || !priv)
+ return;
+
+ mydata = priv;
+
+ if (result) {
+ service_get_extra_data(result, "name", val);
+ if (val)
+ fprintf(stderr, "The name of UI gadget that sends result is %s\n", val);
+ }
+
+ ug_destroy(ug);
+ mydata->ug = NULL;
+
+}
+
+static void destroy_cb(ui_gadget_h ug, void *priv)
+{
+ struct my_data *mydata;
+
+ if (!ug || !priv)
+ return;
+
+ mydata = priv;
+
+ ug_destroy(ug);
+ mydata->ug = NULL;
+}
+
+ui_gadget_h create_ug(struct my_data *data)
+{
+ ui_gadget_h ug;
+ struct ug_cbs cbs = {0, };
+
+ cbs.layout_cb = layout_cb;
+ cbs.result_cb = result_cb;
+ cbs.destroy_cb = destroy_cb;
+ cbs.priv = (void *)data;
+
+ ug = ug_create(NULL, "helloUG-efl", UG_MODE_FRAMEVIEW, NULL, &cbs);
+
+ return ug;
+}
+@endcode
+
+<br>
+<h2 class="pg">Send message</h2>
+
+We provide API for sending message: <b>ug_send_message()</b>. When you send a message, you have to use service type data (see \ref service_PG "Tizen Managed API Reference Guide"). (See Picture 2-14)
+
+\note <b>Prototype of ug_send_message() (See API reference guide):</b>
+@code
+int ug_send_message (ui_gadget_h ug, service msg);
+@endcode
+
+\image html SLP_UI_Gadget_PG_image2-14.png "Picture 2-14. Send message"
+
+\warning After send your message, you have to release it using <b>service_destroy()</b> API.
+@code
+//example
+ service_h msg;
+
+ ret = service_create(&msg);
+
+ service_add_extra_data(msg, "name", "hello-UG");
+ service_add_extra_data(msg, "description", "sample UI gadget");
+
+ //Send message
+ ug_send_message(ug, msg);
+
+ //release service
+ service_destroy(msg);
+@endcode
+
+<br>
+<h2 class="pg">Event propagation</h2>
+
+If you are UI gadget developer who is trying to use UI gadgets, please skip this section. This section is for application developers who use UI gadgets.
+
+We provide some APIs for event propagation: <b>ug_pause(), ug_resume(), and ug_send_event()</b>. <b>ug_pause()</b> and <b>ug_resume()</b> are used for task-managing. If the application is put into background, invoke <b>ug_pause()</b>, otherwise, if the application is brought to the foreground, invoke <b>ug_resume()</b>. <b>ug_send_event()</b> is used for system event: <i>low memory, low battery, language change, region change, rotate portrait, rotate portrait upside-down, rotate landscape, and rotate landscape upside-down.</i>
+
+\note <b>Prototype of ug_pause(), ug_resume(), and ug_send_event() (See API reference guide):</b>
+@code
+int ug_pause (void);
+int ug_resume (void);
+int ug_send_event (enum ug_event event);
+@endcode
+
+\image html SLP_UI_Gadget_PG_image2-15.png "Picture 2-15. Pause event propagation"
+\image html SLP_UI_Gadget_PG_image2-16.png "Picture 2-16. Resume event propagation"
+\image html SLP_UI_Gadget_PG_image2-17.png "Picture 2-17. System event propagation"
+
+<br>
+<h2 class="pg">Destroy all UI gadgets</h2>
+
+If you are UI gadget developer who is trying to use UI gadgets, please skip this section. This section is for application developers who use UI gadgets.
+
+When you terminate your application, destroy all UI gadgets using <b>ug_destroy_all()</b>.
+
+\note <b>Prototype of ug_destroy_all(See API reference guide): </b>
+@code
+int ug_destroy_all (void);
+@endcode
+
+<br>
+<h2 class="pg">Disable UI gadget effect</h2>
+
+We provide API for disabling transition effect: <i>ug_disable_effect</i>. If you want to disable showing/hiding transition effect when create and destroy a UI Gadget, <i>ug_disable_effect</i> should be called before show UI Gadget layout.
+
+\note <b>Prototype of ug_disable_effect(See API reference guide): </b>
+@code
+int ug_disable_effect (void);
+@endcode
+
+Here are some examples:
+
+@code
+To disable transition effect :
+
+ static void layout_cb(struct ui_gadget *ug, enum ug_mode mode, void *priv)
+ {
+ Evas_Object *base, *win;
+ if (!ug || !priv)
+ return;
+ base = ug_get_layout(ug);
+ if (!base)
+ return;
+
+ win = ug_get_window();
+ switch (mode) {
+ case UG_MODE_FULLVIEW:
+ evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ // disable effect
+ ug_disable_effect(ug);
+ evas_object_show(base);
+ break;
+ default:
+ break;
+ }
+@endcode
+
+ * @}
+ */
diff --git a/include/ug-dbg.h b/include/ug-dbg.h
new file mode 100644
index 0000000..00167b0
--- /dev/null
+++ b/include/ug-dbg.h
@@ -0,0 +1,37 @@
+/*
+ * UI Gadget
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>
+ *
+ * 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 __UG_DBG_H__
+#define __UG_DBG_H__
+
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "UI_GADGET"
+
+#define _ERR(fmt, arg...) LOGE("\x1b[31m" fmt "\x1b[0m", ##arg)
+#define _DBG(fmt, arg...) LOGD("\x1b[32m" fmt "\x1b[0m", ##arg)
+#define _INFO(fmt, arg...) LOGI("\x1b[33m" fmt "\x1b[0m", ##arg)
+
+#endif /* __UG_DBG_H__ */
diff --git a/include/ug-engine.h b/include/ug-engine.h
new file mode 100644
index 0000000..22914ad
--- /dev/null
+++ b/include/ug-engine.h
@@ -0,0 +1,36 @@
+/*
+ * UI Gadget
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>
+ *
+ * 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 __UG_ENGINE_H__
+#define __UG_ENGINE_H__
+
+#include "ui-gadget-engine.h"
+
+struct ug_engine {
+ void *handle;
+ struct ug_engine_ops ops;
+};
+
+struct ug_engine *ug_engine_load(void);
+int ug_engine_unload(struct ug_engine *engine);
+
+
+#endif /* __UG_ENGINE_H__ */
diff --git a/include/ug-manager.h b/include/ug-manager.h
new file mode 100755
index 0000000..0589ac8
--- /dev/null
+++ b/include/ug-manager.h
@@ -0,0 +1,49 @@
+/*
+ * UI Gadget
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>
+ *
+ * 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 __UG_MANAGER_H__
+#define __UG_MANAGER_H__
+
+#include <utilX.h>
+#include "ug.h"
+
+int ugman_ug_add(ui_gadget_h parent, ui_gadget_h ug);
+ui_gadget_h ugman_ug_load(ui_gadget_h parent,
+ const char *name,
+ enum ug_mode mode,
+ service_h service,
+ struct ug_cbs *cbs);
+int ugman_ug_del(ui_gadget_h ug);
+int ugman_ug_del_all(void);
+
+int ugman_init(Display *disp, Window xid, void *win, enum ug_option opt);
+int ugman_resume(void);
+int ugman_pause(void);
+int ugman_send_event(enum ug_event event);
+int ugman_send_key_event(enum ug_key_event event);
+int ugman_send_message(ui_gadget_h ug, service_h msg);
+
+void *ugman_get_window(void);
+void *ugman_get_conformant(void);
+
+int ugman_ug_exist(ui_gadget_h ug);
+
+#endif /* __UG_MANAGER_H__ */
diff --git a/include/ug-module.h b/include/ug-module.h
new file mode 100644
index 0000000..a6fc459
--- /dev/null
+++ b/include/ug-module.h
@@ -0,0 +1,36 @@
+/*
+ * UI Gadget
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>
+ *
+ * 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 __UG_MODULE_H__
+#define __UG_MODULE_H__
+
+#include "ui-gadget-module.h"
+
+struct ug_module {
+ void *handle;
+ const char *module_name;
+ struct ug_module_ops ops;
+};
+
+struct ug_module *ug_module_load(const char *name);
+int ug_module_unload(struct ug_module *module);
+
+#endif /* __UG_MODULE_H__ */
diff --git a/include/ug.h b/include/ug.h
new file mode 100755
index 0000000..fe3be22
--- /dev/null
+++ b/include/ug.h
@@ -0,0 +1,76 @@
+/*
+ * UI Gadget
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>
+ *
+ * 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 __UG_H__
+#define __UG_H__
+
+#include <bundle.h>
+#include "ug-module.h"
+#include "ui-gadget.h"
+
+struct ug_child;
+
+enum ug_state {
+ UG_STATE_READY = 0x00,
+ UG_STATE_CREATED,
+ UG_STATE_RUNNING,
+ UG_STATE_STOPPED,
+ UG_STATE_DESTROYING,
+ UG_STATE_DESTROYED,
+ UG_STATE_INVALID,
+ UG_STATE_MAX
+};
+
+enum ug_layout_state {
+ UG_LAYOUT_INIT = 0x00,
+ UG_LAYOUT_SHOW,
+ UG_LAYOUT_SHOWEFFECT,
+ UG_LAYOUT_HIDE,
+ UG_LAYOUT_HIDEEFFECT,
+ UG_LAYOUT_DESTROY,
+ UG_LAYOUT_NOEFFECT,
+ UG_LAYOUT_MAX
+};
+
+struct ui_gadget_s {
+ const char *name;
+ void *layout;
+ enum ug_state state;
+ enum ug_mode mode;
+ enum ug_option opt;
+
+ ui_gadget_h parent;
+ void *children;
+
+ struct ug_module *module;
+ struct ug_cbs cbs;
+
+ service_h service;
+
+ int destroy_me:1;
+ enum ug_layout_state layout_state;
+ void *effect_layout;
+};
+
+ui_gadget_h ug_root_create(void);
+int ug_free(ui_gadget_h ug);
+
+#endif /* __UG_H__ */
diff --git a/include/ui-gadget-engine.h b/include/ui-gadget-engine.h
new file mode 100755
index 0000000..035bf20
--- /dev/null
+++ b/include/ui-gadget-engine.h
@@ -0,0 +1,69 @@
+/*
+ * UI Gadget
+ *
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+ *
+ * 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_GADGET_ENGINE_H__
+#define __UI_GADGET_ENGINE_H__
+
+/**
+ * @defgroup UI_Gadget_For_Developer Developer API Reference Guide
+ * @ingroup UI_Gadget
+ * @brief A engine to develop a UI gadget. Callees (UI gadgets) uses this engines and APIs. (callee -> caller)
+ *
+ * @section Header To Use Them:
+ * @code
+ * #include <ui-gadget-engine.h>
+ * @endcode
+ */
+
+/**
+ * @addtogroup UI_Gadget_For_Developer
+ * @{
+ */
+
+#include <bundle.h>
+#include "ui-gadget.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * UI gadget engine operation type
+ * @see @ref lifecycle_sec
+ */
+struct ug_engine_ops {
+ /** create operation */
+ void *(*create)(void *win, ui_gadget_h ug, void(*show_end_cb)(void *data));
+ /** destroy operation */
+ void (*destroy)(ui_gadget_h ug, ui_gadget_h fv_top, void(*hide_end_cb)(ui_gadget_h ug));
+ /** reserved operations */
+ void *reserved[4];
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+/**
+ * @}
+ */
+
+#endif /* __UI_GADGET_ENGINE_H__ */
diff --git a/include/ui-gadget-module.h b/include/ui-gadget-module.h
new file mode 100755
index 0000000..452827b
--- /dev/null
+++ b/include/ui-gadget-module.h
@@ -0,0 +1,169 @@
+/*
+ * UI Gadget
+ *
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+ *
+ * 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_GADGET_MODULE_H__
+#define __UI_GADGET_MODULE_H__
+
+/**
+ * @defgroup UI_Gadget_For_Developer Developer API Reference Guide
+ * @ingroup UI_Gadget
+ * @brief A module to develop a UI gadget. Callees (UI gadgets) uses this modules and APIs. (callee -> caller)
+ *
+ * @section Header To Use Them:
+ * @code
+ * #include <ui-gadget-module.h>
+ * @endcode
+ */
+
+/**
+ * @addtogroup UI_Gadget_For_Developer
+ * @{
+ */
+
+#include "ui-gadget.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * UI gadget module operation type
+ * @see @ref lifecycle_sec
+ */
+struct ug_module_ops {
+ /** create operation */
+ void *(*create) (ui_gadget_h ug, enum ug_mode mode, service_h service,
+ void *priv);
+ /** start operation */
+ void (*start) (ui_gadget_h ug, service_h service, void *priv);
+ /** pause operation */
+ void (*pause) (ui_gadget_h ug, service_h service, void *priv);
+ /** resume operation */
+ void (*resume) (ui_gadget_h ug, service_h service, void *priv);
+ /** destroy operation */
+ void (*destroy) (ui_gadget_h ug, service_h service, void *priv);
+ /** message operation */
+ void (*message) (ui_gadget_h ug, service_h msg, service_h service, void *priv);
+ /** event operation */
+ void (*event) (ui_gadget_h ug, enum ug_event event, service_h service,
+ void *priv);
+ /** key event operation */
+ void (*key_event) (ui_gadget_h ug, enum ug_key_event event,
+ service_h service, void *priv);
+ /** destroying operation */
+ void (*destroying) (ui_gadget_h ug, service_h service, void *priv);
+ /** reserved operations */
+ void *reserved[3];
+
+ /** private data */
+ void *priv;
+
+ /** option */
+ enum ug_option opt;
+};
+
+/**
+ * \par Description:
+ * This function makes a request that caller of the given UI gadget instance destroys the instance.
+ * It just makes a request, but not destroys UI gadget
+ *
+ * \par Purpose:
+ * This function is used for sending a request that caller of the given UI gadget instance destroys the instance.
+ *
+ * \par Typical use case:
+ * UI gadget developer who want to send a request that caller of the given UI gadget instance destroys the instance could use the function.
+ *
+ * \par Method of function operation:
+ * Destroy callback which is registered by caller with ug_create() is invoked.
+ *
+ * \par Context of function:
+ * This function supposed to be called in the created UI gadget.
+ *
+ * @param[in] ug the UI gadget
+ * @return 0 on success, -1 on error
+ *
+ * \pre None
+ * \post None
+ * \see None
+ * \remarks The API just makes a request, but not destroys UI gadget
+ *
+ * \par Sample code:
+ * \code
+ * #include <ui-gadget-module.h>
+ * ...
+ * // send a "destroy me" request
+ * ug_destroy_me(ug);
+ * ...
+ * \endcode
+ */
+int ug_destroy_me(ui_gadget_h ug);
+
+/**
+ * \par Description:
+ * This function sends result to caller of the given UI gadget instance.
+ *
+ * \par Purpose:
+ * This function is used for sending result to caller of the given UI gadget instance. The result have to be composed with service handle.
+ *
+ * \par Typical use case:
+ * UI gadget developer who want to send result to caller of the given UI gadget instance could use the function.
+ *
+ * \par Method of function operation:
+ * Result callback which is registered by caller with ug_create() is invoked.
+ *
+ * \par Context of function:
+ * This function supposed to be called in the created UI gadget.
+ *
+ * @param[in] ug the UI gadget
+ * @param[in] result the result, which is service type (see \ref service_PG "Tizen managed api reference guide")
+ * @return 0 on success, -1 on error
+ *
+ * \pre None
+ * \post None
+ * \see None
+ * \remarks After send your message, you have to release it using service_destroy()
+ *
+ * \par Sample code:
+ * \code
+ * #include <ui-gadget-module.h>
+ * ...
+ * // make a result with service
+ * service_h result;
+ * service_create(&result);
+ * service_add_extra_data(result, "Content", "Hello");
+ *
+ * // send the result
+ * ug_send_result(ug, result);
+ *
+ * // release the result
+ * service_destroy(result);
+ * ...
+ * \endcode
+ */
+int ug_send_result(ui_gadget_h ug, service_h result);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif /* __UI_GADGET_MODULE_H__ */
diff --git a/include/ui-gadget.h b/include/ui-gadget.h
new file mode 100755
index 0000000..0ebcc38
--- /dev/null
+++ b/include/ui-gadget.h
@@ -0,0 +1,750 @@
+/*
+ * UI Gadget
+ *
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+ *
+ * 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_GADGET_H__
+#define __UI_GADGET_H__
+
+/**
+ * @file ui-gadget.h
+ * @version 0.1
+ * @brief This file contains the public API of the UI gadget library
+ */
+
+/**
+ * @addtogroup APPLICATION_FRAMEWORK
+ * @{
+ *
+ * @defgroup UI_Gadget UI gadget library
+ * @version 0.1
+ * @brief A library to develop/use a UI gadget
+ */
+
+/**
+ * @addtogroup UI_Gadget
+ * @{
+ *
+ * @defgroup UI_Gadget_For_User User API Reference Guide
+ * @brief A module to use a UI gadget. Caller uses this module and APIs.
+ *
+ * @section Header To Use Them:
+ * @code
+ * #include <ui-gadget.h>
+ * @endcode
+ */
+
+/**
+ * @addtogroup UI_Gadget_For_User
+ * @{
+ */
+
+#include <X11/Xlib.h>
+#include <app.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * struct ui_gadget is an opaque type representing a UI gadget
+ * @see ug_create(), ug_destroy()
+ * @see ug_get_layout(), ug_get_parent_layout(), ug_get_mode()
+ */
+typedef struct ui_gadget_s *ui_gadget_h;
+
+/**
+ * UI gadget mode
+ * @see ug_create()
+ * @see ug_get_mode()
+ */
+enum ug_mode {
+ UG_MODE_FULLVIEW, /**< Fullview mode */
+ UG_MODE_FRAMEVIEW, /**< Frameview mode */
+ UG_MODE_INVALID, /**< Invalid mode */
+ UG_MODE_MAX
+};
+
+/**
+ * UI gadget event
+ * @see ug_send_event()
+ */
+enum ug_event {
+ UG_EVENT_NONE = 0x00, /**< No event */
+ UG_EVENT_LOW_MEMORY, /**< Low memory event */
+ UG_EVENT_LOW_BATTERY, /**< Low battery event */
+ UG_EVENT_LANG_CHANGE, /**< Language change event */
+ UG_EVENT_ROTATE_PORTRAIT, /**< Rotate event: Portrait */
+ UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN, /**< Rotate event: Portrait upsidedown */
+ UG_EVENT_ROTATE_LANDSCAPE, /**< Rotate event: Landscape */
+ UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN,
+ /**< Rotate event: Landscape upsidedown */
+ UG_EVENT_REGION_CHANGE, /**< Region change event */
+ UG_EVENT_MAX
+};
+
+/**
+ * UI gadget key event
+ * @see ug_send_key_event()
+ */
+enum ug_key_event {
+ UG_KEY_EVENT_NONE = 0x00, /**< No event */
+ UG_KEY_EVENT_END, /**< End key event */
+ UG_KEY_EVENT_MAX
+};
+
+/**
+ * UI gadget option
+ *
+ * @see ug_init()
+ */
+enum ug_option {
+ UG_OPT_INDICATOR_ENABLE = 0x00,
+ /**< Indicator option:
+ Enable with both portrait and landscape window */
+ UG_OPT_INDICATOR_PORTRAIT_ONLY = 0x01,
+ /**< Indicator option: Enable with portrait window */
+ UG_OPT_INDICATOR_LANDSCAPE_ONLY = 0x02,
+ /**< Indicator option: Enable with landscape window */
+ UG_OPT_INDICATOR_DISABLE = 0x03,
+ /**< Indicator option:
+ Disable with both portrait and landscape view window */
+ UG_OPT_INDICATOR_MANUAL = 0x04,
+ /**< Indicator option:
+ Indicator will be handled manually */
+ UG_OPT_OVERLAP_ENABLE = 0x08,
+ /**< Overlap option: Enable indicator overlap */
+ UG_OPT_MAX
+};
+
+#define GET_OPT_INDICATOR_VAL(opt) opt % UG_OPT_OVERLAP_ENABLE
+#define GET_OPT_OVERLAP_VAL(opt) opt & UG_OPT_OVERLAP_ENABLE
+
+/**
+ * UI gadget callback type
+ * @see ug_create()
+ */
+struct ug_cbs {
+ /** layout callback */
+ void (*layout_cb) (ui_gadget_h ug, enum ug_mode mode,
+ void *priv);
+ /** result callback */
+ void (*result_cb) (ui_gadget_h ug, service_h result, void *priv);
+ /** destroy callback */
+ void (*destroy_cb) (ui_gadget_h ug, void *priv);
+ /** private data */
+ void *priv;
+};
+
+/**
+ * Easy-to-use macro of ug_init() for EFL
+ * @see ug_init()
+ */
+#define UG_INIT_EFL(win, opt) \
+ ug_init((Display *)ecore_x_display_get(), elm_win_xwindow_get(win), \
+ win, opt)
+
+/**
+ * Easy-to-use macro of ug_init() for GTK
+ * @see ug_init()
+ */
+#define UG_INIT_GTK(win, opt) \
+ win ? ug_init(gdk_display_get_default(), win, \
+ GDK_WINDOW_XWINDOW(GTK_WIDGET(win)->window), win, opt) : -1
+
+/**
+ * \par Description:
+ * This function initializes default window, display, xwindow id, and indicator state.
+ *
+ * \par Purpose:
+ * First of all, to use UI gadgets in an application, default window to draw the UI gadgets has to be registered. Besides, to change indicator state for the full-view UI gadget, display and xwindow id have to be registered, and to restore application's indicator state, default indicator option has to be registered. This function is used for registering them.
+ *
+ * \par Typical use case:
+ * Application developers who want to use UI gadget MUST register display, xwindow id, default window, and option with the function at first.
+ *
+ * \par Method of function operation:
+ * Register display, xwindow id, default window, and option.
+ *
+ * \par Context of function:
+ * None
+ *
+ * \note If you are unfamiliar with display and xwindow id, please use following macros: UG_INIT_EFL, UG_INIT_GTK. The macros kindly generate proper functions to get display and xwindow id.
+ *
+ * @param[in] disp Default display
+ * @param[in] xid Default xwindow id of default window
+ * @param[in] win Default window object, it is void pointer for supporting both GTK (GtkWidget *) and EFL (Evas_Object *)
+ * @param[in] opt Default indicator state to restore application's indicator state
+ * @return 0 on success, -1 on error
+ *
+ * \pre None
+ * \post None
+ * \see UG_INIT_EFL(), UG_INIT_GTK()
+ * \remarks None
+ *
+ * \par Sample code:
+ * \code
+ * #include <ui-gadget.h>
+ * ...
+ * Evas_Object *win;
+ * ...
+ * // create window
+ * ...
+ * ug_init((Display *)ecore_x_display_get(), elm_win_xwindow_get(win), win, UG_OPT_INDICATOR_ENABLE);
+ * // for convenience you can use following macro: ELM_INIT_EFL(win, UG_OPT_INDICATOR_ENABLE);
+ * ...
+ * \endcode
+ */
+int ug_init(Display *disp, Window xid, void *win, enum ug_option opt);
+
+/**
+ * \par Description:
+ * This function creates a UI gadget
+ *
+ * \par Purpose:
+ * This function is used for creating a UI gadget instance. In addition, following callbacks could be registered with the function: layout callback, result callback, and destroy callback. (see struct ug_cbs)
+ *
+ * \par Typical use case:
+ * Anyone who want to create UI gadget could use the function.
+ *
+ * \par Method of function operation:
+ * First, the UI gadget with given name is dynamically loaded(dlopen). Next, state operations of loaded UI gadget are invoked according to its lifecycle. There are three callbacks which could be registered with the function: layout callback, result callback, and destroy callback. If the state is changed to "Create", the layout callback is invoked for layout arrangement. If ug_send_result() is invoked in the loaded UI gadget , the result callback is invoked. And, if ug_destroy_me() is invoked in the loaded UI gadget , the destroy callback is invoked.
+ *
+ * \par Context of function:
+ * This function supposed to be called after successful initialization with ug_init()
+ *
+ * @param[in] parent parent's UI gadget. If the UI gadget uses the function, the parent has to be the UI gadget. Otherwise, if an application uses the function, the parent has to be NULL
+ * @param[in] name name of UI gadget
+ * @param[in] mode mode of UI gadget (UG_MODE_FULLVIEW | UG_MODE_FRAMEVIEW)
+ * @param[in] service argument for the UI gadget (see \ref service_PG "Tizen managed api reference guide")
+ * @param[in] cbs callback functions (layout callback, result callback, destroy callback, see struct ug_cbs) and private data.
+ * @return The pointer of UI gadget, NULL on error
+ *
+ * \pre ug_init()
+ * \post None
+ * \see struct ug_cbs, enum ug_mode
+ * \remarks If you passed "service", you MUST release it using service_destroy() after ug_create()
+ *
+ * \par Sample code:
+ * \code
+ * #include <ui-gadget.h>
+ * ...
+ * service_h service;
+ * ui_gadget_h ug;
+ * struct ug_cbs cbs = {0, };
+ *
+ * // set callbacks: layout callback, result callback, destroy callback
+ * cbs.layout_cb = _layout_cb;
+ * cbs.result_cb = _result_cb;
+ * cbs.destroy_cb = _destroy_cb;
+ * cbs.priv = user_data;
+ *
+ * // create arguments
+ * service_create(&service);
+ * service_add_extra_data(service, "Content", "Hello");
+ *
+ * // create "helloUG-efl" UI gadget instance
+ * ug = ug_create(NULL, "helloUG-efl", UG_MODE_FULLVIEW, service, &cbs);
+ *
+ * // release arguments
+ * service_destroy(b);
+ * ...
+ * \endcode
+ */
+ui_gadget_h ug_create(ui_gadget_h parent, const char *name,
+ enum ug_mode mode, service_h service,
+ struct ug_cbs *cbs);
+
+/**
+ * \par Description:
+ * This function pauses all UI gadgets
+ *
+ * \par Purpose:
+ * This function is used for pausing UI gadgets with "Running" state. Eventually, state of the UI gadgets would be "Stopped."
+ *
+ * \par Typical use case:
+ * Application developers who want to pause loaded UI gadgets could use the function.
+ *
+ * \par Method of function operation:
+ * "Pause" state operations of UI gadgets with "Running" state in the UI gadget tree are invoked by post-order traversal.
+ *
+ * \par Context of function:
+ * This function supposed to be called after successful initialization with ug_init()
+ *
+ * @return 0 on success, -1 on error
+ *
+ * \pre ug_init()
+ * \post None
+ * \see ug_resume()
+ * \remarks None
+ *
+ * \par Sample code:
+ * \code
+ * #include <ui-gadget.h>
+ * ...
+ * // pause all UI gadget instances
+ * ug_pause();
+ * ...
+ * \endcode
+ */
+int ug_pause(void);
+
+/**
+ * \par Description:
+ * This function resumes all UI gadgets
+ *
+ * \par Purpose:
+ * This function is used for resuming UI gadgets with "Stopped" state. Eventually, state of all UI gadgets would be "Running."
+ *
+ * \par Typical use case:
+ * Application developers who want to resume loaded UI gadgets could use the function.
+ *
+ * \par Method of function operation:
+ * "Resume" state operations of UI gadgets with "Stopped" state in the UI gadget tree are invoked by post-order traversal.
+ *
+ * \par Context of function:
+ * This function supposed to be called after successful initialization with ug_init()
+ *
+ * @return 0 on success, -1 on error
+ *
+ * \pre ug_init()
+ * \post None
+ * \see ug_pause()
+ * \remarks None
+ *
+ * \par Sample code:
+ * \code
+ * #include <ui-gadget.h>
+ * ...
+ * // resume all UI gadget instances
+ * ug_resume();
+ * ...
+ * \endcode
+ */
+int ug_resume(void);
+
+/**
+ * \par Description:
+ * This function destroys the given UI gadget instance
+ *
+ * \par Purpose:
+ * This function is used for destroying given UI gadget instance and its children. Eventually, state of the instance would be "Destroyed."
+ *
+ * \par Typical use case:
+ * Anyone who want to destroy specific UI gadget could use the function.
+ *
+ * \par Method of function operation:
+ * "Destroy" state operations of the given UI gadget instance and its children are invoked.
+ *
+ * \par Context of function:
+ * This function supposed to be called after successful initialization with ug_init() and creation UI gadget with ug_create()
+ *
+ * @param[in] ug The UI gadget
+ * @return 0 on success, -1 on error
+ *
+ * \pre ug_init(), ug_create()
+ * \post None
+ * \see ug_destroy_all()
+ * \remarks None
+ *
+ * \par Sample code:
+ * \code
+ * #include <ui-gadget.h>
+ * ...
+ * // destroy UI gadget instance
+ * ug_destroy(ug);
+ * ...
+ * \endcode
+ */
+int ug_destroy(ui_gadget_h ug);
+
+/**
+ * \par Description:
+ * This function destroys all UI gadgets of an application
+ *
+ * \par Purpose:
+ * This function is used for destroying all UI gadgets. Eventually, state of all UI gadgets would be "Destroyed."
+ *
+ * \par Typical use case:
+ * Application developers who want to destroy loaded UI gadgets could use the function.
+ *
+ * \par Method of function operation:
+ * "Destroy" state operations of all UI gadgets in the UI gadget tree are invoked by post-order traversal.
+ *
+ * \par Context of function:
+ * This function supposed to be called after successful initialization with ug_init()
+ *
+ * @return 0 on success, -1 on error
+ *
+ * \pre ug_init()
+ * \post None
+ * \see ug_destroy()
+ * \remarks None
+ *
+ * \par Sample code:
+ * \code
+ * #include <ui-gadget.h>
+ * ...
+ * // destroy all UI gadget instances
+ * ug_destroy_all();
+ * ...
+ * \endcode
+ */
+int ug_destroy_all(void);
+
+/**
+ * \par Description:
+ * This function gets base layout of the given UI gadget instance
+ *
+ * \par Purpose:
+ * This function is used for getting base layout pointer of given UI gadget instance.
+ *
+ * \par Typical use case:
+ * Anyone who want to get base layout of UI gadget could use the function.
+ *
+ * \par Method of function operation:
+ * This function returns base layout pointer which is created in "Create" operation of the given UI gadget instance.
+ *
+ * \par Context of function:
+ * This function supposed to be called after successful initialization with ug_init() and creation UI gadget with ug_create()
+ *
+ * @param[in] ug The UI gadget
+ * @return The pointer of base layout, NULL on error. The result value is void pointer for supporting both GTK (GtkWidget *) and EFL (Evas_Object *)
+ *
+ * \pre ug_init(), ug_create()
+ * \post None
+ * \see ug_get_parent_layout()
+ * \remarks None
+ *
+ * \par Sample code:
+ * \code
+ * #include <ui-gadget.h>
+ * ...
+ * Evas_Object *ly;
+ * // get a base layout
+ * ly = (Evas_Object *)ug_get_layout(ug);
+ * ...
+ * \endcode
+ */
+void *ug_get_layout(ui_gadget_h ug);
+
+/**
+ * \par Description:
+ * This function gets base layout of parent of the given UI gadget instance
+ *
+ * \par Purpose:
+ * This function is used for getting base layout pointer of parent of the given UI gadget instance.
+ *
+ * \par Typical use case:
+ * Anyone who want to get base layout of UI gadget's parent could use the function.
+ *
+ * \par Method of function operation:
+ * This function returns base layout pointer which is created in "Create" operation of parent of the given UI gadget instance.
+ *
+ * \par Context of function:
+ * This function supposed to be called after successful initialization with ug_init() and creation UI gadget with ug_create()
+ *
+ * @param[in] ug The UI gadget
+ * @return The pointer of base layout, NULL on error. The result value is void pointer for supporting both GTK (GtkWidget *) and EFL (Evas_Object *)
+ *
+ * \pre ug_init(), ug_create()
+ * \post None
+ * \see ug_get_layout()
+ * \remarks None
+ *
+ * \par Sample code:
+ * \code
+ * #include <ui-gadget.h>
+ * ...
+ * Evas_Object *ly;
+ * // get a base layout of parent of the given UI gadget instance
+ * ly = (Evas_Object *)ug_get_parent_layout(ug);
+ * ...
+ * \endcode
+ */
+void *ug_get_parent_layout(ui_gadget_h ug);
+
+/**
+ * \par Description:
+ * This function gets default window
+ *
+ * \par Purpose:
+ * This function is used for getting default window which is registered with ug_init()
+ *
+ * \par Typical use case:
+ * Anyone who want to get default window could use the function.
+ *
+ * \par Method of function operation:
+ * This function returns default window pointer which is registered with ug_init()
+ *
+ * \par Context of function:
+ * This function supposed to be called after successful initialization with ug_init()
+ *
+ * @return The pointer of default window, NULL on error. The result value is void pointer for supporting both GTK (GtkWidget *) and EFL (Evas_Object *)
+ *
+ * \pre ug_init()
+ * \post None
+ * \see None
+ * \remarks None
+ *
+ * \par Sample code:
+ * \code
+ * #include <ui-gadget.h>
+ * ...
+ * Evas_Object *win;
+ * // get default window
+ * win = (Evas_Object *)ug_get_window();
+ * ...
+ * \endcode
+ */
+void *ug_get_window(void);
+
+/**
+ * \par Description:
+ * This function gets ug conformant
+ *
+ * \par Purpose:
+ * This function is used for getting ug conformant
+ *
+ * \par Typical use case:
+ * Anyone who want to get ug conformant could use the function.
+ *
+ * \par Method of function operation:
+ * This function returns ug conformant pointer
+ *
+ * \par Context of function:
+ * This function supposed to be called after successful initialization with ug_init()
+ *
+ * @return The pointer of default window, NULL on error. The result value is void pointer for supporting both GTK (GtkWidget *) and EFL (Evas_Object *)
+ *
+ * \pre ug_init()
+ * \post None
+ * \see None
+ * \remarks None
+ *
+ * \par Sample code:
+ * \code
+ * #include <ui-gadget.h>
+ * ...
+ * Evas_Object *conform;
+ * // get default window
+ * conform = (Evas_Object *)ug_get_conformant();
+ * ...
+ * \endcode
+ */
+void *ug_get_conformant(void);
+
+/**
+ * \par Description:
+ * This function gets mode of the given UI gadget instance
+ *
+ * \par Purpose:
+ * This function is used for getting mode of the given UI gadget instance. Mode could be UG_MODE_FULLVIEW or UG_MODE_FRAMEVIEW.
+ *
+ * \par Typical use case:
+ * Anyone who want to get mode of UI gadget could use the function.
+ *
+ * \par Method of function operation:
+ * This function returns mode which is registered with ug_create()
+ *
+ * \par Context of function:
+ * This function supposed to be called after successful initialization with ug_init() and creation UI gadget with ug_create()
+ *
+ * @param[in] ug The UI gadget
+ * @return UI gadget mode of the given UI gadget instance (UG_MODE_FULLVIEW | UG_MODE_FRAMEVIEW)
+ *
+ * \pre ug_init(), ug_create()
+ * \post None
+ * \see enum ug_mode
+ * \remarks None
+ *
+ * \par Sample code:
+ * \code
+ * #include <ui-gadget.h>
+ * ...
+ * enum ug_mode mode;
+ * // get mode (UG_MODE_FULLVIEW | UG_MODE_FRAMEVIEW)
+ * mode = ug_get_mode(ug);
+ * ...
+ * \endcode
+ */
+enum ug_mode ug_get_mode(ui_gadget_h ug);
+
+/**
+ * \par Description:
+ * This function propagates the given system event to all UI gadgets
+ *
+ * \par Purpose:
+ * This function is used for propagating the given system event. Available system events are low memory, low battery, language changed, and window rotate event.
+ *
+ * \par Typical use case:
+ * Application developers who want to propagate system event to all UI gadgets could use the function.
+ *
+ * \par Method of function operation:
+ * Event operations of all UI gadgets in the UI gadget tree are invoked by post-order traversal.
+ *
+ * \par Context of function:
+ * This function supposed to be called after successful initialization with ug_init()
+ *
+ * @param[in] event UI gadget event. (see enum ug_event)
+ * @return 0 on success, -1 on error
+ *
+ * \pre ug_init()
+ * \post None
+ * \see enum ug_event
+ * \remarks None
+ *
+ * \par Sample code:
+ * \code
+ * #include <ui-gadget.h>
+ * ...
+ * // propagate low battery event to all UI gadget instances
+ * ug_send_event(UG_EVENT_LOW_BATTERY);
+ * ...
+ * \endcode
+ */
+int ug_send_event(enum ug_event event);
+
+/**
+ * \par Description:
+ * This function send key event to full view top UI gadget
+ *
+ * \par Purpose:
+ * This function is used for sending key event to full view top UI gadget. Available key events are end event.
+ *
+ * \par Typical use case:
+ * Application developers who want to send key event to full view top UI gadget could use the function.
+ *
+ * \par Method of function operation:
+ * Key event operation of full view top UI gadget in the UI gadget tree are invoked.
+ *
+ * \par Context of function:
+ * This function supposed to be called after successful initialization with ug_init()
+ *
+ * @param[in] event UI gadget key event. (see enum ug_key_event)
+ * @return 0 on success, -1 on error
+ *
+ * \pre ug_init()
+ * \post None
+ * \see enum ug_key_event
+ * \remarks None
+ *
+ * \par Sample code:
+ * \code
+ * #include <ui-gadget.h>
+ * ...
+ * // send key event callback to full view top UI gadget instances
+ * ug_send_key_event(UG_KEY_EVENT_END);
+ * ...
+ * \endcode
+ */
+int ug_send_key_event(enum ug_key_event event);
+
+/**
+ * \par Description:
+ * This function sends message to the given UI gadget instance
+ *
+ * \par Purpose:
+ * This function is used for sending message to created UI gadget. The message have to be composed with service handle.
+ *
+ * \par Typical use case:
+ * Anyone who want to send message to created UI gadget.
+ *
+ * \par Method of function operation:
+ * Message operation of given UI gadget instance is invoked.
+ *
+ * \par Context of function:
+ * This function supposed to be called after successful initialization with ug_init() and creation UI gadget with ug_create()
+ *
+ * @param[in] ug The UI gadget
+ * @param[in] msg message to send, which is service type (see \ref service_PG "Tizen managed api reference guide")
+ * @return 0 on success, -1 on error
+ *
+ * \pre ug_init(), ug_create()
+ * \post None
+ * \see None
+ * \remarks After send your message, you have to release it using service_destroy()
+ *
+ * \par Sample code:
+ * \code
+ * #include <ui-gadget.h>
+ * ...
+ * // make a message with service
+ * service_h msg;
+ * service_create(&msg)
+ * service_add_extra_data(msg, "Content", "Hello");
+ *
+ * // send the message
+ * ug_send_message(ug, msg);
+ *
+ * // release the message
+ * service_destroy(msg);
+ * ...
+ * \endcode
+ */
+int ug_send_message(ui_gadget_h ug, service_h msg);
+
+/**
+ * \par Description:
+ * This function disable transition effect of the given UI gadget instance
+ *
+ * \par Purpose:
+ * This function is used for disabling transition effect of created UI gadget.
+ *
+ * \par Typical use case:
+ * Anyone who want to disable transition effect of created UI gadget.
+ *
+ * \par Method of function operation:
+ * No transition effect of given UI gadget is invoked
+ *
+ * \par Context of function:
+ * This function supposed to be called after successful initialization with ug_init() and creation UI gadget with ug_create()
+ *
+ * @param[in] ug The UI gadget
+ * @return 0 on success, -1 on error
+ *
+ * \pre ug_init(), ug_create()
+ * \post None
+ * \see None
+ * \remarks Before show layout of given UI gadget, ug_disable_effect() should be called.
+ *
+ * \par Sample code:
+ * \code
+ * #include <ui-gadget.h>
+ * ...
+ * static void layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv)
+ * {
+ * ...
+ * base = ug_get_layout(ug);
+ * switch (mode) {
+ * case UG_MODE_FULLVIEW:
+ * // disable effect
+ * ug_disable_effect(ug);
+ * evas_object_show(base);
+ * ...
+ * \endcode
+ */
+int ug_disable_effect(ui_gadget_h ug);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @} @} @}
+ */
+#endif /* __UI_GADGET_H__ */
diff --git a/packaging/ui-gadget-1.spec b/packaging/ui-gadget-1.spec
new file mode 100755
index 0000000..dac7f3d
--- /dev/null
+++ b/packaging/ui-gadget-1.spec
@@ -0,0 +1,66 @@
+
+Name: ui-gadget-1
+Summary: UI Gadget Library
+Version: 0.1.16
+Release: 1
+Group: System/Libraries
+License: Apache License, Version 2.0
+Source0: %{name}-%{version}.tar.gz
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+BuildRequires: pkgconfig(utilX)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(appcore-efl)
+BuildRequires: pkgconfig(bundle)
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(x11)
+BuildRequires: pkgconfig(appsvc)
+BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: pkgconfig(capi-system-runtime-info)
+BuildRequires: pkgconfig(capi-appfw-app-manager)
+BuildRequires: cmake
+BuildRequires: edje-bin
+
+%description
+UI gadget library (development headers)
+
+%package devel
+Summary: Development files for %{name}
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+%description devel
+Development files for %{name}
+
+%prep
+%setup -q
+
+%build
+cmake . -DCMAKE_INSTALL_PREFIX=/usr
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+%post
+/sbin/ldconfig
+ln -sf /usr/bin/ug-client /usr/bin/ug-launcher
+
+%postun -p /sbin/ldconfig
+
+%files
+%manifest ui-gadget-1.manifest
+%defattr(-,root,root,-)
+%{_libdir}/*.so.*
+%{_libdir}/lib%{name}-efl-engine.so
+/usr/share/edje/ug_effect.edj
+%{_bindir}/ug-client
+/usr/share/edje/ug-client/*.edj
+
+%files devel
+%defattr(-,root,root,-)
+%{_includedir}/ug-1/*.h
+%{_libdir}/libui-gadget-1.so
+%{_libdir}/pkgconfig/%{name}.pc
+
diff --git a/src/engine.c b/src/engine.c
new file mode 100755
index 0000000..3dcdb11
--- /dev/null
+++ b/src/engine.c
@@ -0,0 +1,128 @@
+/*
+ * UI Gadget
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>
+ *
+ * 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 <linux/limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <dlfcn.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+#include "ug-engine.h"
+#include "ug-dbg.h"
+
+#define UG_ENGINE_INIT_SYM "UG_ENGINE_INIT"
+#define UG_ENGINE_EXIT_SYM "UG_ENGINE_EXIT"
+
+enum ug_engine_type {
+ UG_ENGINE_EFL = 0x00,
+};
+
+static int file_exist(const char *filename)
+{
+ FILE *file;
+
+ file = fopen(filename, "r");
+ if (file)
+ {
+ fclose(file);
+ return 0;
+ }
+ return -1;
+}
+
+struct ug_engine *ug_engine_load()
+{
+ void *handle;
+ struct ug_engine *engine;
+ char engine_file[PATH_MAX];
+ enum ug_engine_type type = UG_ENGINE_EFL;
+ int (*engine_init)(struct ug_engine_ops *ops);
+
+ engine = calloc(1, sizeof(struct ug_engine));
+
+ if (!engine) {
+ errno = ENOMEM;
+ return NULL;
+ }
+
+ if (type == UG_ENGINE_EFL) { /* UG_ENGINE_EFL is default*/
+ if (snprintf(engine_file, PATH_MAX, "/usr/lib/libui-gadget-1-efl-engine.so") < 0){
+ goto engine_free;
+ }
+ else if (file_exist(engine_file) < 0) {
+ goto engine_free;
+ }
+ }
+ else
+ goto engine_free;
+
+ handle = dlopen(engine_file, RTLD_LAZY);
+ if (!handle) {
+ _ERR("dlopen failed: %s", dlerror());
+ goto engine_free;
+ }
+
+ engine_init = dlsym(handle, UG_ENGINE_INIT_SYM);
+ if (!engine_init) {
+ _ERR("dlsym failed: %s", dlerror());
+ goto engine_dlclose;
+ }
+
+ if (engine_init(&engine->ops))
+ goto engine_dlclose;
+
+ engine->handle = handle;
+ return engine;
+
+engine_dlclose:
+ dlclose(handle);
+
+engine_free:
+ free(engine);
+ return NULL;
+}
+
+int ug_engine_unload(struct ug_engine *engine)
+{
+ void (*engine_exit)(struct ug_engine_ops *ops);
+
+ if (!engine) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (engine->handle) {
+ engine_exit = dlsym(engine->handle, UG_ENGINE_EXIT_SYM);
+ if (engine_exit)
+ engine_exit(&engine->ops);
+ else
+ _ERR("dlsym failed: %s", dlerror());
+
+ dlclose(engine->handle);
+ }
+
+ free(engine);
+ engine = NULL;
+ return 0;
+}
diff --git a/src/manager.c b/src/manager.c
new file mode 100755
index 0000000..36cccb5
--- /dev/null
+++ b/src/manager.c
@@ -0,0 +1,848 @@
+/*
+ * UI Gadget
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>
+ *
+ * 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 <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <glib.h>
+#include <utilX.h>
+
+#include <Elementary.h>
+#include <Ecore.h>
+
+#include "ug.h"
+#include "ug-manager.h"
+#include "ug-engine.h"
+#include "ug-dbg.h"
+
+struct ug_manager {
+ ui_gadget_h root;
+ ui_gadget_h fv_top;
+ GSList *fv_list;
+
+ void *win;
+ Window win_id;
+ Display *disp;
+ void *conform;
+
+ enum ug_option base_opt;
+ enum ug_event last_rotate_evt;
+
+ int walking;
+
+ int is_initted:1;
+ int is_landscape:1;
+ int destroy_all:1;
+
+ struct ug_engine *engine;
+};
+
+static struct ug_manager ug_man;
+
+static inline void job_start(void);
+static inline void job_end(void);
+
+static int ug_relation_add(ui_gadget_h p, ui_gadget_h c)
+{
+ c->parent = p;
+ /* prepend element to avoid the inefficiency,
+ which is to traverse the entire list to find the end*/
+ p->children = g_slist_prepend(p->children, c);
+
+ return 0;
+}
+
+static int ug_relation_del(ui_gadget_h ug)
+{
+ ui_gadget_h p;
+
+ p = ug->parent;
+ if (!p) {
+ _ERR("ug_relation_del failed: no parent");
+ return -1;
+ }
+ p->children = g_slist_remove(p->children, ug);
+ if (ug->children)
+ g_slist_free(ug->children);
+ ug->parent = NULL;
+
+ return 0;
+}
+
+static int ug_fvlist_add(ui_gadget_h c)
+{
+ ug_man.fv_list = g_slist_prepend(ug_man.fv_list, c);
+ ug_man.fv_top = c;
+
+ return 0;
+}
+
+static int ug_fvlist_del(ui_gadget_h c)
+{
+ ui_gadget_h t;
+
+ ug_man.fv_list = g_slist_remove(ug_man.fv_list, c);
+
+ /* update fullview top ug*/
+ t = g_slist_nth_data(ug_man.fv_list, 0);
+ ug_man.fv_top = t;
+
+ return 0;
+}
+
+static void ugman_tree_dump(ui_gadget_h ug)
+{
+ static int i;
+ int lv;
+ const char *name;
+ GSList *child;
+ ui_gadget_h c;
+
+ if (!ug)
+ return;
+
+ name = ug->name;
+ if (ug == ug_man.root) {
+ i = 0;
+ _DBG("============== TREE_DUMP =============");
+ _DBG("ROOT: Manager");
+ name = "Manager";
+ }
+
+ child = ug->children;
+ if (!child)
+ return;
+
+ i++;
+ lv = i;
+
+ while (child) {
+ c = child->data;
+ _DBG("[%d] %s [%c] (%p) (PARENT: %s)",
+ lv,
+ c && c->name ? c->name : "NO CHILD INFO FIXIT!!!",
+ c && c->mode == UG_MODE_FULLVIEW ? 'F' : 'f', c, name);
+ ugman_tree_dump(c);
+ child = g_slist_next(child);
+ }
+}
+
+static int ugman_ug_find(ui_gadget_h p, ui_gadget_h ug)
+{
+ GSList *child = NULL;
+
+ if (!p || !ug)
+ return 0;
+ child = p->children;
+
+ while (child) {
+ if (child->data == ug)
+ return 1;
+ if (ugman_ug_find(child->data, ug))
+ return 1;
+ child = g_slist_next(child);
+ }
+
+ return 0;
+}
+
+static int ugman_ug_start(void *data)
+{
+ ui_gadget_h ug = data;
+ struct ug_module_ops *ops = NULL;
+
+ if (!ug || ug->state != UG_STATE_CREATED
+ || ug->state == UG_STATE_RUNNING)
+ return 0;
+
+ _DBG("ug=%p", ug);
+
+ ug->state = UG_STATE_RUNNING;
+
+ if (ug->module)
+ ops = &ug->module->ops;
+
+ if (ops && ops->start)
+ ops->start(ug, ug->service, ops->priv);
+
+ return 0;
+}
+
+static int ugman_ug_pause(void *data)
+{
+ ui_gadget_h ug = data;
+ struct ug_module_ops *ops = NULL;
+ GSList *child = NULL;
+
+ job_start();
+
+ if (!ug || ug->state != UG_STATE_RUNNING)
+ goto end;
+
+ ug->state = UG_STATE_STOPPED;
+
+ if (ug->children) {
+ child = ug->children;
+ while (child) {
+ ugman_ug_pause(child->data);
+ child = g_slist_next(child);
+ }
+ }
+
+ if (ug->module)
+ ops = &ug->module->ops;
+
+ if (ops && ops->pause)
+ ops->pause(ug, ug->service, ops->priv);
+
+ end:
+ job_end();
+ return 0;
+}
+
+static int ugman_ug_resume(void *data)
+{
+ ui_gadget_h ug = data;
+ struct ug_module_ops *ops = NULL;
+ GSList *child = NULL;
+
+ job_start();
+
+ if (!ug)
+ goto end;
+
+ switch (ug->state) {
+ case UG_STATE_CREATED:
+ ugman_ug_start(ug);
+ goto end;
+ case UG_STATE_STOPPED:
+ break;
+ default:
+ goto end;
+ }
+
+ ug->state = UG_STATE_RUNNING;
+
+ if (ug->children) {
+ child = ug->children;
+ while (child) {
+ ugman_ug_resume(child->data);
+ child = g_slist_next(child);
+ }
+ }
+
+ if (ug->module)
+ ops = &ug->module->ops;
+
+ if (ops && ops->resume)
+ ops->resume(ug, ug->service, ops->priv);
+
+ end:
+ job_end();
+ return 0;
+}
+
+static int ugman_indicator_overlap_update(enum ug_option opt)
+{
+ if (!ug_man.win) {
+ _ERR("indicator update failed: no window");
+ return -1;
+ }
+
+ if(GET_OPT_OVERLAP_VAL(opt)) {
+ _DBG("update overlap indicator / opt(%d)", opt);
+ elm_object_signal_emit(ug_man.conform, "elm,state,indicator,overlap", "");
+ } else {
+ _DBG("update no overlap indicator / opt(%d)", opt);
+ elm_object_signal_emit(ug_man.conform, "elm,state,indicator,nooverlap", "");
+ }
+
+ return 0;
+}
+
+static int ugman_indicator_update(enum ug_option opt, enum ug_event event)
+{
+ int enable;
+ int cur_state;
+
+ switch (GET_OPT_INDICATOR_VAL(opt)) {
+ case UG_OPT_INDICATOR_ENABLE:
+ if (event == UG_EVENT_NONE)
+ enable = 1;
+ else {
+ cur_state = utilx_get_indicator_state(ug_man.disp, ug_man.win_id);
+ enable = cur_state ? 1 : 0;
+ }
+ break;
+ case UG_OPT_INDICATOR_PORTRAIT_ONLY:
+ enable = ug_man.is_landscape ? 0 : 1;
+ break;
+ case UG_OPT_INDICATOR_LANDSCAPE_ONLY:
+ enable = ug_man.is_landscape ? 1 : 0;
+ break;
+ case UG_OPT_INDICATOR_DISABLE:
+ enable = 0;
+ break;
+ case UG_OPT_INDICATOR_MANUAL:
+ return 0;
+ default:
+ _ERR("update failed: Invalid opt(%d)", opt);
+ return -1;
+ }
+
+ utilx_enable_indicator(ug_man.disp, ug_man.win_id, enable);
+
+ return 0;
+}
+
+static int ugman_ug_getopt(ui_gadget_h ug)
+{
+ if (!ug)
+ return -1;
+
+ /* Indicator Option */
+ if (ug->mode == UG_MODE_FULLVIEW) {
+ ugman_indicator_overlap_update(ug->opt);
+ ugman_indicator_update(ug->opt, UG_EVENT_NONE);
+ }
+
+ return 0;
+}
+
+static int ugman_ug_event(ui_gadget_h ug, enum ug_event event)
+{
+ struct ug_module_ops *ops = NULL;
+ GSList *child = NULL;
+
+ if (!ug)
+ return 0;
+
+ if (ug->children) {
+ child = ug->children;
+ while (child) {
+ ugman_ug_event(child->data, event);
+ child = g_slist_next(child);
+ }
+ }
+
+ if (ug->module)
+ ops = &ug->module->ops;
+
+ if (ops && ops->event)
+ ops->event(ug, event, ug->service, ops->priv);
+
+ return 0;
+}
+
+static int ugman_ug_destroy(void *data)
+{
+ ui_gadget_h ug = data;
+ struct ug_module_ops *ops = NULL;
+ GSList *child, *trail;
+
+ job_start();
+
+ if (!ug)
+ goto end;
+
+ _DBG("ugman_ug_destroy start ug(%p)", ug);
+
+ switch (ug->state) {
+ case UG_STATE_CREATED:
+ case UG_STATE_RUNNING:
+ case UG_STATE_STOPPED:
+ case UG_STATE_DESTROYING:
+ break;
+ default:
+ goto end;
+ }
+
+ ug->state = UG_STATE_DESTROYED;
+
+ if (ug->module)
+ ops = &ug->module->ops;
+
+ if (ug->children) {
+ child = ug->children;
+ while (child) {
+ trail = g_slist_next(child);
+ ugman_ug_destroy(child->data);
+ child = trail;
+ }
+ }
+
+ if (ops && ops->destroy) {
+ _DBG("ug module destory cb call");
+ ops->destroy(ug, ug->service, ops->priv);
+ }
+
+ ug_relation_del(ug);
+
+ if (ug->mode == UG_MODE_FULLVIEW) {
+ if (ug_man.fv_top == ug) {
+ ug_fvlist_del(ug);
+ ugman_ug_getopt(ug_man.fv_top);
+ } else {
+ ug_fvlist_del(ug);
+ }
+ }
+
+ ug_free(ug);
+
+ if (ug_man.root == ug)
+ ug_man.root = NULL;
+
+ ugman_tree_dump(ug_man.root);
+ end:
+ job_end();
+
+ return 0;
+}
+
+static void ug_hide_end_cb(ui_gadget_h ug)
+{
+ ecore_idler_add(ugman_ug_destroy, ug);
+}
+
+static int ugman_ug_create(void *data)
+{
+ ui_gadget_h ug = data;
+ struct ug_module_ops *ops = NULL;
+ struct ug_cbs *cbs;
+ struct ug_engine_ops *eng_ops = NULL;
+
+ if (!ug || ug->state != UG_STATE_READY)
+ return -1;
+
+ ug->state = UG_STATE_CREATED;
+
+ if (ug->module)
+ ops = &ug->module->ops;
+
+ if (ug_man.engine)
+ eng_ops = &ug_man.engine->ops;
+
+ if (ops && ops->create) {
+ ug->layout = ops->create(ug, ug->mode, ug->service, ops->priv);
+ if (!ug->layout) {
+ ug_relation_del(ug);
+ return -1;
+ }
+ if (ug->mode == UG_MODE_FULLVIEW) {
+ if (eng_ops && eng_ops->create) {
+ //change start cb function call after transition,finished for fullview
+ ug_man.conform = eng_ops->create(ug_man.win, ug, ugman_ug_start);
+ }
+ }
+ cbs = &ug->cbs;
+
+ if (cbs && cbs->layout_cb)
+ cbs->layout_cb(ug, ug->mode, cbs->priv);
+
+ ugman_ug_getopt(ug);
+ }
+
+ ugman_ug_event(ug, ug_man.last_rotate_evt);
+
+ if(ug->mode == UG_MODE_FRAMEVIEW)
+ ugman_ug_start(ug);
+
+ ugman_tree_dump(ug_man.root);
+
+ return 0;
+}
+
+int ugman_ug_add(ui_gadget_h parent, ui_gadget_h ug)
+{
+ if (!ug_man.is_initted) {
+ _ERR("ugman_ug_add failed: manager is not initted");
+ return -1;
+ }
+
+ if (!ug_man.root) {
+ if (parent) {
+ _ERR("ugman_ug_add failed: parent has to be NULL w/o root");
+ errno = EINVAL;
+ return -1;
+ }
+
+ ug_man.root = ug_root_create();
+ if (!ug_man.root)
+ return -1;
+ ug_man.root->opt = ug_man.base_opt;
+ ug_man.root->layout = ug_man.win;
+ ug_fvlist_add(ug_man.root);
+ }
+
+ if (!parent)
+ parent = ug_man.root;
+
+ if (ug_relation_add(parent, ug))
+ return -1;
+
+ if (ugman_ug_create(ug) == -1)
+ return -1;
+
+ if (ug->mode == UG_MODE_FULLVIEW)
+ ug_fvlist_add(ug);
+
+ return 0;
+}
+
+ui_gadget_h ugman_ug_load(ui_gadget_h parent,
+ const char *name,
+ enum ug_mode mode,
+ service_h service, struct ug_cbs *cbs)
+{
+ int r;
+ ui_gadget_h ug;
+
+ ug = calloc(1, sizeof(struct ui_gadget_s));
+ if (!ug) {
+ _ERR("ug_create() failed: Memory allocation failed");
+ return NULL;
+ }
+
+ ug->module = ug_module_load(name);
+ if (!ug->module) {
+ _ERR("ug_create() failed: Module loading failed");
+ goto load_fail;
+ }
+
+ ug->name = strdup(name);
+
+ ug->mode = mode;
+ service_clone(&ug->service, service);
+ ug->opt = ug->module->ops.opt;
+ ug->state = UG_STATE_READY;
+ ug->children = NULL;
+
+ if (cbs)
+ memcpy(&ug->cbs, cbs, sizeof(struct ug_cbs));
+
+ r = ugman_ug_add(parent, ug);
+ if (r) {
+ _ERR("ug_create() failed: Tree update failed");
+ goto load_fail;
+ }
+
+ return ug;
+
+ load_fail:
+ ug_free(ug);
+ return NULL;
+}
+
+int ugman_ug_destroying(ui_gadget_h ug)
+{
+ struct ug_module_ops *ops = NULL;
+ GSList *child, *trail;
+
+ ug->destroy_me = 1;
+ ug->state = UG_STATE_DESTROYING;
+
+ if (ug->module)
+ ops = &ug->module->ops;
+
+ if (ug->children) {
+ child = ug->children;
+ while (child) {
+ trail = g_slist_next(child);
+ ugman_ug_destroying(child->data);
+ child = trail;
+ }
+ }
+
+ if (ops && ops->destroying)
+ ops->destroying(ug, ug->service, ops->priv);
+
+ return 0;
+}
+
+int ugman_ug_del(ui_gadget_h ug)
+{
+ struct ug_engine_ops *eng_ops = NULL;
+
+ if (!ug || !ugman_ug_exist(ug) || ug->state == UG_STATE_DESTROYED) {
+ _ERR("ugman_ug_del failed: Invalid ug");
+ errno = EINVAL;
+ return -1;
+ }
+
+ _DBG("ugman_ug_del start ug(%p)", ug);
+
+ if (ug->destroy_me) {
+ _ERR("ugman_ug_del failed: ug is alreay on destroying");
+ return -1;
+ }
+
+ if (!ug_man.is_initted) {
+ _ERR("ugman_ug_del failed: manager is not initted");
+ return -1;
+ }
+
+ if (!ug_man.root) {
+ _ERR("ugman_ug_del failed: no root");
+ return -1;
+ }
+
+ ugman_ug_destroying(ug);
+
+ /* pre call for indicator update time issue */
+ if (ug_man.fv_top == ug) {
+ ui_gadget_h t;
+ t = g_slist_nth_data(ug_man.fv_list, 1);
+ ugman_ug_getopt(t);
+ }
+
+ if (ug_man.engine)
+ eng_ops = &ug_man.engine->ops;
+
+ if (eng_ops && eng_ops->destroy)
+ if (ug->mode == UG_MODE_FULLVIEW)
+ eng_ops->destroy(ug, ug_man.fv_top, ug_hide_end_cb);
+ else {
+ eng_ops->destroy(ug, NULL, ug_hide_end_cb);
+ }
+ else
+ ecore_idler_add(ugman_ug_destroy, ug);
+
+ return 0;
+}
+
+int ugman_ug_del_all(void)
+{
+ /* Terminate */
+ if (!ug_man.is_initted) {
+ _ERR("ugman_ug_del_all failed: manager is not initted");
+ return -1;
+ }
+
+ if (!ug_man.root) {
+ _ERR("ugman_ug_del_all failed: no root");
+ return -1;
+ }
+
+ if (ug_man.walking > 0)
+ ug_man.destroy_all = 1;
+ else
+ ugman_ug_destroy(ug_man.root);
+
+ return 0;
+}
+
+int ugman_init(Display *disp, Window xid, void *win, enum ug_option opt)
+{
+ ug_man.is_initted = 1;
+ ug_man.win = win;
+ ug_man.disp = disp;
+ ug_man.win_id = xid;
+ ug_man.base_opt = opt;
+ ug_man.last_rotate_evt = UG_EVENT_ROTATE_PORTRAIT;
+ ug_man.engine = ug_engine_load();
+
+ return 0;
+}
+
+int ugman_resume(void)
+{
+ /* RESUME */
+ if (!ug_man.is_initted) {
+ _ERR("ugman_resume failed: manager is not initted");
+ return -1;
+ }
+
+ if (!ug_man.root) {
+ _ERR("ugman_resume failed: no root");
+ return -1;
+ }
+
+ ecore_idler_add(ugman_ug_resume, ug_man.root);
+
+ return 0;
+}
+
+int ugman_pause(void)
+{
+ /* PAUSE (Background) */
+ if (!ug_man.is_initted) {
+ _ERR("ugman_pause failed: manager is not initted");
+ return -1;
+ }
+
+ if (!ug_man.root) {
+ _ERR("ugman_pause failed: no root");
+ return -1;
+ }
+
+ ecore_idler_add(ugman_ug_pause, ug_man.root);
+
+ return 0;
+}
+
+static int ugman_send_event_pre(void *data)
+{
+ job_start();
+
+ ugman_ug_event(ug_man.root, (enum ug_event)data);
+
+ job_end();
+
+ return 0;
+}
+
+int ugman_send_event(enum ug_event event)
+{
+ int is_rotation = 1;
+
+ /* Propagate event */
+ if (!ug_man.is_initted) {
+ _ERR("ugman_send_event failed: manager is not initted");
+ return -1;
+ }
+
+ /* In case of rotation, indicator state has to be updated */
+ switch (event) {
+ case UG_EVENT_ROTATE_PORTRAIT:
+ case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
+ ug_man.last_rotate_evt = event;
+ ug_man.is_landscape = 0;
+ break;
+ case UG_EVENT_ROTATE_LANDSCAPE:
+ case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
+ ug_man.last_rotate_evt = event;
+ ug_man.is_landscape = 1;
+ break;
+ default:
+ is_rotation = 0;
+ }
+
+ if (!ug_man.root) {
+ _ERR("ugman_send_event failed: no root");
+ return -1;
+ }
+
+ ecore_idler_add(ugman_send_event_pre, (void *)event);
+
+ if (is_rotation && ug_man.fv_top)
+ ugman_indicator_update(ug_man.fv_top->opt, event);
+
+ return 0;
+}
+
+static int ugman_send_key_event_to_ug(ui_gadget_h ug,
+ enum ug_key_event event)
+{
+ struct ug_module_ops *ops = NULL;
+
+ if (!ug)
+ return -1;
+
+ if (ug->module) {
+ ops = &ug->module->ops;
+ } else {
+ return -1;
+ }
+
+ if (ops && ops->key_event) {
+ ops->key_event(ug, event, ug->service, ops->priv);
+ } else {
+ return -1;
+ }
+
+ return 0;
+}
+
+int ugman_send_key_event(enum ug_key_event event)
+{
+ if (!ug_man.is_initted) {
+ _ERR("ugman_send_key_event failed: manager is not initted");
+ return -1;
+ }
+
+ if (!ug_man.fv_top || !ugman_ug_exist(ug_man.fv_top)
+ || ug_man.fv_top->state == UG_STATE_DESTROYED) {
+ _ERR("ugman_send_key_event failed: full view top UG is invalid");
+ return -1;
+ }
+
+ return ugman_send_key_event_to_ug(ug_man.fv_top, event);
+}
+
+int ugman_send_message(ui_gadget_h ug, service_h msg)
+{
+ struct ug_module_ops *ops = NULL;
+ if (!ug || !ugman_ug_exist(ug) || ug->state == UG_STATE_DESTROYED) {
+ _ERR("ugman_send_message failed: Invalid ug");
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (!msg) {
+ _ERR("ugman_send_message failed: Invalid msg");
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (ug->module)
+ ops = &ug->module->ops;
+
+ if (ops && ops->message)
+ ops->message(ug, msg, ug->service, ops->priv);
+
+ return 0;
+}
+
+void *ugman_get_window(void)
+{
+ return ug_man.win;
+}
+
+void *ugman_get_conformant(void)
+{
+ return ug_man.conform;
+}
+
+
+static inline void job_start(void)
+{
+ ug_man.walking++;
+}
+
+static inline void job_end(void)
+{
+ ug_man.walking--;
+
+ if (!ug_man.walking && ug_man.destroy_all) {
+ ug_man.destroy_all = 0;
+ if (ug_man.root)
+ ugman_ug_destroy(ug_man.root);
+ }
+
+ if (ug_man.walking < 0)
+ ug_man.walking = 0;
+}
+
+int ugman_ug_exist(ui_gadget_h ug)
+{
+ return ugman_ug_find(ug_man.root, ug);
+}
diff --git a/src/module.c b/src/module.c
new file mode 100644
index 0000000..da518d3
--- /dev/null
+++ b/src/module.c
@@ -0,0 +1,138 @@
+/*
+ * UI Gadget
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>
+ *
+ * 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 <linux/limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <dlfcn.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+#include <app_manager.h>
+
+#include "ug-module.h"
+#include "ug-dbg.h"
+
+#define UG_MODULE_INIT_SYM "UG_MODULE_INIT"
+#define UG_MODULE_EXIT_SYM "UG_MODULE_EXIT"
+
+static int file_exist(const char *filename)
+{
+ FILE *file;
+ if ((file = fopen(filename, "r"))) {
+ fclose(file);
+ return 1;
+ }
+
+ return 0;
+}
+
+struct ug_module *ug_module_load(const char *name)
+{
+ void *handle;
+ struct ug_module *module;
+ char ug_file[PATH_MAX];
+ char *pkg_name = NULL;
+
+ int (*module_init) (struct ug_module_ops *ops);
+
+ module = calloc(1, sizeof(struct ug_module));
+
+ if (!module) {
+ errno = ENOMEM;
+ return NULL;
+ }
+
+ app_manager_get_package(getpid(), &pkg_name);
+
+ do {
+ if (pkg_name) {
+ snprintf(ug_file, PATH_MAX, "/usr/apps/%s/lib/libug-%s.so", pkg_name, name);
+ if (file_exist(ug_file))
+ break;
+ snprintf(ug_file, PATH_MAX, "/opt/apps/%s/lib/libug-%s.so", pkg_name, name);
+ if (file_exist(ug_file))
+ break;
+ }
+ snprintf(ug_file, PATH_MAX, "/usr/ug/lib/libug-%s.so", name);
+ if (file_exist(ug_file))
+ break;
+ snprintf(ug_file, PATH_MAX, "/opt/usr/ug/lib/libug-%s.so", name);
+ if (file_exist(ug_file))
+ break;
+ } while (0);
+
+ if(pkg_name) {
+ free(pkg_name);
+ pkg_name = NULL;
+ }
+
+ handle = dlopen(ug_file, RTLD_LAZY);
+ if (!handle) {
+ _ERR("dlopen failed: %s", dlerror());
+ goto module_free;
+ }
+
+ module_init = dlsym(handle, UG_MODULE_INIT_SYM);
+ if (!module_init) {
+ _ERR("dlsym failed: %s", dlerror());
+ goto module_dlclose;
+ }
+
+ if (module_init(&module->ops))
+ goto module_dlclose;
+
+ module->handle = handle;
+ return module;
+
+ module_dlclose:
+ dlclose(handle);
+
+ module_free:
+ free(module);
+ return NULL;
+}
+
+int ug_module_unload(struct ug_module *module)
+{
+ void (*module_exit) (struct ug_module_ops *ops);
+
+ if (!module) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (module->handle) {
+ module_exit = dlsym(module->handle, UG_MODULE_EXIT_SYM);
+ if (module_exit)
+ module_exit(&module->ops);
+ else
+ _ERR("dlsym failed: %s", dlerror());
+
+ dlclose(module->handle);
+ module->handle = NULL;
+ }
+
+ free(module);
+ return 0;
+}
diff --git a/src/ug.c b/src/ug.c
new file mode 100755
index 0000000..09f4679
--- /dev/null
+++ b/src/ug.c
@@ -0,0 +1,283 @@
+/*
+ * UI Gadget
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>
+ *
+ * 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 <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+
+#include "ug.h"
+#include "ug-module.h"
+#include "ug-manager.h"
+#include "ug-dbg.h"
+
+#ifndef UG_API
+#define UG_API __attribute__ ((visibility("default")))
+#endif
+
+ui_gadget_h ug_root_create(void)
+{
+ ui_gadget_h ug;
+
+ ug = calloc(1, sizeof(struct ui_gadget_s));
+ if (!ug) {
+ _ERR("ug root create failed: Memory allocation failed");
+ return NULL;
+ }
+
+ ug->mode = UG_MODE_FULLVIEW;
+ ug->state = UG_STATE_RUNNING;
+ ug->children = NULL;
+
+ return ug;
+}
+
+int ug_free(ui_gadget_h ug)
+{
+ if (!ug) {
+ _ERR("ug free failed: Invalid ug");
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (ug->module) {
+ ug_module_unload(ug->module);
+ }
+ if (ug->name) {
+ free((void *)ug->name);
+ ug->name = NULL;
+ }
+ if (ug->service) {
+ service_destroy(ug->service);
+ ug->service = NULL;
+ }
+ free(ug);
+ ug = NULL;
+ return 0;
+}
+
+UG_API ui_gadget_h ug_create(ui_gadget_h parent,
+ const char *name,
+ enum ug_mode mode,
+ service_h service, struct ug_cbs *cbs)
+{
+ if (!name) {
+ _ERR("ug_create() failed: Invalid name");
+ errno = EINVAL;
+ return NULL;
+ }
+
+ if (mode < UG_MODE_FULLVIEW || mode >= UG_MODE_INVALID) {
+ _ERR("ug_create() failed: Invalid mode");
+ errno = EINVAL;
+ return NULL;
+ }
+
+ return ugman_ug_load(parent, name, mode, service, cbs);
+}
+
+UG_API int ug_init(Display *disp, Window xid, void *win, enum ug_option opt)
+{
+ if (!win || !xid || !disp) {
+ _ERR("ug_init() failed: Invalid arguments");
+ return -1;
+ }
+
+ if (opt < UG_OPT_INDICATOR_ENABLE || opt >= UG_OPT_MAX) {
+ _ERR("ug_init() failed: Invalid option");
+ return -1;
+ }
+
+ return ugman_init(disp, xid, win, opt);
+}
+
+UG_API int ug_pause(void)
+{
+ return ugman_pause();
+}
+
+UG_API int ug_resume(void)
+{
+ return ugman_resume();
+}
+
+UG_API int ug_destroy(ui_gadget_h ug)
+{
+ return ugman_ug_del(ug);
+}
+
+UG_API int ug_destroy_all(void)
+{
+ return ugman_ug_del_all();
+}
+
+UG_API int ug_destroy_me(ui_gadget_h ug)
+{
+ if (!ug || !ugman_ug_exist(ug)) {
+ _ERR("ug_destroy_me() failed: Invalid ug");
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (ug->state == UG_STATE_DESTROYING) {
+ _ERR("ug_destory_me() failed:ug is alreay on destroying");
+ return -1;
+ }
+
+ if (!ug->cbs.destroy_cb) {
+ _ERR("ug_destroy_me() failed: destroy callback does not "
+ "exist");
+ return -1;
+ }
+
+ ug->cbs.destroy_cb(ug, ug->cbs.priv);
+ return 0;
+}
+
+UG_API void *ug_get_layout(ui_gadget_h ug)
+{
+ if (!ug || !ugman_ug_exist(ug)) {
+ _ERR("ug_get_layout() failed: Invalid ug");
+ errno = EINVAL;
+ return NULL;
+ }
+ return ug->layout;
+}
+
+UG_API void *ug_get_parent_layout(ui_gadget_h ug)
+{
+ ui_gadget_h parent;
+ if (!ug || !ugman_ug_exist(ug)) {
+ _ERR("ug_get_parent_layout() failed: Invalid ug");
+ errno = EINVAL;
+ return NULL;
+ }
+
+ parent = ug->parent;
+
+ if (parent)
+ return parent->layout;
+ return NULL;
+}
+
+UG_API enum ug_mode ug_get_mode(ui_gadget_h ug)
+{
+ if (!ug || !ugman_ug_exist(ug)) {
+ _ERR("ug_get_mode() failed: Invalid ug");
+ errno = EINVAL;
+ return UG_MODE_INVALID;
+ }
+
+ return ug->mode;
+}
+
+UG_API void *ug_get_window(void)
+{
+ return ugman_get_window();
+}
+
+UG_API void *ug_get_conformant(void)
+{
+ return ugman_get_conformant();
+}
+
+UG_API int ug_send_event(enum ug_event event)
+{
+ if (event <= UG_EVENT_NONE || event >= UG_EVENT_MAX) {
+ _ERR("ug_send_event() failed: Invalid event");
+ return -1;
+ }
+
+ return ugman_send_event(event);
+}
+
+UG_API int ug_send_key_event(enum ug_key_event event)
+{
+ if (event <= UG_KEY_EVENT_NONE || event >= UG_KEY_EVENT_MAX) {
+ _ERR("ug_send_key_event() failed: Invalid event");
+ return -1;
+ }
+
+ return ugman_send_key_event(event);
+}
+
+UG_API int ug_send_result(ui_gadget_h ug, service_h result)
+{
+ service_h result_dup = NULL;
+
+ if (!ug || !ugman_ug_exist(ug)) {
+ _ERR("ug_send_result() failed: Invalid ug");
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (!ug->cbs.result_cb) {
+ _ERR("ug_send_result() failed: result callback does not exist");
+ return -1;
+ }
+
+ if (result) {
+ service_clone(&result_dup, result);
+ if (!result_dup) {
+ _ERR("ug_send_result() failed: service_destroy failed");
+ return -1;
+ }
+ }
+
+ ug->cbs.result_cb(ug, result_dup, ug->cbs.priv);
+
+ if (result_dup)
+ service_destroy(result_dup);
+
+ return 0;
+}
+
+UG_API int ug_send_message(ui_gadget_h ug, service_h msg)
+{
+ int r;
+
+ service_h msg_dup = NULL;
+ if (msg) {
+ service_clone(&msg_dup, msg);
+ if (!msg_dup) {
+ _ERR("ug_send_message() failed: service_destroy failed");
+ return -1;
+ }
+ }
+
+ r = ugman_send_message(ug, msg_dup);
+
+ if (msg_dup)
+ service_destroy(msg_dup);
+
+ return r;
+}
+
+UG_API int ug_disable_effect(ui_gadget_h ug)
+{
+ if (ug->layout_state != UG_LAYOUT_INIT) {
+ _ERR("ug_disable_effect() failed: ug has already been shown");
+ return -1;
+ }
+ ug->layout_state = UG_LAYOUT_NOEFFECT;
+
+ return 0;
+}
diff --git a/ug-efl-engine/CMakeLists.txt b/ug-efl-engine/CMakeLists.txt
new file mode 100755
index 0000000..d0414f6
--- /dev/null
+++ b/ug-efl-engine/CMakeLists.txt
@@ -0,0 +1,37 @@
+SET(UG_EFL_ENGINE "${PROJECT_NAME}-efl-engine")
+SET(UG_EFL_ENGINE_SRCS ug-efl-engine.c)
+SET(UG_ENGINE_EDJ_DIR "${CMAKE_INSTALL_PREFIX}/share/edje")
+SET(VERSION_MAJOR 0)
+SET(VERSION "${VERSION_MAJOR}.1.0")
+
+PKG_CHECK_MODULES(UG_EFL_ENGINE_PKGS REQUIRED
+ dlog
+ elementary
+ ecore
+ ecore-x
+ edje
+ capi-appfw-application
+ evas)
+
+FOREACH(flag ${UG_EFL_ENGINE_PKGS_CFLAGS})
+ SET(UG_EFL_ENGINE_CFLAGS "${UG_EFL_ENGINE_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+SET(UG_EFL_ENGINE_CFLAGS, "${UG_EFL_ENGINE_CFLAGS} -DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+
+ADD_LIBRARY(${UG_EFL_ENGINE} SHARED ${UG_EFL_ENGINE_SRCS})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
+SET_TARGET_PROPERTIES(${UG_EFL_ENGINE} PROPERTIES COMPILE_FLAGS "${UG_EFL_ENGINE_CFLAGS}")
+TARGET_LINK_LIBRARIES(${UG_EFL_ENGINE} ${PROJECT_NAME} ${UG_EFL_ENGINE_PKGS_LDFLAGS})
+
+INSTALL(TARGETS ${UG_EFL_ENGINE} DESTINATION /usr/lib)
+
+ADD_CUSTOM_TARGET(ug_effect.edj
+ COMMAND edje_cc -id ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/ug_effect.edc ${CMAKE_BINARY_DIR}/ug_effect.edj
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ug_effect.edc
+)
+ADD_DEPENDENCIES(${PROJECT_NAME} ug_effect.edj)
+INSTALL(FILES ${CMAKE_BINARY_DIR}/ug_effect.edj DESTINATION ${UG_ENGINE_EDJ_DIR})
+
+
diff --git a/ug-efl-engine/ug-efl-engine.c b/ug-efl-engine/ug-efl-engine.c
new file mode 100755
index 0000000..f4bf697
--- /dev/null
+++ b/ug-efl-engine/ug-efl-engine.c
@@ -0,0 +1,348 @@
+/*
+ * UI Gadget
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>
+ *
+ * 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 <glib.h>
+#include <Elementary.h>
+#include <ui-gadget-engine.h>
+
+#include "ug.h"
+#include "ug-efl-engine.h"
+#include "ug-dbg.h"
+
+#ifndef UG_ENGINE_API
+#define UG_ENGINE_API __attribute__ ((visibility("default")))
+#endif
+
+static Evas_Object *navi = NULL;
+static Evas_Object *conform = NULL;
+struct cb_data {
+ ui_gadget_h ug;
+ void (*transition_cb)(ui_gadget_h ug);
+};
+static void __hide_finished(void *data, Evas_Object *obj, void *event_info);
+static void on_show_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
+
+static void _on_hideonly_cb(void *data, Evas_Object *obj)
+{
+ ui_gadget_h ug = (ui_gadget_h)data;
+
+ if (!ug)
+ return;
+
+ _DBG("\t obj=%p ug=%p state=%d", obj, ug, ug->layout_state);
+
+ evas_object_intercept_hide_callback_del(ug->layout, _on_hideonly_cb);
+
+ struct cb_data *cb_d;
+ cb_d = (struct cb_data *)calloc(1, sizeof(struct cb_data));
+ cb_d->ug = ug;
+ cb_d->transition_cb = NULL;
+
+ evas_object_event_callback_add(ug->layout, EVAS_CALLBACK_SHOW, on_show_cb, cb_d);
+
+ if (ug->layout_state == UG_LAYOUT_NOEFFECT) {
+ ;
+ }
+
+ if (ug->layout_state == UG_LAYOUT_SHOW) {
+ ug->layout_state = UG_LAYOUT_HIDEEFFECT;
+ }
+
+ if (GET_OPT_OVERLAP_VAL(ug->opt) == UG_OPT_OVERLAP_ENABLE) {
+ _DBG("\t this is Overlap UG. Send nooverlap sig on hide_cb");
+ elm_object_signal_emit(conform, "elm,state,indicator,nooverlap", "");
+ }
+
+ if (elm_naviframe_top_item_get(navi) == ug->effect_layout) {
+ elm_naviframe_item_pop(navi);
+ } else {
+ elm_object_item_del(ug->effect_layout);
+ ug->effect_layout = NULL;
+ }
+}
+
+static void _del_effect_layout(ui_gadget_h ug)
+{
+ GSList *child, *trail;
+
+ if (!ug)
+ return;
+
+ _DBG("\t ug=%p state=%d", ug, ug->layout_state);
+
+ evas_object_intercept_hide_callback_del(ug->layout, _on_hideonly_cb);
+
+ if (ug->children) {
+ child = ug->children;
+ while (child) {
+ trail = g_slist_next(child);
+ _del_effect_layout(child->data);
+ child = trail;
+ }
+ }
+
+ /* effect_layout of frameview is null */
+ /* remove navi item */
+ if (ug->effect_layout) {
+ _DBG("\t remove navi item: ug=%p", ug);
+ if (ug->layout_state == UG_LAYOUT_HIDEEFFECT) {
+ _DBG("\t del cb, ug=%p", ug);
+ evas_object_smart_callback_del(navi, "transition,finished",
+ __hide_finished);
+ }
+ elm_object_item_del(ug->effect_layout);
+ ug->effect_layout = NULL;
+ }
+
+ if (navi) {
+ Elm_Object_Item *t = elm_naviframe_top_item_get(navi);
+ Elm_Object_Item *b = elm_naviframe_bottom_item_get(navi);
+ if (t == b) {
+ _DBG("\t remove navi");
+ evas_object_del(navi);
+ navi = NULL;
+ }
+ }
+ evas_object_hide(ug->layout);
+}
+
+static void __hide_finished(void *data, Evas_Object *obj, void *event_info)
+{
+ struct cb_data *cb_d = (struct cb_data *)data;
+
+ if (!cb_d)
+ return;
+
+ evas_object_smart_callback_del(obj, "transition,finished",
+ __hide_finished);
+
+ ui_gadget_h ug = cb_d->ug;
+ _DBG("\t obj=%p ug=%p state=%d", obj, ug, ug->layout_state);
+
+ ug->effect_layout = NULL;
+ _del_effect_layout(ug);
+ cb_d->transition_cb(ug);
+ free(cb_d);
+}
+
+static int __find_child(ui_gadget_h p, ui_gadget_h ug)
+{
+ GSList *child = NULL;
+
+ if (!p || !ug)
+ return 0;
+ child = p->children;
+
+ while (child) {
+ if (child->data == ug)
+ return 1;
+ if (__find_child(child->data, ug))
+ return 1;
+ child = g_slist_next(child);
+ }
+
+ return 0;
+}
+
+static void on_destroy(ui_gadget_h ug, ui_gadget_h t_ug,
+ void (*hide_end_cb) (ui_gadget_h ug))
+{
+ if (!ug)
+ return;
+ _DBG("\t ug=%p tug=%p state=%d", ug, t_ug, ug->layout_state);
+
+ evas_object_intercept_hide_callback_del(ug->layout,
+ _on_hideonly_cb);
+
+ if (ug != t_ug) {
+ _DBG("requested ug(%p) is not top ug(%p)", ug, t_ug);
+ _del_effect_layout(ug);
+ hide_end_cb(ug);
+ return;
+ }
+
+ if (ug->layout_state == UG_LAYOUT_SHOW) {
+ struct cb_data *cb_d;
+ cb_d = (struct cb_data *)calloc(1, sizeof(struct cb_data));
+ cb_d->ug = ug;
+ cb_d->transition_cb = hide_end_cb;
+
+ _DBG("\t cb add ug=%p", ug);
+
+ /* overlap update does not needed because manager will do that at on_destroy scenario */
+
+ evas_object_smart_callback_add(navi, "transition,finished",
+ __hide_finished, cb_d);
+ elm_naviframe_item_pop(navi);
+ ug->layout_state = UG_LAYOUT_HIDEEFFECT;
+ } else if (ug->layout_state == UG_LAYOUT_HIDE
+ || ug->layout_state == UG_LAYOUT_NOEFFECT) {
+ _del_effect_layout(ug);
+ hide_end_cb(ug);
+ } else if (ug->layout_state == UG_LAYOUT_HIDEEFFECT
+ || ug->layout_state == UG_LAYOUT_SHOWEFFECT) {
+ ug->layout_state = UG_LAYOUT_DESTROY;
+ } else {
+ _ERR("[UG Effect Plug-in] : layout state error!!");
+ }
+}
+
+static void __show_finished(void *data, Evas_Object *obj, void *event_info)
+{
+ struct cb_data *cb_d = (struct cb_data *)data;
+ if (!cb_d)
+ return;
+
+ ui_gadget_h ug = cb_d->ug;
+ if (!ug)
+ return;
+
+ _DBG("\tobj=%p ug=%p state=%d", obj, ug, ug->layout_state);
+
+ evas_object_smart_callback_del(obj, "transition,finished",
+ __show_finished);
+
+ if (ug->layout_state == UG_LAYOUT_NOEFFECT)
+ return;
+
+ if (ug->layout_state == UG_LAYOUT_DESTROY)
+ ;
+ else
+ ug->layout_state = UG_LAYOUT_SHOW;
+
+ if(cb_d->transition_cb)
+ cb_d->transition_cb(ug);
+ free(cb_d);
+}
+
+static void on_show_cb(void *data, Evas *e, Evas_Object *obj,
+ void *event_info)
+{
+ struct cb_data *cb_d = (struct cb_data *)data;
+ if (!cb_d)
+ return;
+ ui_gadget_h ug = cb_d->ug;
+ if (!ug)
+ return;
+ _DBG("\tobj=%p ug=%p layout=%p state=%d", obj, ug, ug->layout, ug->layout_state);
+
+ evas_object_event_callback_del(ug->layout, EVAS_CALLBACK_SHOW, on_show_cb);
+
+ evas_object_intercept_hide_callback_add(ug->layout,
+ _on_hideonly_cb, ug);
+
+ elm_object_part_content_set(conform, "elm.swallow.ug", navi);
+
+ if (ug->layout_state == UG_LAYOUT_HIDE
+ || ug->layout_state == UG_LAYOUT_INIT) {
+ _DBG("\t UG_LAYOUT_Init(%d) obj=%p", ug->layout_state, obj);
+ ug->layout_state = UG_LAYOUT_SHOWEFFECT;
+
+ if (GET_OPT_OVERLAP_VAL(ug->opt)) {
+ _DBG("\t this is Overlap UG. Send overlap sig on_show_cb");
+ elm_object_signal_emit(conform, "elm,state,indicator,overlap", "");
+ }
+
+ evas_object_smart_callback_add(navi, "transition,finished",
+ __show_finished, cb_d);
+ ug->effect_layout = elm_naviframe_item_push(navi, NULL, NULL, NULL,
+ ug->layout, NULL);
+ } else if (ug->layout_state == UG_LAYOUT_NOEFFECT) {
+ _DBG("\t UG_LAYOUT_NOEFFECT obj=%p", obj);
+
+ if (GET_OPT_OVERLAP_VAL(ug->opt)) {
+ _DBG("\t this is Overlap UG. Send overlap sig on_show_cb");
+ elm_object_signal_emit(conform, "elm,state,indicator,overlap", "");
+ }
+
+ Elm_Object_Item *navi_top = elm_naviframe_top_item_get(navi);
+ ug->effect_layout = elm_naviframe_item_insert_after(navi,
+ navi_top, NULL, NULL, NULL, ug->layout, NULL);
+
+ //ug start cb
+ if(cb_d->transition_cb)
+ cb_d->transition_cb(ug);
+ free(cb_d);
+ } else {
+ _ERR("\tlayout state error!! state=%d\n", ug->layout_state);
+ free(cb_d);
+ }
+}
+
+static void *on_create(void *win, ui_gadget_h ug,
+ void (*show_end_cb) (void* data))
+{
+ Evas_Object *navi_bg;
+ Evas_Object *con = NULL;
+
+ if (!ug)
+ return NULL;
+ _DBG("\t ug=%p state=%d", ug, ug->layout_state);
+
+ con = evas_object_data_get(win, "\377 elm,conformant");
+ if (con) {
+ conform = con;
+ _DBG("\t There is conformant");
+ }
+ else
+ _DBG("\t There is NO conformant");
+
+ if (!navi) {
+ navi = elm_naviframe_add(conform);
+ elm_object_style_set(navi, "uglib");
+ elm_naviframe_content_preserve_on_pop_set(navi, EINA_TRUE);
+ _DBG("\t new navi first navi=%p", navi);
+ elm_naviframe_prev_btn_auto_pushed_set(navi, EINA_FALSE);
+
+ navi_bg = evas_object_rectangle_add(evas_object_evas_get(navi));
+ evas_object_size_hint_fill_set(navi_bg, EVAS_HINT_FILL,
+ EVAS_HINT_FILL);
+ evas_object_color_set(navi_bg, 0, 0, 0, 0);
+ elm_naviframe_item_push(navi, NULL, NULL, NULL, navi_bg, NULL);
+ }
+
+ struct cb_data *cb_d;
+ cb_d = (struct cb_data *)calloc(1, sizeof(struct cb_data));
+ cb_d->ug = ug;
+ cb_d->transition_cb = show_end_cb;
+
+ evas_object_hide(ug->layout);
+ evas_object_event_callback_add(ug->layout, EVAS_CALLBACK_SHOW, on_show_cb, cb_d);
+
+ ug->layout_state = UG_LAYOUT_INIT;
+
+ return conform;
+}
+
+UG_ENGINE_API int UG_ENGINE_INIT(struct ug_engine_ops *ops)
+{
+ if (!ops)
+ return -1;
+
+ ops->create = on_create;
+ ops->destroy = on_destroy;
+
+ return 0;
+}
+
+UG_ENGINE_API void UG_ENGINE_EXIT(struct ug_engine_ops *ops)
+{
+}
diff --git a/ug-efl-engine/ug-efl-engine.h b/ug-efl-engine/ug-efl-engine.h
new file mode 100644
index 0000000..fbfce5b
--- /dev/null
+++ b/ug-efl-engine/ug-efl-engine.h
@@ -0,0 +1,32 @@
+/*
+ * UI Gadget
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>
+ *
+ * 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 __UG_EFL_ENGINE_H__
+#define __UG_EFL_ENGINE_H__
+
+#include <Elementary.h>
+#include <libintl.h>
+
+#define _EDJ(o) elm_layout_edje_get(o)
+
+#endif /* __UG_EFL_ENGINE_H__ */
diff --git a/ug-efl-engine/ug_effect.edc b/ug-efl-engine/ug_effect.edc
new file mode 100644
index 0000000..0be0ed3
--- /dev/null
+++ b/ug-efl-engine/ug_effect.edc
@@ -0,0 +1,137 @@
+/*
+ * UI Gadget
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>
+ *
+ * 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.
+ *
+ */
+
+//TRANSLATION EFFECT
+#define NAVIFRAME_VIEW_TRANS_TIME 0.1
+
+collections {
+/* group { name:"elm/naviframe/item/basic/uglib";
+ parts {
+ part { name: "base";
+ type: RECT;
+ mouse_events: 0;
+ description { state: "default" 0.0;
+ color: 255 255 255 255;
+ }
+ description { state: "right" 0.0;
+ inherit: "default" 0.0;
+ rel1.relative: 1.0 0.0;
+ rel2.relative: 2.0 1.0;
+ color: 255 255 255 0;
+ }
+ }
+ part { name: "elm.swallow.content";
+ type: SWALLOW;
+ scale: 1;
+ repeat_events: 0;
+ clip_to: "base";
+ description { state: "default" 0.0;
+ align: 0.0 0.0;
+ rel1.relative: 0.0 0.0;
+ rel1.to: "base";
+ rel2.relative: 1.0 1.0;
+ rel2.to: "base";
+ }
+ }
+ }
+ programs {
+ program { name: "content_new_pushed";
+ signal: "elm,state,new,pushed,internal";
+ source: "";
+ action: STATE_SET "default" 0.0;
+ target: "base";
+ transition: DECELERATE NAVIFRAME_VIEW_TRANS_TIME;
+ after: "show_finished";
+ }
+ program { name: "content_cur_pushed";
+ signal: "elm,state,cur,pushed,internal";
+ source: "";
+ action: STATE_SET "default" 0.0;
+ target: "base";
+ transition: DECELERATE NAVIFRAME_VIEW_TRANS_TIME;
+ after: "pushed_finished";
+ }
+ program { name: "content_prev_popped";
+ signal: "elm,state,prev,popped,internal";
+ source: "";
+ action: STATE_SET "default" 0.0;
+ target: "base";
+ transition: DECELERATE NAVIFRAME_VIEW_TRANS_TIME;
+ after: "show_finished";
+ }
+ program { name: "content_cur_popped";
+ signal: "elm,state,cur,popped,internal";
+ source: "";
+ action: STATE_SET "right" 0.0;
+ target: "base";
+ transition: DECELERATE NAVIFRAME_VIEW_TRANS_TIME;
+ after: "popped_finished";
+ }
+ program { name: "cur_pushed";
+ signal: "elm,state,cur,pushed";
+ source: "elm";
+ script {
+ set_state(PART:"base", "default", 0.0);
+ emit("elm,state,cur,pushed,internal", "");
+ }
+ }
+ program { name: "new_pushed";
+ signal: "elm,state,new,pushed";
+ source: "elm";
+ script {
+ set_state(PART:"base", "right", 0.0);
+ emit("elm,state,new,pushed,internal", "");
+ }
+ }
+ program { name: "prev_popped";
+ signal: "elm,state,prev,popped";
+ source: "elm";
+ script {
+ set_state(PART:"base", "default", 0.0);
+ emit("elm,state,prev,popped,internal", "");
+ }
+ }
+ program { name: "cur_popped";
+ signal: "elm,state,cur,popped";
+ source: "elm";
+ script {
+ set_state(PART:"base", "default", 0.0);
+ emit("elm,state,cur,popped,internal", "");
+ }
+ }
+ program { name: "visible";
+ signal: "elm,state,visible";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "base";
+ }
+ program { name: "show_finished";
+ action: SIGNAL_EMIT "elm,action,show,finished" "";
+ }
+ program { name: "pushed_finished";
+ action: SIGNAL_EMIT "elm,action,pushed,finished" "";
+ }
+ program { name: "popped_finished";
+ action: SIGNAL_EMIT "elm,action,popped,finished" "";
+ }
+ }
+ }*/
+}
diff --git a/ui-gadget-1.manifest b/ui-gadget-1.manifest
new file mode 100644
index 0000000..97e8c31
--- /dev/null
+++ b/ui-gadget-1.manifest
@@ -0,0 +1,5 @@
+<manifest>
+ <request>
+ <domain name="_"/>
+ </request>
+</manifest>
diff --git a/ui-gadget-1.pc.in b/ui-gadget-1.pc.in
new file mode 100644
index 0000000..f011267
--- /dev/null
+++ b/ui-gadget-1.pc.in
@@ -0,0 +1,11 @@
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@/ug-1/
+
+Name: UI Gadget
+Description: UI Gadget Library
+Version: @VERSION@
+Requires: bundle x11 capi-appfw-application
+Libs: -L${libdir} -lui-gadget-1
+Cflags: -I${includedir}