Tizen release 1.0
authorKim Kibum <kb0929.kim@samsung.com>
Mon, 9 Apr 2012 03:12:48 +0000 (12:12 +0900)
committerKim Kibum <kb0929.kim@samsung.com>
Mon, 9 Apr 2012 03:12:48 +0000 (12:12 +0900)
58 files changed:
CMakeLists.txt [new file with mode: 0644]
NOTICE [new file with mode: 0644]
TC/build.sh [new file with mode: 0755]
TC/execute.sh [new file with mode: 0755]
TC/tet_code [new file with mode: 0644]
TC/tet_scen [new file with mode: 0644]
TC/tetbuild.cfg [new file with mode: 0644]
TC/tetclean.cfg [new file with mode: 0644]
TC/tetexec.cfg [new file with mode: 0644]
TC/unit/Makefile [new file with mode: 0644]
TC/unit/tc_gen.sh [new file with mode: 0644]
TC/unit/tslist [new file with mode: 0644]
TC/unit/utc_ApplicationFW_ug_create_func.c [new file with mode: 0644]
TC/unit/utc_ApplicationFW_ug_destroy_all_func.c [new file with mode: 0644]
TC/unit/utc_ApplicationFW_ug_destroy_func.c [new file with mode: 0644]
TC/unit/utc_ApplicationFW_ug_destroy_me_func.c [new file with mode: 0644]
TC/unit/utc_ApplicationFW_ug_get_layout_func.c [new file with mode: 0644]
TC/unit/utc_ApplicationFW_ug_get_mode_func.c [new file with mode: 0644]
TC/unit/utc_ApplicationFW_ug_get_parent_layout_func.c [new file with mode: 0644]
TC/unit/utc_ApplicationFW_ug_get_window_func.c [new file with mode: 0644]
TC/unit/utc_ApplicationFW_ug_init_func.c [new file with mode: 0644]
TC/unit/utc_ApplicationFW_ug_pause_func.c [new file with mode: 0644]
TC/unit/utc_ApplicationFW_ug_resume_func.c [new file with mode: 0644]
TC/unit/utc_ApplicationFW_ug_send_event_func.c [new file with mode: 0644]
TC/unit/utc_ApplicationFW_ug_send_message_func.c [new file with mode: 0644]
TC/unit/utc_ApplicationFW_ug_send_result_func.c [new file with mode: 0644]
TC/unit/utc_MODULE_API_func.c.in [new file with mode: 0644]
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/copyright [new file with mode: 0644]
debian/libui-gadget-0.install.in [new file with mode: 0644]
debian/libui-gadget-dev.install.in [new file with mode: 0644]
debian/rules [new file with mode: 0755]
image/SLP_UI_Gadget_PG_image00.png [new file with mode: 0644]
image/SLP_UI_Gadget_PG_image01.png [new file with mode: 0644]
image/SLP_UI_Gadget_PG_image02.png [new file with mode: 0644]
image/SLP_UI_Gadget_PG_image03.png [new file with mode: 0644]
include/SLP_UI_Gadget_PG.h [new file with mode: 0644]
include/ug-dbg.h [new file with mode: 0644]
include/ug-engine.h [new file with mode: 0644]
include/ug-manager.h [new file with mode: 0644]
include/ug-module.h [new file with mode: 0644]
include/ug.h [new file with mode: 0644]
include/ui-gadget-engine.h [new file with mode: 0644]
include/ui-gadget-module.h [new file with mode: 0644]
include/ui-gadget.h [new file with mode: 0644]
packaging/ui-gadget.spec [new file with mode: 0644]
src/engine.c [new file with mode: 0644]
src/manager.c [new file with mode: 0755]
src/module.c [new file with mode: 0644]
src/ug.c [new file with mode: 0644]
ug-efl-engine/CMakeLists.txt [new file with mode: 0644]
ug-efl-engine/ug-efl-engine.c [new file with mode: 0755]
ug-efl-engine/ug-efl-engine.h [new file with mode: 0644]
ug-efl-engine/ug_effect.edc [new file with mode: 0644]
ug-efl-engine/ug_effect_3d.edc [new file with mode: 0644]
ui-gadget.pc.in [new file with mode: 0644]

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..a904276
--- /dev/null
@@ -0,0 +1,51 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(ui-gadget)
+
+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)
+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/${PROJECT_NAME}-module.h DESTINATION include)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/${PROJECT_NAME}-engine.h DESTINATION include)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/${PROJECT_NAME}.h DESTINATION include)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/SLP_UI_Gadget_PG.h DESTINATION include)
+
+ADD_SUBDIRECTORY(ug-efl-engine)
diff --git a/NOTICE b/NOTICE
new file mode 100644 (file)
index 0000000..4c49449
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1 @@
+Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
diff --git a/TC/build.sh b/TC/build.sh
new file mode 100755 (executable)
index 0000000..6be574d
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+export TET_INSTALL_PATH=/home/jnstar/workspace/tetware/TETware  # local tetware path
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+export TET_ROOT=$TET_TARGET_PATH
+
+export TET_SUITE_ROOT=`pwd`
+FILE_NAME_EXTENSION=`date +%s`
+
+RESULT_DIR=results
+HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html
+JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal
+
+mkdir -p $RESULT_DIR
+
+tcc -c -p ./
+tcc -b -j $JOURNAL_RESULT -p ./
+grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
diff --git a/TC/execute.sh b/TC/execute.sh
new file mode 100755 (executable)
index 0000000..b9aa762
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+export TET_INSTALL_PATH=/mnt/nfs/tetware/TETware
+#export TET_INSTALL_PATH=/scratchbox/tetware
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+
+export TET_ROOT=$TET_TARGET_PATH
+
+export TET_SUITE_ROOT=`pwd`
+FILE_NAME_EXTENSION=`date +%s`
+
+RESULT_DIR=results
+HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html
+JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal
+
+mkdir -p $RESULT_DIR
+
+tcc -e -j $JOURNAL_RESULT -p ./
+grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
diff --git a/TC/tet_code b/TC/tet_code
new file mode 100644 (file)
index 0000000..a2cf6c1
--- /dev/null
@@ -0,0 +1,12 @@
+# TET reserved codes
+0 "PASS"
+1 "FAIL"
+2 "UNRESOLVED"
+3 "NOTINUSE"
+4 "UNSUPPORTED"
+5 "UNTESTED"
+6 "UNINITIATED"
+7 "NORESULT"
+
+# Test suite additional codes
+33 "INSPECT"
diff --git a/TC/tet_scen b/TC/tet_scen
new file mode 100644 (file)
index 0000000..7108f43
--- /dev/null
@@ -0,0 +1,7 @@
+all
+       ^ui-gadget
+##### Scenarios for UI gadget #####
+
+# UI gadget
+ui-gadget
+       :include:/unit/tslist
diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg
new file mode 100644 (file)
index 0000000..6192c78
--- /dev/null
@@ -0,0 +1,3 @@
+TET_OUTPUT_CAPTURE=False
+TET_BUILD_TOOL=make
+TET_PASS_TC_NAME=True
diff --git a/TC/tetclean.cfg b/TC/tetclean.cfg
new file mode 100644 (file)
index 0000000..c66eda4
--- /dev/null
@@ -0,0 +1,2 @@
+TET_OUTPUT_CAPTURE=False
+TET_CLEAN_TOOL=make clean
diff --git a/TC/tetexec.cfg b/TC/tetexec.cfg
new file mode 100644 (file)
index 0000000..0d9d39a
--- /dev/null
@@ -0,0 +1 @@
+TET_OUTPUT_CAPTURE=False
diff --git a/TC/unit/Makefile b/TC/unit/Makefile
new file mode 100644 (file)
index 0000000..5d93915
--- /dev/null
@@ -0,0 +1,35 @@
+CC ?= gcc
+
+TARGETS = utc_ApplicationFW_ug_init_func \
+       utc_ApplicationFW_ug_create_func \
+       utc_ApplicationFW_ug_pause_func \
+       utc_ApplicationFW_ug_resume_func \
+       utc_ApplicationFW_ug_destroy_func \
+       utc_ApplicationFW_ug_destroy_all_func \
+       utc_ApplicationFW_ug_get_layout_func \
+       utc_ApplicationFW_ug_get_parent_layout_func \
+       utc_ApplicationFW_ug_get_mode_func \
+       utc_ApplicationFW_ug_get_window_func \
+       utc_ApplicationFW_ug_send_message_func \
+       utc_ApplicationFW_ug_send_event_func \
+       utc_ApplicationFW_ug_destroy_me_func \
+       utc_ApplicationFW_ug_send_result_func
+
+PKGS = elementary ui-gadget ecore ecore-x evas
+
+LDFLAGS = `pkg-config --libs $(PKGS)`
+LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o
+LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s
+LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s
+
+CFLAGS = -I. `pkg-config --cflags $(PKGS)`
+CFLAGS += -I$(TET_ROOT)/inc/tet3
+CFLAGS += -Wall
+
+all: $(TARGETS)
+
+$(TARGETS): %: %.c
+       $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS)
+
+clean:
+       rm -f $(TARGETS)
diff --git a/TC/unit/tc_gen.sh b/TC/unit/tc_gen.sh
new file mode 100644 (file)
index 0000000..54f482d
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+TMPSTR=$0
+SCRIPT=${TMPSTR##*/}
+
+if [ $# -lt 2 ]; then
+       echo "Usage) $SCRIPT module_name api_name"
+       exit 1
+fi
+
+MODULE=$1
+API=$2
+TEMPLATE=utc_MODULE_API_func.c.in
+TESTCASE=utc_${MODULE}_${API}_func
+
+sed -e '
+       s^@API@^'"$API"'^g
+       s^@MODULE@^'"$MODULE"'^g
+       ' $TEMPLATE > $TESTCASE.c
+
+if [ ! -e "$TESTCASE.c" ]; then
+       echo "Failed"
+       exit 1
+fi
+echo "Testcase file is $TESTCASE.c"
+echo "Done"
+echo "please put \"$TESTCASE\" as Target in Makefile"
+echo "please put \"/unit/$TESTCASE\" in tslist"
diff --git a/TC/unit/tslist b/TC/unit/tslist
new file mode 100644 (file)
index 0000000..0a43f85
--- /dev/null
@@ -0,0 +1,14 @@
+/unit/utc_ApplicationFW_ug_init_func
+/unit/utc_ApplicationFW_ug_create_func
+/unit/utc_ApplicationFW_ug_pause_func
+/unit/utc_ApplicationFW_ug_resume_func
+/unit/utc_ApplicationFW_ug_destroy_func
+/unit/utc_ApplicationFW_ug_destroy_all_func
+/unit/utc_ApplicationFW_ug_get_layout_func
+/unit/utc_ApplicationFW_ug_get_parent_layout_func
+/unit/utc_ApplicationFW_ug_get_mode_func
+/unit/utc_ApplicationFW_ug_get_window_func
+/unit/utc_ApplicationFW_ug_send_message_func
+/unit/utc_ApplicationFW_ug_send_event_func
+/unit/utc_ApplicationFW_ug_destroy_me_func
+/unit/utc_ApplicationFW_ug_send_result_func
diff --git a/TC/unit/utc_ApplicationFW_ug_create_func.c b/TC/unit/utc_ApplicationFW_ug_create_func.c
new file mode 100644 (file)
index 0000000..429e10d
--- /dev/null
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the UI Gadget
+ * Written by Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+#include <tet_api.h>
+#include <ui-gadget.h>
+#include <Elementary.h>
+#include <Ecore_X.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_ApplicationFW_ug_create_func_01(void);
+static void utc_ApplicationFW_ug_create_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_ApplicationFW_ug_create_func_01, POSITIVE_TC_IDX },
+       { utc_ApplicationFW_ug_create_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0},
+};
+
+#define TESTUG "helloUG-efl"
+#define TESTUG_ERR "helloUG-efl0-abacbadsf"
+
+static void startup(void)
+{
+       char *err;
+       Evas_Object *win;
+
+       elm_init(0, NULL);
+       win = elm_win_add(NULL, "UI gadget test", ELM_WIN_BASIC);
+       if (!win) {
+               err = "Cannot create window";
+               goto startup_err;
+       }
+
+       if (UG_INIT_EFL(win, UG_OPT_INDICATOR_ENABLE)) {
+               err = "ug_init() failed";
+               goto startup_err;
+       }
+       return;
+
+startup_err:
+       tet_infoline(err);
+       tet_delete(POSITIVE_TC_IDX, err);
+       tet_delete(NEGATIVE_TC_IDX, err);
+}
+
+static void cleanup(void)
+{
+       elm_shutdown();
+}
+
+/**
+ * @brief Positive test case of ug_create()
+ */
+static void utc_ApplicationFW_ug_create_func_01(void)
+{
+       struct ui_gadget *ug;
+       bundle *data = NULL;
+       struct ug_cbs cbs = {0, };
+       data = bundle_create();
+       bundle_add(data, "test", "case");
+
+       ug = ug_create(NULL, TESTUG, UG_MODE_FULLVIEW, data, &cbs);
+       if (!ug) {
+               tet_infoline("ug_create() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       ug = ug_create(NULL, TESTUG, UG_MODE_FRAMEVIEW, data, &cbs);
+       if (!ug) {
+               tet_infoline("ug_create() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ug_init ug_create()
+ */
+static void utc_ApplicationFW_ug_create_func_02(void)
+{
+       struct ui_gadget *ug;
+       bundle *data = NULL;
+       struct ug_cbs cbs = {0, };
+       data = bundle_create();
+       bundle_add(data, "test", "case");
+
+       ug = ug_create(NULL, TESTUG_ERR, -1, data, &cbs);
+       if (ug) {
+               tet_infoline("ug_create() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       ug = ug_create(NULL, TESTUG_ERR, UG_MODE_INVALID, data, &cbs);
+       if (ug) {
+               tet_infoline("ug_create() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       ug = ug_create(NULL, TESTUG_ERR, UG_MODE_MAX, data, &cbs);
+       if (ug) {
+               tet_infoline("ug_create() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_ApplicationFW_ug_destroy_all_func.c b/TC/unit/utc_ApplicationFW_ug_destroy_all_func.c
new file mode 100644 (file)
index 0000000..f946ffc
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the UI Gadget
+ * Written by Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+#include <tet_api.h>
+#include <ui-gadget.h>
+#include <Elementary.h>
+#include <Ecore_X.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_ApplicationFW_ug_destroy_all_func_01(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_ApplicationFW_ug_destroy_all_func_01, POSITIVE_TC_IDX },
+       { NULL, 0},
+};
+
+#define TESTUG "helloUG-efl"
+static struct ui_gadget *ug;
+
+static void startup(void)
+{
+       char *err;
+       Evas_Object *win;
+
+       elm_init(0, NULL);
+       win = elm_win_add(NULL, "UI gadget test", ELM_WIN_BASIC);
+       if (!win) {
+               err = "Cannot create window";
+               goto startup_err;
+       }
+
+       if (UG_INIT_EFL(win, UG_OPT_INDICATOR_ENABLE)) {
+               err = "ug_init() failed";
+               goto startup_err;
+       }
+
+       ug = ug_create(NULL, TESTUG, UG_MODE_FULLVIEW, NULL, NULL);
+       if (!ug) {
+               err = "ug_create() failed";
+               goto startup_err;
+       }
+
+       return;
+
+startup_err:
+       tet_infoline(err);
+       tet_delete(POSITIVE_TC_IDX, err);
+}
+
+static void cleanup(void)
+{
+       elm_shutdown();
+}
+
+static Eina_Bool tst01(void *data)
+{
+       int r = 0;
+
+       r = ug_destroy_all();
+       if (r) {
+               tet_infoline("ug_destroy_all() failed in positive test case");
+               tet_result(TET_FAIL);
+               goto exit;
+       }
+       tet_result(TET_PASS);
+
+exit:
+       elm_exit();
+       return 0;
+}
+
+/**
+ * @brief Positive test case of ug_destroy_all()
+ */
+static void utc_ApplicationFW_ug_destroy_all_func_01(void)
+{
+       ecore_idler_add(tst01, NULL);
+       elm_run();
+}
diff --git a/TC/unit/utc_ApplicationFW_ug_destroy_func.c b/TC/unit/utc_ApplicationFW_ug_destroy_func.c
new file mode 100644 (file)
index 0000000..c4292e0
--- /dev/null
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the UI Gadget
+ * Written by Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+#include <tet_api.h>
+#include <ui-gadget.h>
+#include <Elementary.h>
+#include <Ecore_X.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_ApplicationFW_ug_destroy_func_01(void);
+static void utc_ApplicationFW_ug_destroy_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_ApplicationFW_ug_destroy_func_01, POSITIVE_TC_IDX },
+       { utc_ApplicationFW_ug_destroy_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0},
+};
+
+#define TESTUG "helloUG-efl"
+
+static void startup(void)
+{
+       elm_init(0, NULL);
+}
+
+static void cleanup(void)
+{
+       elm_shutdown();
+}
+
+static int init(void)
+{
+       Evas_Object *win;
+       win = elm_win_add(NULL, "UI gadget test", ELM_WIN_BASIC);
+       if (!win) {
+               tet_infoline("Cannot create window");
+               return -1;
+       }
+
+       if (UG_INIT_EFL(win, UG_OPT_INDICATOR_ENABLE)) {
+               tet_infoline("ug_init() failed");
+               return -1;
+       }
+       return 0;
+}
+
+static Eina_Bool tst01(void *data)
+{
+       int r = 0;
+       struct ui_gadget *ug = data;
+
+       r = ug_destroy(ug);
+
+       if (r) {
+               tet_infoline("ug_destroy() failed in positive test case");
+               tet_result(TET_FAIL);
+               goto exit;
+       }
+       tet_result(TET_PASS);
+
+exit:
+       elm_exit();
+       return 0;
+}
+
+/**
+ * @brief Positive test case of ug_destroy()
+ */
+static void utc_ApplicationFW_ug_destroy_func_01(void)
+{
+       struct ui_gadget *ug;
+
+       if (init()) {
+               tet_result(TET_UNINITIATED);
+               return;
+       }
+
+       ug = ug_create(NULL, TESTUG, UG_MODE_FULLVIEW, NULL, NULL);
+       if (!ug) {
+               tet_infoline("ug_create() failed");
+               tet_result(TET_UNINITIATED);
+       }
+
+       ecore_idler_add(tst01, ug);
+       elm_run();
+}
+
+/**
+ * @brief Negative test case of ug_init ug_destroy()
+ */
+static void utc_ApplicationFW_ug_destroy_func_02(void)
+{
+       int r = 0;
+
+       if (init()) {
+               tet_result(TET_UNINITIATED);
+               return;
+       }
+
+       r = ug_destroy(NULL);
+
+       if (!r) {
+               tet_infoline("ug_destroy() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_ApplicationFW_ug_destroy_me_func.c b/TC/unit/utc_ApplicationFW_ug_destroy_me_func.c
new file mode 100644 (file)
index 0000000..ed712df
--- /dev/null
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the UI Gadget
+ * Written by Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+#include <tet_api.h>
+#include <ui-gadget-module.h>
+#include <Elementary.h>
+#include <Ecore_X.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_ApplicationFW_ug_destroy_me_func_01(void);
+static void utc_ApplicationFW_ug_destroy_me_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_ApplicationFW_ug_destroy_me_func_01, POSITIVE_TC_IDX },
+       { utc_ApplicationFW_ug_destroy_me_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0},
+};
+
+#define TESTUG "helloUG-efl"
+
+static void startup(void)
+{
+       elm_init(0, NULL);
+}
+
+static void cleanup(void)
+{
+       elm_shutdown();
+}
+
+static int init(void)
+{
+       Evas_Object *win;
+       win = elm_win_add(NULL, "UI gadget test", ELM_WIN_BASIC);
+       if (!win) {
+               tet_infoline("Cannot create window");
+               return -1;
+       }
+
+       if (UG_INIT_EFL(win, UG_OPT_INDICATOR_ENABLE)) {
+               tet_infoline("ug_init() failed");
+               return -1;
+       }
+       return 0;
+}
+
+static Eina_Bool tst01(void *data)
+{
+       int r = 0;
+       struct ui_gadget *ug = data;
+
+       r = ug_destroy_me(ug);
+       if (r) {
+               tet_infoline("ug_destroy_me() failed in positive test case");
+               tet_result(TET_FAIL);
+               goto exit;
+       }
+       tet_result(TET_PASS);
+
+exit:
+       elm_exit();
+       return 0;
+}
+
+static void destroy_cb(struct ui_gadget *ug, void *priv)
+{
+       // dummy destroy callback
+}
+
+/**
+ * @brief Positive test case of ug_destroy_me()
+ */
+static void utc_ApplicationFW_ug_destroy_me_func_01(void)
+{
+       struct ui_gadget *ug;
+       struct ug_cbs cbs = {0, };
+
+       if (init()) {
+               tet_result(TET_UNINITIATED);
+               return;
+       }
+
+       cbs.destroy_cb = destroy_cb;
+
+       ug = ug_create(NULL, TESTUG, UG_MODE_FULLVIEW, NULL, &cbs);
+       if (!ug) {
+               tet_infoline("ug_create() failed");
+               tet_result(TET_UNINITIATED);
+       }
+
+       ecore_idler_add(tst01, ug);
+       elm_run();
+}
+
+static Eina_Bool tst02(void *data)
+{
+       int r = 0;
+
+       r = ug_destroy_me(NULL);
+       if (!r) {
+               tet_infoline("ug_destroy_me() failed in negative test case");
+               tet_result(TET_FAIL);
+               goto exit;
+       }
+       tet_result(TET_PASS);
+
+exit:
+       elm_exit();
+       return 0;
+}
+
+/**
+ * @brief Negative test case of ug_init ug_destroy_me()
+ */
+static void utc_ApplicationFW_ug_destroy_me_func_02(void)
+{
+       struct ui_gadget *ug;
+
+       if (init()) {
+               tet_result(TET_UNINITIATED);
+               return;
+       }
+
+       ug = ug_create(NULL, TESTUG, UG_MODE_FULLVIEW, NULL, NULL);
+       if (!ug) {
+               tet_infoline("ug_create() failed");
+               tet_result(TET_UNINITIATED);
+       }
+
+       ecore_idler_add(tst02, ug);
+       elm_run();
+}
diff --git a/TC/unit/utc_ApplicationFW_ug_get_layout_func.c b/TC/unit/utc_ApplicationFW_ug_get_layout_func.c
new file mode 100644 (file)
index 0000000..607a09d
--- /dev/null
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the UI Gadget
+ * Written by Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+#include <tet_api.h>
+#include <ui-gadget.h>
+#include <Elementary.h>
+#include <Ecore_X.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_ApplicationFW_ug_get_layout_func_01(void);
+static void utc_ApplicationFW_ug_get_layout_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_ApplicationFW_ug_get_layout_func_01, POSITIVE_TC_IDX },
+       { utc_ApplicationFW_ug_get_layout_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0},
+};
+
+#define TESTUG "helloUG-efl"
+
+static void startup(void)
+{
+       elm_init(0, NULL);
+}
+
+static void cleanup(void)
+{
+       elm_shutdown();
+}
+
+static int init(void)
+{
+       Evas_Object *win;
+       win = elm_win_add(NULL, "UI gadget test", ELM_WIN_BASIC);
+       if (!win) {
+               tet_infoline("Cannot create window");
+               return -1;
+       }
+
+       if (UG_INIT_EFL(win, UG_OPT_INDICATOR_ENABLE)) {
+               tet_infoline("ug_init() failed");
+               return -1;
+       }
+       return 0;
+}
+
+static Eina_Bool tst01(void *data)
+{
+       Evas_Object *ly;
+       struct ui_gadget *ug = data;
+
+       ly = ug_get_layout(ug);
+       if (!ly) {
+               tet_infoline("ug_get_layout() failed in positive test case");
+               tet_result(TET_FAIL);
+               goto exit;
+       }
+       tet_result(TET_PASS);
+
+exit:
+       elm_exit();
+       return 0;
+}
+
+/**
+ * @brief Positive test case of ug_get_layout()
+ */
+static void utc_ApplicationFW_ug_get_layout_func_01(void)
+{
+       struct ui_gadget *ug;
+
+       if (init()) {
+               tet_result(TET_UNINITIATED);
+               return;
+       }
+
+       ug = ug_create(NULL, TESTUG, UG_MODE_FULLVIEW, NULL, NULL);
+       if (!ug) {
+               tet_infoline("ug_create() failed");
+               tet_result(TET_UNINITIATED);
+       }
+
+       ecore_idler_add(tst01, ug);
+       elm_run();
+}
+
+static Eina_Bool tst02(void *data)
+{
+       Evas_Object *ly;
+
+       ly = ug_get_layout(NULL);
+       if (ly) {
+               tet_infoline("ug_get_layout() failed in negative test case");
+               tet_result(TET_FAIL);
+               goto exit;
+       }
+       tet_result(TET_PASS);
+
+exit:
+       elm_exit();
+       return 0;
+}
+
+/**
+ * @brief Negative test case of ug_init ug_get_layout()
+ */
+static void utc_ApplicationFW_ug_get_layout_func_02(void)
+{
+       struct ui_gadget *ug;
+
+       if (init()) {
+               tet_result(TET_UNINITIATED);
+               return;
+       }
+
+       ug = ug_create(NULL, TESTUG, UG_MODE_FULLVIEW, NULL, NULL);
+       if (!ug) {
+               tet_infoline("ug_create() failed");
+               tet_result(TET_UNINITIATED);
+       }
+
+       ecore_idler_add(tst02, ug);
+       elm_run();
+}
diff --git a/TC/unit/utc_ApplicationFW_ug_get_mode_func.c b/TC/unit/utc_ApplicationFW_ug_get_mode_func.c
new file mode 100644 (file)
index 0000000..e96aba2
--- /dev/null
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the UI Gadget
+ * Written by Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+#include <tet_api.h>
+#include <ui-gadget.h>
+#include <Elementary.h>
+#include <Ecore_X.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_ApplicationFW_ug_get_mode_func_01(void);
+static void utc_ApplicationFW_ug_get_mode_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_ApplicationFW_ug_get_mode_func_01, POSITIVE_TC_IDX },
+       { utc_ApplicationFW_ug_get_mode_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0},
+};
+
+#define TESTUG "helloUG-efl"
+
+static void startup(void)
+{
+       elm_init(0, NULL);
+}
+
+static void cleanup(void)
+{
+       elm_shutdown();
+}
+
+static int init(void)
+{
+       Evas_Object *win;
+       win = elm_win_add(NULL, "UI gadget test", ELM_WIN_BASIC);
+       if (!win) {
+               tet_infoline("Cannot create window");
+               return -1;
+       }
+
+       if (UG_INIT_EFL(win, UG_OPT_INDICATOR_ENABLE)) {
+               tet_infoline("ug_init() failed");
+               return -1;
+       }
+       return 0;
+}
+
+static Eina_Bool tst01(void *data)
+{
+       struct ui_gadget *ug = data;
+       enum ug_mode mode;
+
+       mode = ug_get_mode(ug);
+
+       switch (mode) {
+       case UG_MODE_FULLVIEW:
+       case UG_MODE_FRAMEVIEW:
+               tet_result(TET_PASS);
+               break;
+       default:
+               tet_infoline("ug_get_mode() failed in positive test case");
+               tet_result(TET_FAIL);
+               break;
+       }
+
+       elm_exit();
+       return 0;
+}
+
+/**
+ * @brief Positive test case of ug_get_mode()
+ */
+static void utc_ApplicationFW_ug_get_mode_func_01(void)
+{
+       struct ui_gadget *ug;
+
+       if (init()) {
+               tet_result(TET_UNINITIATED);
+               return;
+       }
+
+       ug = ug_create(NULL, TESTUG, UG_MODE_FULLVIEW, NULL, NULL);
+       if (!ug) {
+               tet_infoline("ug_create() failed");
+               tet_result(TET_UNINITIATED);
+       }
+
+       ecore_idler_add(tst01, ug);
+       elm_run();
+}
+
+static Eina_Bool tst02(void *data)
+{
+       enum ug_mode mode;
+
+       mode = ug_get_mode(NULL);
+
+       switch (mode) {
+       case UG_MODE_INVALID:
+               tet_result(TET_PASS);
+               break;
+       default:
+               tet_infoline("ug_get_mode() failed in negative test case");
+               tet_result(TET_FAIL);
+               break;
+       }
+
+       elm_exit();
+       return 0;
+}
+
+/**
+ * @brief Negative test case of ug_init ug_get_mode()
+ */
+static void utc_ApplicationFW_ug_get_mode_func_02(void)
+{
+       struct ui_gadget *ug;
+
+       if (init()) {
+               tet_result(TET_UNINITIATED);
+               return;
+       }
+
+       ug = ug_create(NULL, TESTUG, UG_MODE_FULLVIEW, NULL, NULL);
+       if (!ug) {
+               tet_infoline("ug_create() failed");
+               tet_result(TET_UNINITIATED);
+       }
+
+       ecore_idler_add(tst02, ug);
+       elm_run();
+
+}
diff --git a/TC/unit/utc_ApplicationFW_ug_get_parent_layout_func.c b/TC/unit/utc_ApplicationFW_ug_get_parent_layout_func.c
new file mode 100644 (file)
index 0000000..0a6a68e
--- /dev/null
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the UI Gadget
+ * Written by Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+#include <tet_api.h>
+#include <ui-gadget.h>
+#include <Elementary.h>
+#include <Ecore_X.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_ApplicationFW_ug_get_parent_layout_func_01(void);
+static void utc_ApplicationFW_ug_get_parent_layout_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_ApplicationFW_ug_get_parent_layout_func_01, POSITIVE_TC_IDX },
+       { utc_ApplicationFW_ug_get_parent_layout_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0},
+};
+
+#define TESTUG "helloUG-efl"
+
+static void startup(void)
+{
+       elm_init(0, NULL);
+}
+
+static void cleanup(void)
+{
+       elm_shutdown();
+}
+
+static int init(void)
+{
+       Evas_Object *win;
+       win = elm_win_add(NULL, "UI gadget test", ELM_WIN_BASIC);
+       if (!win) {
+               tet_infoline("Cannot create window");
+               return -1;
+       }
+
+       if (UG_INIT_EFL(win, UG_OPT_INDICATOR_ENABLE)) {
+               tet_infoline("ug_init() failed");
+               return -1;
+       }
+       return 0;
+}
+
+static Eina_Bool tst01(void *data)
+{
+       Evas_Object *ly;
+       struct ui_gadget *ug = data;
+
+       ly = ug_get_parent_layout(ug);
+       if (!ly) {
+               tet_infoline("ug_get_parent_layout() failed in positive test case");
+               tet_result(TET_FAIL);
+               goto exit;
+       }
+       tet_result(TET_PASS);
+
+exit:
+       elm_exit();
+       return 0;
+}
+
+/**
+ * @brief Positive test case of ug_get_parent_layout()
+ */
+static void utc_ApplicationFW_ug_get_parent_layout_func_01(void)
+{
+       struct ui_gadget *ug;
+
+       if (init()) {
+               tet_result(TET_UNINITIATED);
+               return;
+       }
+
+       ug = ug_create(NULL, TESTUG, UG_MODE_FULLVIEW, NULL, NULL);
+       if (!ug) {
+               tet_infoline("ug_create() failed");
+               tet_result(TET_UNINITIATED);
+       }
+
+       ecore_idler_add(tst01, ug);
+       elm_run();
+}
+
+static Eina_Bool tst02(void *data)
+{
+       Evas_Object *ly;
+
+       ly = ug_get_parent_layout(NULL);
+       if (ly) {
+               tet_infoline("ug_get_parent_layout() failed in negative test case");
+               tet_result(TET_FAIL);
+               goto exit;
+       }
+       tet_result(TET_PASS);
+
+exit:
+       elm_exit();
+       return 0;
+}
+
+/**
+ * @brief Negative test case of ug_init ug_get_parent_layout()
+ */
+static void utc_ApplicationFW_ug_get_parent_layout_func_02(void)
+{
+       struct ui_gadget *ug;
+
+       if (init()) {
+               tet_result(TET_UNINITIATED);
+               return;
+       }
+
+       ug = ug_create(NULL, TESTUG, UG_MODE_FULLVIEW, NULL, NULL);
+       if (!ug) {
+               tet_infoline("ug_create() failed");
+               tet_result(TET_UNINITIATED);
+       }
+
+       ecore_idler_add(tst02, ug);
+       elm_run();
+}
diff --git a/TC/unit/utc_ApplicationFW_ug_get_window_func.c b/TC/unit/utc_ApplicationFW_ug_get_window_func.c
new file mode 100644 (file)
index 0000000..f33a9a4
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the UI Gadget
+ * Written by Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+#include <tet_api.h>
+#include <ui-gadget.h>
+#include <Elementary.h>
+#include <Ecore_X.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_ApplicationFW_ug_get_window_func_01(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_ApplicationFW_ug_get_window_func_01, POSITIVE_TC_IDX },
+       { NULL, 0},
+};
+
+static void startup(void)
+{
+       char *err;
+       Evas_Object *win;
+
+       elm_init(0, NULL);
+       win = elm_win_add(NULL, "UI gadget test", ELM_WIN_BASIC);
+       if (!win) {
+               err = "Cannot create window";
+               goto startup_err;
+       }
+
+       if (UG_INIT_EFL(win, UG_OPT_INDICATOR_ENABLE)) {
+               err = "ug_init() failed";
+               goto startup_err;
+       }
+
+       return;
+
+startup_err:
+       tet_infoline(err);
+       tet_delete(POSITIVE_TC_IDX, err);
+}
+
+
+static void cleanup(void)
+{
+       elm_shutdown();
+}
+
+/**
+ * @brief Positive test case of ug_get_window()
+ */
+static void utc_ApplicationFW_ug_get_window_func_01(void)
+{
+       Evas_Object *win;
+       win = ug_get_window();
+       if (!win) {
+               tet_infoline("ug_get_window() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_ApplicationFW_ug_init_func.c b/TC/unit/utc_ApplicationFW_ug_init_func.c
new file mode 100644 (file)
index 0000000..8d43bfd
--- /dev/null
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the UI Gadget
+ * Written by Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+#include <tet_api.h>
+#include <ui-gadget.h>
+#include <Elementary.h>
+#include <Ecore_X.h>
+
+static Evas_Object *win;
+
+static void startup(void);
+static void cleanup(void);
+
+static void utc_ApplicationFW_ug_init_func_01(void);
+static void utc_ApplicationFW_ug_init_func_02(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_ApplicationFW_ug_init_func_01, POSITIVE_TC_IDX },
+       { utc_ApplicationFW_ug_init_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0},
+};
+
+static void startup(void)
+{
+       char *err;
+       elm_init(0, NULL);
+       win = elm_win_add(NULL, "UI gadget test", ELM_WIN_BASIC);
+       if (!win) {
+               err = "Cannot create window";
+               tet_infoline(err);
+               tet_delete(POSITIVE_TC_IDX, err);
+       }
+}
+
+static void cleanup(void)
+{
+       if (win)
+               evas_object_del(win);
+       elm_shutdown();
+}
+
+/**
+ * @brief Positive test case of ug_init API
+ */
+static void utc_ApplicationFW_ug_init_func_01(void)
+{
+       int r;
+       enum ug_option opt;
+
+       for (opt = UG_OPT_INDICATOR_ENABLE; opt < UG_OPT_MAX; opt++) {
+               r = UG_INIT_EFL(win, UG_OPT_INDICATOR_ENABLE);
+               if (r) {
+                       tet_infoline("ug_init() failed in positive test case");
+                       tet_result(TET_FAIL);
+                       return;
+               }
+       }
+       tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ug_init API
+ */
+static void utc_ApplicationFW_ug_init_func_02(void)
+{
+       int r;
+
+       r = UG_INIT_EFL(win, -1);
+       if (!r) {
+               tet_infoline("ug_init() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       r = UG_INIT_EFL(win, UG_OPT_MAX);
+       if (!r) {
+               tet_infoline("ug_init() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_ApplicationFW_ug_pause_func.c b/TC/unit/utc_ApplicationFW_ug_pause_func.c
new file mode 100644 (file)
index 0000000..159b29e
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the UI Gadget
+ * Written by Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+#include <tet_api.h>
+#include <ui-gadget.h>
+#include <Elementary.h>
+#include <Ecore_X.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_ApplicationFW_ug_pause_func_01(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_ApplicationFW_ug_pause_func_01, POSITIVE_TC_IDX },
+       { NULL, 0},
+};
+
+#define TESTUG "helloUG-efl"
+static struct ui_gadget *ug;
+
+static void startup(void)
+{
+       char *err;
+       Evas_Object *win;
+
+       elm_init(0, NULL);
+       win = elm_win_add(NULL, "UI gadget test", ELM_WIN_BASIC);
+       if (!win) {
+               err = "Cannot create window";
+               goto startup_err;
+       }
+
+       if (UG_INIT_EFL(win, UG_OPT_INDICATOR_ENABLE)) {
+               err = "ug_init() failed";
+               goto startup_err;
+       }
+
+       ug = ug_create(NULL, TESTUG, UG_MODE_FULLVIEW, NULL, NULL);
+       if (!ug) {
+               err = "ug_create() failed";
+               goto startup_err;
+       }
+
+       return;
+
+startup_err:
+       tet_infoline(err);
+       tet_delete(POSITIVE_TC_IDX, err);
+}
+
+static void cleanup(void)
+{
+       elm_shutdown();
+}
+
+static Eina_Bool tst01(void *data)
+{
+       int r = 0;
+
+       r = ug_pause();
+       if (r) {
+               tet_infoline("ug_pause() failed in positive test case");
+               tet_result(TET_FAIL);
+               goto exit;
+       }
+       tet_result(TET_PASS);
+
+exit:
+       elm_exit();
+       return 0;
+}
+
+/**
+ * @brief Positive test case of ug_pause()
+ */
+static void utc_ApplicationFW_ug_pause_func_01(void)
+{
+       ecore_idler_add(tst01, NULL);
+       elm_run();
+}
diff --git a/TC/unit/utc_ApplicationFW_ug_resume_func.c b/TC/unit/utc_ApplicationFW_ug_resume_func.c
new file mode 100644 (file)
index 0000000..8f9d9fa
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the UI Gadget
+ * Written by Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+#include <tet_api.h>
+#include <ui-gadget.h>
+#include <Elementary.h>
+#include <Ecore_X.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_ApplicationFW_ug_resume_func_01(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_ApplicationFW_ug_resume_func_01, POSITIVE_TC_IDX },
+       { NULL, 0},
+};
+
+#define TESTUG "helloUG-efl"
+static struct ui_gadget *ug;
+
+static void startup(void)
+{
+       char *err;
+       Evas_Object *win;
+
+       elm_init(0, NULL);
+       win = elm_win_add(NULL, "UI gadget test", ELM_WIN_BASIC);
+       if (!win) {
+               err = "Cannot create window";
+               goto startup_err;
+       }
+
+       if (UG_INIT_EFL(win, UG_OPT_INDICATOR_ENABLE)) {
+               err = "ug_init() failed";
+               goto startup_err;
+       }
+
+       ug = ug_create(NULL, TESTUG, UG_MODE_FULLVIEW, NULL, NULL);
+       if (!ug) {
+               err = "ug_create() failed";
+               goto startup_err;
+       }
+
+       return;
+
+startup_err:
+       tet_infoline(err);
+       tet_delete(POSITIVE_TC_IDX, err);
+}
+
+static void cleanup(void)
+{
+       elm_shutdown();
+}
+
+static Eina_Bool tst01(void *data)
+{
+       int r = 0;
+
+       r = ug_resume();
+       if (r) {
+               tet_infoline("ug_resume() failed in positive test case");
+               tet_result(TET_FAIL);
+               goto exit;
+       }
+       tet_result(TET_PASS);
+
+exit:
+       elm_exit();
+       return 0;
+}
+
+/**
+ * @brief Positive test case of ug_resume()
+ */
+static void utc_ApplicationFW_ug_resume_func_01(void)
+{
+       ecore_idler_add(tst01, NULL);
+       elm_run();
+}
diff --git a/TC/unit/utc_ApplicationFW_ug_send_event_func.c b/TC/unit/utc_ApplicationFW_ug_send_event_func.c
new file mode 100644 (file)
index 0000000..f4ecb19
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the UI Gadget
+ * Written by Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+#include <tet_api.h>
+#include <ui-gadget.h>
+#include <Elementary.h>
+#include <Ecore_X.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_ApplicationFW_ug_send_event_func_01(void);
+static void utc_ApplicationFW_ug_send_event_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX = 0x01,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_ApplicationFW_ug_send_event_func_01, POSITIVE_TC_IDX },
+       { utc_ApplicationFW_ug_send_event_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0},
+};
+
+#define TESTUG "helloUG-efl"
+
+static void startup(void)
+{
+       char *err;
+       Evas_Object *win;
+       struct ui_gadget *ug;
+
+       elm_init(0, NULL);
+       win = elm_win_add(NULL, "UI gadget test", ELM_WIN_BASIC);
+       if (!win) {
+               err = "Cannot create window";
+               goto startup_err;
+       }
+
+       if (UG_INIT_EFL(win, UG_OPT_INDICATOR_ENABLE)) {
+               err = "ug_init() failed";
+               goto startup_err;
+       }
+
+       ug = ug_create(NULL, TESTUG, UG_MODE_FULLVIEW, NULL, NULL);
+       if (!ug) {
+               err = "ug_create() failed";
+               goto startup_err;
+       }
+
+       return;
+
+startup_err:
+       tet_infoline(err);
+       tet_delete(POSITIVE_TC_IDX, err);
+       tet_delete(NEGATIVE_TC_IDX, err);
+}
+
+static void cleanup(void)
+{
+       elm_shutdown();
+}
+
+/**
+ * @brief Positive test case of ug_send_event()
+ */
+static void utc_ApplicationFW_ug_send_event_func_01(void)
+{
+       int r = 0;
+       enum ug_event evt;
+
+       for (evt = UG_EVENT_LOW_MEMORY; evt < UG_EVENT_MAX; evt++) {
+               r = ug_send_event(evt);
+               if (r) {
+                       tet_infoline("ug_send_event() failed in positive test case");
+                       tet_result(TET_FAIL);
+                       return;
+               }
+       }
+       tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ug_send_event()
+ */
+static void utc_ApplicationFW_ug_send_event_func_02(void)
+{
+       int r = 0;
+
+       r = ug_send_event(UG_EVENT_NONE);
+       if (!r) {
+               tet_infoline("ug_send_event() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       r = ug_send_event(UG_EVENT_MAX);
+       if (!r) {
+               tet_infoline("ug_send_event() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       tet_result(TET_PASS);
+}
+
diff --git a/TC/unit/utc_ApplicationFW_ug_send_message_func.c b/TC/unit/utc_ApplicationFW_ug_send_message_func.c
new file mode 100644 (file)
index 0000000..267f63d
--- /dev/null
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the UI Gadget
+ * Written by Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+#include <tet_api.h>
+#include <ui-gadget.h>
+#include <Elementary.h>
+#include <Ecore_X.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_ApplicationFW_ug_send_message_func_01(void);
+static void utc_ApplicationFW_ug_send_message_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_ApplicationFW_ug_send_message_func_01, POSITIVE_TC_IDX },
+       { utc_ApplicationFW_ug_send_message_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0},
+};
+
+#define TESTUG "helloUG-efl"
+
+static void startup(void)
+{
+       elm_init(0, NULL);
+}
+
+static void cleanup(void)
+{
+       elm_shutdown();
+}
+
+static int init(void)
+{
+       Evas_Object *win;
+       win = elm_win_add(NULL, "UI gadget test", ELM_WIN_BASIC);
+       if (!win) {
+               tet_infoline("Cannot create window");
+               return -1;
+       }
+
+       if (UG_INIT_EFL(win, UG_OPT_INDICATOR_ENABLE)) {
+               tet_infoline("ug_init() failed");
+               return -1;
+       }
+       return 0;
+}
+
+static Eina_Bool tst01(void *data)
+{
+       int r = 0;
+       bundle *msg;
+       struct ui_gadget *ug = data;
+
+       msg = bundle_create();
+       if (!msg) {
+               tet_infoline("bundle_create() failed");
+               tet_result(TET_UNINITIATED);
+               goto exit;
+       }
+       bundle_add(msg, "test", "case");
+
+       r = ug_send_message(ug, msg);
+       if (r) {
+               tet_infoline("ug_send_message() failed in positive test case");
+               tet_result(TET_FAIL);
+               goto exit;
+       }
+       tet_result(TET_PASS);
+
+exit:
+       elm_exit();
+       return 0;
+}
+
+/**
+ * @brief Positive test case of ug_send_message()
+ */
+static void utc_ApplicationFW_ug_send_message_func_01(void)
+{
+       struct ui_gadget *ug;
+
+       if (init()) {
+               tet_result(TET_UNINITIATED);
+               return;
+       }
+
+       ug = ug_create(NULL, TESTUG, UG_MODE_FULLVIEW, NULL, NULL);
+       if (!ug) {
+               tet_infoline("ug_create() failed");
+               tet_result(TET_UNINITIATED);
+       }
+
+       ecore_idler_add(tst01, ug);
+       elm_run();
+}
+
+static Eina_Bool tst02(void *data)
+{
+       int r = 0;
+       bundle *msg;
+       struct ui_gadget *ug = data;
+
+       msg = bundle_create();
+       if (!msg) {
+               tet_infoline("bundle_create() failed");
+               tet_result(TET_UNINITIATED);
+               goto exit;
+       }
+       bundle_add(msg, "test", "case");
+
+       r = ug_send_message(NULL, NULL);
+       if (!r) {
+               tet_infoline("ug_send_message() failed in negative test case");
+               tet_result(TET_FAIL);
+               goto exit;
+       }
+
+       r = ug_send_message(ug, NULL);
+       if (!r) {
+               tet_infoline("ug_send_message() failed in negative test case");
+               tet_result(TET_FAIL);
+               goto exit;
+       }
+
+       r = ug_send_message(NULL, msg);
+       if (!r) {
+               tet_infoline("ug_send_message() failed in negative test case");
+               tet_result(TET_FAIL);
+               goto exit;
+       }
+
+       tet_result(TET_PASS);
+
+exit:
+       elm_exit();
+       return 0;
+}
+
+/**
+ * @brief Negative test case of ug_init ug_send_message()
+ */
+static void utc_ApplicationFW_ug_send_message_func_02(void)
+{
+       struct ui_gadget *ug;
+
+       if (init()) {
+               tet_result(TET_UNINITIATED);
+               return;
+       }
+
+       ug = ug_create(NULL, TESTUG, UG_MODE_FULLVIEW, NULL, NULL);
+       if (!ug) {
+               tet_infoline("ug_create() failed");
+               tet_result(TET_UNINITIATED);
+       }
+
+       ecore_idler_add(tst02, ug);
+       elm_run();
+}
diff --git a/TC/unit/utc_ApplicationFW_ug_send_result_func.c b/TC/unit/utc_ApplicationFW_ug_send_result_func.c
new file mode 100644 (file)
index 0000000..5f93c2a
--- /dev/null
@@ -0,0 +1,193 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the UI Gadget
+ * Written by Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+#include <tet_api.h>
+#include <ui-gadget-module.h>
+#include <Elementary.h>
+#include <Ecore_X.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_ApplicationFW_ug_send_result_func_01(void);
+static void utc_ApplicationFW_ug_send_result_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_ApplicationFW_ug_send_result_func_01, POSITIVE_TC_IDX },
+       { utc_ApplicationFW_ug_send_result_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0},
+};
+
+#define TESTUG "helloUG-efl"
+
+static void startup(void)
+{
+       elm_init(0, NULL);
+}
+
+static void cleanup(void)
+{
+       elm_shutdown();
+}
+
+static int init(void)
+{
+       Evas_Object *win;
+       win = elm_win_add(NULL, "UI gadget test", ELM_WIN_BASIC);
+       if (!win) {
+               tet_infoline("Cannot create window");
+               return -1;
+       }
+
+       if (UG_INIT_EFL(win, UG_OPT_INDICATOR_ENABLE)) {
+               tet_infoline("ug_init() failed");
+               return -1;
+       }
+       return 0;
+}
+
+static Eina_Bool tst01(void *data)
+{
+       int r = 0;
+       bundle *result;
+       struct ui_gadget *ug = data;
+
+       result = bundle_create();
+       if (!result) {
+               tet_infoline("bundle_create() failed");
+               tet_result(TET_UNINITIATED);
+               goto exit;
+       }
+       bundle_add(result, "test", "case");
+
+       r = ug_send_result(ug, result);
+       if (r) {
+               tet_infoline("ug_send_result() failed in positive test case");
+               tet_result(TET_FAIL);
+               goto exit;
+       }
+       tet_result(TET_PASS);
+
+exit:
+       elm_exit();
+       return 0;
+}
+
+static void result_cb(struct ui_gadget *ug, bundle *b, void *priv)
+{
+       // dummy result callback
+}
+
+/**
+ * @brief Positive test case of ug_send_result()
+ */
+static void utc_ApplicationFW_ug_send_result_func_01(void)
+{
+       struct ui_gadget *ug;
+       struct ug_cbs cbs = {0, };
+
+       if (init()) {
+               tet_result(TET_UNINITIATED);
+               return;
+       }
+
+       cbs.result_cb = result_cb;
+
+       ug = ug_create(NULL, TESTUG, UG_MODE_FULLVIEW, NULL, &cbs);
+       if (!ug) {
+               tet_infoline("ug_create() failed");
+               tet_result(TET_UNINITIATED);
+       }
+
+       ecore_idler_add(tst01, ug);
+       elm_run();
+}
+
+static Eina_Bool tst02(void *data)
+{
+       int r = 0;
+       bundle *result;
+       struct ui_gadget *ug = data;
+
+       result = bundle_create();
+       if (!result) {
+               tet_infoline("bundle_create() failed");
+               tet_result(TET_UNINITIATED);
+               goto exit;
+       }
+       bundle_add(result, "test", "case");
+
+       r = ug_send_result(NULL, NULL);
+       if (!r) {
+               tet_infoline("ug_send_result() failed in negative test case");
+               tet_result(TET_FAIL);
+               goto exit;
+       }
+
+       r = ug_send_result(ug, NULL);
+       if (!r) {
+               tet_infoline("ug_send_result() failed in negative test case");
+               tet_result(TET_FAIL);
+               goto exit;
+       }
+
+       r = ug_send_result(NULL, result);
+       if (!r) {
+               tet_infoline("ug_send_result() failed in negative test case");
+               tet_result(TET_FAIL);
+               goto exit;
+       }
+
+       tet_result(TET_PASS);
+exit:
+       elm_exit();
+       return 0;
+}
+
+
+/**
+ * @brief Negative test case of ug_init ug_send_result()
+ */
+static void utc_ApplicationFW_ug_send_result_func_02(void)
+{
+       struct ui_gadget *ug;
+
+       if (init()) {
+               tet_result(TET_UNINITIATED);
+               return;
+       }
+
+       ug = ug_create(NULL, TESTUG, UG_MODE_FULLVIEW, NULL, NULL);
+       if (!ug) {
+               tet_infoline("ug_create() failed");
+               tet_result(TET_UNINITIATED);
+       }
+
+       ecore_idler_add(tst02, ug);
+       elm_run();
+}
diff --git a/TC/unit/utc_MODULE_API_func.c.in b/TC/unit/utc_MODULE_API_func.c.in
new file mode 100644 (file)
index 0000000..bf9f90c
--- /dev/null
@@ -0,0 +1,76 @@
+#include <tet_api.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_@MODULE@_@API@_func_01(void);
+static void utc_@MODULE@_@API@_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_@MODULE@_@API@_func_01, POSITIVE_TC_IDX },
+       { utc_@MODULE@_@API@_func_02, NEGATIVE_TC_IDX },
+};
+
+static void startup(void)
+{
+       int r;
+/*
+       char *err;
+       r = initailze...;
+       if (r) {
+               err = "Error message.......";
+               tet_infoline(err);
+               tet_delete(POSITIVE_TC_IDX, err);
+               tet_delete(NEGATIVE_TC_IDX, err);
+       }
+*/
+
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of @API@()
+ */
+static void utc_@MODULE@_@API@_func_01(void)
+{
+       int r = 0;
+
+/*
+       r = @API@(...);
+*/
+       if (r) {
+               tet_infoline("@API@() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ug_init @API@()
+ */
+static void utc_@MODULE@_@API@_func_02(void)
+{
+       int r = 0;
+
+/*
+       r = @API@(...);
+*/
+       if (!r) {
+               tet_infoline("@API@() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..488bac0
--- /dev/null
@@ -0,0 +1,7 @@
+ui-gadget (0.1.3-66) unstable; urgency=low
+
+  * initial release
+  * Git: slp/pkgs/u/ui-gadget
+  * Tag: ui-gadget_0.1.3-66
+
+ -- Jinwoo Nam <jwoo.nam@samsung.com>  Mon, 12 Mar 2012 11:26:19 +0900
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..7ed6ff8
--- /dev/null
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..08d7c93
--- /dev/null
@@ -0,0 +1,26 @@
+Source: ui-gadget
+Section: devel
+Priority: extra
+Maintainer: Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+Uploaders:
+Build-Depends: debhelper (>= 5),libslp-utilx-dev, libglib2.0-dev, libappcore-efl-dev, libbundle-dev, dlog-dev, libx11-dev
+Standards-Version: 0.1.0
+
+Package: libui-gadget-dev
+Section: libs
+Architecture: any
+XB-Generate-Docs: yes
+Depends: libui-gadget-0 (= ${Source-Version}), libbundle-dev, libx11-dev
+Description: UI gadget library (development headers)
+
+Package: libui-gadget-0
+Section: libs
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: UI gadget library
+
+Package: libui-gadget-dbg
+Section: debug
+Architecture: any
+Depends: libui-gadget-0 (= ${Source-Version}), ${misc:Depends}
+Description: UI gadget library (Debug package)
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..61267d6
--- /dev/null
@@ -0,0 +1,17 @@
+ Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+
+This file is part of the UI Gadget
+Written by Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+
+PROPRIETARY/CONFIDENTIAL
+
+This software is the confidential and proprietary information of
+SAMSUNG ELECTRONICS (Confidential Information).
+You shall not disclose such Confidential Information and shall
+use it only in accordance with the terms of the license agreement
+you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+representations or warranties about the suitability
+of the software, either express or implied, including but not
+limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+a result of using, modifying or distributing this software or its derivatives.
diff --git a/debian/libui-gadget-0.install.in b/debian/libui-gadget-0.install.in
new file mode 100644 (file)
index 0000000..0b1ebaa
--- /dev/null
@@ -0,0 +1,3 @@
+@PREFIX@/lib/libui-gadget.so*
+@PREFIX@/lib/libug-efl-engine.so*
+@PREFIX@/share/edje/*.edj
diff --git a/debian/libui-gadget-dev.install.in b/debian/libui-gadget-dev.install.in
new file mode 100644 (file)
index 0000000..afd977b
--- /dev/null
@@ -0,0 +1,5 @@
+@PREFIX@/include/ui-gadget.h
+@PREFIX@/include/ui-gadget-engine.h
+@PREFIX@/include/ui-gadget-module.h
+@PREFIX@/include/SLP_UI_Gadget_PG.h
+@PREFIX@/lib/pkgconfig/ui-gadget.pc
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..6ff422a
--- /dev/null
@@ -0,0 +1,107 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+CFLAGS ?= -Wall -g
+LDFLAGS += --Wl,--rpath=$(PREFIX)/lib --Wl,--as-needed
+PREFIX ?= /usr
+DATADIR ?= /opt
+
+CMAKE_BUILD_DIR = ${CURDIR}/.build
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+       CFLAGS += -O0
+else
+       CFLAGS += -O2
+endif
+
+configure: configure-stamp
+configure-stamp:
+       dh_testdir
+       # Add here commands to configure the package.
+       mkdir -p ${CMAKE_BUILD_DIR}
+       cd $(CMAKE_BUILD_DIR) && CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" cmake .. -DCMAKE_INSTALL_PREFIX=$(PREFIX)
+       touch configure-stamp
+
+build: build-stamp
+
+build-stamp: configure-stamp 
+       dh_testdir
+
+       cd $(CMAKE_BUILD_DIR) && $(MAKE)
+       #docbook-to-man debian/libui-tab.sgml > libui-tab.1
+
+       for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
+               cat $$f > $${f%.in}; \
+               sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \
+               sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \
+       done
+
+       touch $@
+
+clean:
+       dh_testdir
+       dh_testroot
+       rm -f build-stamp configure-stamp
+       rm -rf $(CMAKE_BUILD_DIR)
+
+       for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
+               rm -f $${f%.in}; \
+       done
+
+       dh_clean 
+
+install: build
+       dh_testdir
+       dh_testroot
+       dh_clean -k 
+       dh_installdirs
+
+       # Add here commands to install the package into debian/libui-tab.
+       cd $(CMAKE_BUILD_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+       dh_testdir
+       dh_testroot
+       dh_installchangelogs 
+       dh_installdocs
+       dh_installexamples
+       dh_install --sourcedir=debian/tmp
+#      dh_installmenu
+#      dh_installdebconf       
+#      dh_installlogrotate
+#      dh_installemacsen
+#      dh_installpam
+#      dh_installmime
+#      dh_python
+#      dh_installinit
+#      dh_installcron
+#      dh_installinfo
+       dh_installman
+       dh_link
+       dh_strip --dbg-package=libui-gadget-dbg
+       dh_compress
+       dh_fixperms
+#      dh_perl
+       dh_makeshlibs
+       dh_installdeb
+       dh_shlibdeps
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
diff --git a/image/SLP_UI_Gadget_PG_image00.png b/image/SLP_UI_Gadget_PG_image00.png
new file mode 100644 (file)
index 0000000..fec5e52
Binary files /dev/null and b/image/SLP_UI_Gadget_PG_image00.png differ
diff --git a/image/SLP_UI_Gadget_PG_image01.png b/image/SLP_UI_Gadget_PG_image01.png
new file mode 100644 (file)
index 0000000..8d4156f
Binary files /dev/null and b/image/SLP_UI_Gadget_PG_image01.png differ
diff --git a/image/SLP_UI_Gadget_PG_image02.png b/image/SLP_UI_Gadget_PG_image02.png
new file mode 100644 (file)
index 0000000..245bfb5
Binary files /dev/null and b/image/SLP_UI_Gadget_PG_image02.png differ
diff --git a/image/SLP_UI_Gadget_PG_image03.png b/image/SLP_UI_Gadget_PG_image03.png
new file mode 100644 (file)
index 0000000..0b69891
Binary files /dev/null and b/image/SLP_UI_Gadget_PG_image03.png differ
diff --git a/include/SLP_UI_Gadget_PG.h b/include/SLP_UI_Gadget_PG.h
new file mode 100644 (file)
index 0000000..24c6253
--- /dev/null
@@ -0,0 +1,795 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the UI Gadget
+ * Written by Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+
+/**
+ *
+ * @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., phonebook, myfile. 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, 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">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 "/test/ug/", and the samples for UI gadget users are in "/test/app/." For instance, "helloUG-efl" codes are in "/test/ug/helloUG-efl/."
+\note <b>Naming rule:</b> The name of UI gadget must be "{NAME}-{UI LIB NAME}", e.g., "helloUG-efl"
+
+<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
+# apt-get install ui-gadget-template
+@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)(struct ui_gadget *ug, enum ug_mode mode, bundle *data, void *priv);
+       void (*start)(struct ui_gadget *ug, bundle *data, void *priv);
+       void (*pause)(struct ui_gadget *ug, bundle *data, void *priv);
+       void (*resume)(struct ui_gadget *ug, bundle *data, void *priv);
+       void (*destroy)(struct ui_gadget *ug, bundle *data, void *priv);
+       void (*message)(struct ui_gadget *ug, bundle *msg, bundle *data, void *priv);
+       void (*event)(struct ui_gadget *ug, enum ug_event event, bundle *data, 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
+@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;
+       struct ui_gadget *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. 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 bundle type data which is named <i>data</i> (see \ref bundle_PG "bundle programming guide") And the argument <i>data</i> is automatically released by UI gadget manager after the UI gadget is destroyed.
+
+@code
+// in helloUG-efl.c
+static void *on_create(struct ui_gadget *ug, enum ug_mode mode, bundle *data, 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, "standard", "window", "integration");
+       // 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;
+
+       // In case of frameview, do not show indicator area
+
+       elm_layout_theme_set(base, "standard", "window", "integration");
+       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_label_label_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_button_label_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_button_label_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. The implementation of start operation is <b>on_start()</b>. In this operation, we do nothing:
+
+@code
+// in helloUG-efl.c
+static void on_start(struct ui_gadget *ug, bundle *data, void *priv)
+{
+
+}
+@endcode
+
+When "helloUG-efl" is destroyed, the destroy operation is invoked. The implementation of destroy operation is <b>on_destroy()</b>. In the method, we delete base layout:
+
+@code
+// in helloUG-efl.c
+static void on_destroy(struct ui_gadget *ug, bundle *data, 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. When the application is brought to the foreground, the resume operation is invoked. Besides, when an UI gadget receives message from its caller, the message operation is invoked. And when a system event is generated, the event operation is invoked. The implementation of pause, resume, message, and event operations are <b>on_pause(), on_resume(), on_message(), and on_event()</b>. In these operations, we do nothing:
+
+@code
+// in helloUG-efl.c
+static void on_pause(struct ui_gadget *ug, bundle *data, void *priv)
+{
+}
+static void on_resume(struct ui_gadget *ug, bundle *data, void *priv)
+{
+}
+
+static void on_message(struct ui_gadget *ug, bundle *msg, bundle *data, void *priv)
+{
+}
+
+static void on_event(struct ui_gadget *ug, enum ug_event event, bundle *data, 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;
+               default:
+                       break;
+       }
+}
+@endcode
+
+\warning Message data of message operation is bundle 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>bundle_dup()</b> which duplicates given bundle data (see \ref bundle_PG "bundle programming guide")
+
+<br>
+<h3 class="pg">Send results and request to destroy</h3>
+Usually, an UI gadget needs to send results or destroy request to the UI gadget caller. To send result, use <b>ug_send_result()</b>, and to send the destroy request, use <b>ug_destroy_me().</b>
+<br>
+We use bundle library for composing result data. The bundle 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 bundle, please see \ref bundle_PG "bundle programming guide".
+
+\warning After send your result data, you have to release it using <b>bundle_free()</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 bundle APIs
+#include <bundle.h>
+
+static void result_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       bundle *b;
+       struct ug_data *ugd;
+
+       if (!data)
+               return;
+
+       ugd = data;
+       b = bundle_create();
+       if (!b)
+               return;
+
+       bundle_add(b, "name", "helloUG-efl");
+       bundle_add(b, "description", "sample UI gadget");
+       //Send result
+       ug_send_result(ugd->ug, b);
+
+       //release bundle
+       bundle_free(b);
+}
+
+static void back_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       struct ug_data *ugd;
+
+       if (!data)
+               return;
+       ugd = data;
+
+       //Send destroy request
+       ug_destroy_me(ugd->ug);
+}
+@endcode
+
+\note <b>To use bundle</b>
+- Install libbundle-dev package
+- Modify CMakeFile.txt to use bundle package as follow:
+@code
+       â€¦
+               pkg_check_modules(pkgs REQUIRED elementary ui-gadget-efl bundle)
+       â€¦
+@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. Fortunately, if you generate your code using UI gadget template, you don't need to worry about <i>dgettext</i> and textdomain because a few macros are kindly provided by template. In helloUG-efl.h, which is a generated private header of "helloUG-efl", there are a few macros for convenience:
+@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
+
+And we used UG_OPT_INDICATOR_ENABLE 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
+@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 "${PREFIX}/lib/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. Because we are using beat style buttons in our UI gadget, we specify "beat" as ELM_THEME.
+Fullview test
+@verbatim
+# ELM_THEME=beat ug-launcher -n helloUG-efl
+@endverbatim
+Frameview test
+@verbatim
+# ELM_THEME=beat ug-launcher -n helloUG-efl -f
+@endverbatim
+
+\note <b>How to install UG launcher</b>
+@verbatim
+# apt-get install ui-gadget-tools
+@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
+
+\image html SLP_UI_Gadget_PG_image03.png "Picture 3. helloUG-efl test: Fullview (left) and Frameview (right)
+
+<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>opti</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():</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, data, 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>data</i> is arguments for the UI gadget which is bundle type (see \ref bundle_PG "bundle programming guide")
+
+\warning After create UI gadget, you have to release the argument using <b>bundle_free()</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 bundle 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>bundle_dup()</b> which duplicates given bundle data (see \ref bundle_PG "bundle programming guide")
+
+\note <b>Prototype of ug_create():</b>
+@code
+struct ui_gadget *ug_create (struct ui_gadget *parent,
+                       const char *name,
+                       enum ug_mode mode,
+                       bundle *data,
+                       struct ug_cbs *cbs);
+
+\note <b>struct ug_cbs</b> is describing some callbacks and private data:
+@code
+struct ug_cbs {
+       void (*layout_cb)(struct ui_gadget *ug, enum ug_mode mode, void *priv);
+       void (*result_cb)(struct ui_gadget *ug, bundle *result, void *priv);
+       void (*destroy_cb)(struct ui_gadget *ug, void *priv);
+       void *priv;
+};
+@endcode
+
+Here are some examples:
+
+@code
+// FULLVIEW example
+struct my_data {
+       struct ui_gadget *ug;
+};
+
+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);
+                       elm_win_resize_object_add(win, base);
+                       evas_object_show(base);
+                       break;
+               default:
+                       break;
+       }
+}
+
+static void result_cb(struct ui_gadget *ug, bundle *result, void *priv)
+{
+       struct my_data *mydata;
+       const char *val;
+
+       if (!ug || !priv)
+               return;
+
+       mydata = priv;
+       if (result) {
+               val = bundle_get_val(result, "name");
+               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(struct ui_gadget *ug, void *priv)
+{
+       struct my_data *mydata;
+
+       if (!ug || !priv)
+               return;
+
+       mydata = priv;
+
+       ug_destroy(ug);
+       mydata->ug = NULL;
+}
+
+struct ui_gadget *create_ug(struct my_data *data)
+{
+       struct ui_gadget *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 {
+       struct ui_gadget *ug;
+       Evas_Object *main_layout;
+};
+
+static void layout_cb(struct ui_gadget *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;
+
+       win = ug_get_window();
+
+       switch (mode) {
+               case UG_MODE_FRAMEVIEW:
+                       elm_layout_content_set(mydata->main_layout, "content", base);
+                       break;
+               default:
+                       break;
+       }
+}
+
+static void result_cb(struct ui_gadget *ug, bundle *result, void *priv)
+{
+       struct my_data *mydata;
+       const char *val;
+
+       if (!ug || !priv)
+               return;
+
+       mydata = priv;
+
+       if (result) {
+               val = bundle_get_val(result, "name");
+               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(struct ui_gadget *ug, void *priv)
+{
+       struct my_data *mydata;
+
+       if (!ug || !priv)
+               return;
+
+       mydata = priv;
+
+       ug_destroy(ug);
+       mydata->ug = NULL;
+}
+
+struct ui_gadget *create_ug(struct my_data *data)
+{
+       struct ui_gadget *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 bundle type data (see \ref bundle_PG "bundle programming guide").
+
+\note <b>Prototype of ug_send_message():</b>
+@code
+int ug_send_message (struct ui_gadget *ug, bundle *msg);
+@endcode
+
+\warning After send your message, you have to release it using <b>bundle_free()</b> API.
+@code
+//example
+bundle *b;
+
+b = bundle_create();
+if (!b)
+       return;
+
+       bundle_add(b, "name", "helloUG-efl");
+       bundle_add(b, "type", "test message");
+
+       //Send message
+       ug_send_message(ug b);
+
+       //release bundle
+       bundle_free(b);
+
+@endcode
+
+<br>
+<h2 class="pg">Propagate event</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, 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():</b>
+@code
+int ug_pause (void);
+int ug_resume (void);
+int ug_send_event (enum ug_event event);
+@endcode
+
+<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: </b>
+@code
+int ug_destroy_all (void);
+@endcode
+
+ * @}
+ */
diff --git a/include/ug-dbg.h b/include/ug-dbg.h
new file mode 100644 (file)
index 0000000..fb4e31b
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the UI Gadget
+ * Written by Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+
+#ifndef __UG_DBG_H__
+#define __UG_DBG_H__
+
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "UIGadget"
+
+#define _ERR(...) LOGE(__VA_ARGS__)
+#define _DBG(...) LOGD(__VA_ARGS__)
+#define _INFO(...) LOGI(__VA_ARGS__)
+
+#endif                         /* __UG_DBG_H__ */
diff --git a/include/ug-engine.h b/include/ug-engine.h
new file mode 100644 (file)
index 0000000..db56f11
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the UI Gadget
+ * Written by Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+
+#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 100644 (file)
index 0000000..dde3ccb
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the UI Gadget
+ * Written by Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+
+#ifndef __UG_MANAGER_H__
+#define __UG_MANAGER_H__
+
+#include <utilX.h>
+#include "ug.h"
+
+int ugman_ug_add(struct ui_gadget *parent, struct ui_gadget *ug);
+struct ui_gadget *ugman_ug_load(struct ui_gadget *parent,
+                               const char *name,
+                               enum ug_mode mode,
+                               bundle *data,
+                               struct ug_cbs *cbs);
+int ugman_ug_del(struct ui_gadget *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(struct ui_gadget *ug, bundle *msg);
+
+void *ugman_get_window(void);
+
+int ugman_ug_exist(struct ui_gadget *ug);
+
+#endif                         /* __UG_MANAGER_H__ */
diff --git a/include/ug-module.h b/include/ug-module.h
new file mode 100644 (file)
index 0000000..cf11933
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the UI Gadget
+ * Written by Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+
+#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 100644 (file)
index 0000000..dbdfebf
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the UI Gadget
+ * Written by Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+
+#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 {
+       const char *name;
+       void *layout;
+       enum ug_state state;
+       enum ug_mode mode;
+       enum ug_option opt;
+
+       struct ui_gadget *parent;
+       void *children;
+
+       struct ug_module *module;
+       struct ug_cbs cbs;
+
+       bundle *data;
+
+       int destroy_me:1;
+       enum ug_layout_state layout_state;
+       void *effect_layout;
+};
+
+struct ui_gadget *ug_root_create(void);
+int ug_free(struct ui_gadget *ug);
+
+#endif                         /* __UG_H__ */
diff --git a/include/ui-gadget-engine.h b/include/ui-gadget-engine.h
new file mode 100644 (file)
index 0000000..5a2bfdf
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the UI Gadget
+ * Written by Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+
+#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, struct ui_gadget *ug, void(*hide_end_cb)(struct ui_gadget *ug));
+       /** destroy operation */
+       void (*destroy)(struct ui_gadget *ug, struct ui_gadget *fv_top);
+       /** 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 100644 (file)
index 0000000..acedaf8
--- /dev/null
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the UI Gadget
+ * Written by Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+
+#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 <bundle.h>
+#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) (struct ui_gadget *ug, enum ug_mode mode, bundle *data,
+                                       void *priv);
+       /** start operation */
+       void (*start) (struct ui_gadget *ug, bundle *data, void *priv);
+       /** pause operation */
+       void (*pause) (struct ui_gadget *ug, bundle *data, void *priv);
+       /** resume operation */
+       void (*resume) (struct ui_gadget *ug, bundle *data, void *priv);
+       /** destroy operation */
+       void (*destroy) (struct ui_gadget *ug, bundle *data, void *priv);
+       /** message operation */
+       void (*message) (struct ui_gadget *ug, bundle *msg, bundle *data, void *priv);
+       /** event operation */
+       void (*event) (struct ui_gadget *ug, enum ug_event event, bundle *data,
+                               void *priv);
+       /** key event operation */
+       void (*key_event) (struct ui_gadget *ug, enum ug_key_event event,
+                                       bundle *data, void *priv);
+       /** destroying operation */
+       void (*destroying) (struct ui_gadget *ug, bundle *data, 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(struct ui_gadget *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 bundle library.
+ *
+ * \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 bundle type (see \ref bundle_PG "bundle programming 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 bundle_free()
+ *
+ * \par Sample code:
+ * \code
+ * #include <ui-gadget-module.h>
+ * ...
+ * // make a result with bundle
+ * bundle *b;
+ * b = bundle_create();
+ * bundle_add(b, "Content", "Hello");
+ *
+ * // send the result
+ * ug_send_result(ug, b);
+ *
+ * // release the result
+ * bundle_free(b);
+ * ...
+ * \endcode
+ */
+int ug_send_result(struct ui_gadget *ug, bundle *result);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+#endif                         /* __UI_GADGET_MODULE_H__ */
diff --git a/include/ui-gadget.h b/include/ui-gadget.h
new file mode 100644 (file)
index 0000000..ddd6d14
--- /dev/null
@@ -0,0 +1,713 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the UI Gadget
+ * Written by Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+
+#ifndef __UI_GADGET_H__
+#define __UI_GADGET_H__
+
+/**
+ * @file       ui-gadget.h
+ * @author     Wonguk Jeong <wonguk.jeong@samsung.com>
+ * @version    0.1
+ * @brief      This file contains the public API of the UI gadget library
+ */
+
+/**
+ * @addtogroup APPLICATION_FRAMEWORK
+ * @{
+ *
+ * @defgroup   UI_Gadget UI gadget library
+ * @author     Wonguk Jeong <wonguk.jeong@samsung.com>
+ * @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 <bundle.h>
+#include <X11/Xlib.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()
+ */
+struct ui_gadget;
+
+/**
+ * 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
+};
+
+#define UG_OPT_INDICATOR_MASK (0x03)
+#define UG_OPT_INDICATOR(opt) (opt & UG_OPT_INDICATOR_MASK)
+
+/**
+ * UI gadget option
+ * - Indicator option: [1, 0] bits
+ *
+ * @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_MAX
+};
+
+/**
+ * UI gadget callback type
+ * @see ug_create()
+ */
+struct ug_cbs {
+       /** layout callback */
+       void (*layout_cb) (struct ui_gadget *ug, enum ug_mode mode,
+                               void *priv);
+       /** result callback */
+       void (*result_cb) (struct ui_gadget *ug, bundle *result, void *priv);
+       /** destroy callback */
+       void (*destroy_cb) (struct ui_gadget *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] data argument for the UI gadget  (see \ref bundle_PG "bundle programming 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 "data" bundle, you MUST release it using bundle_free() after ug_create()
+ *
+ * \par Sample code:
+ * \code
+ * #include <ui-gadget.h>
+ * ...
+ * bundle *b;
+ * struct ui_gadget *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
+ * b = bundle_create();
+ * bundle_add(b, "Content", "Hello");
+ *
+ * // create "helloUG-efl" UI gadget instance
+ * ug = ug_create(NULL, "helloUG-efl", UG_MODE_FULLVIEW, b, &cbs);
+ *
+ * // release arguments
+ * bundle_free(b);
+ * ...
+ * \endcode
+ */
+struct ui_gadget *ug_create(struct ui_gadget *parent, const char *name,
+                                       enum ug_mode mode, bundle *data,
+                                       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(struct ui_gadget *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(struct ui_gadget *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(struct ui_gadget *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(ug);
+ * ...
+ * \endcode
+ */
+void *ug_get_window(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(struct ui_gadget *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 bundle library.
+ *
+ * \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 bundle type (see \ref bundle_PG "bundle programming 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 bundle_free()
+ *
+ * \par Sample code:
+ * \code
+ * #include <ui-gadget.h>
+ * ...
+ * // make a message with bundle
+ * bundle *b;
+ * b = bundle_create();
+ * bundle_add(b, "Content", "Hello");
+ *
+ * // send the message
+ * ug_send_message(ug, b);
+ *
+ * // release the message
+ * bundle_free(b);
+ * ...
+ * \endcode
+ */
+int ug_send_message(struct ui_gadget *ug, bundle *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(struct ui_gadget *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(struct ui_gadget *ug);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @} @} @}
+ */
+#endif                         /* __UI_GADGET_H__ */
diff --git a/packaging/ui-gadget.spec b/packaging/ui-gadget.spec
new file mode 100644 (file)
index 0000000..d115b25
--- /dev/null
@@ -0,0 +1,74 @@
+
+Name:       ui-gadget
+Summary:    UI Gadget Library
+Version:    0.1.3
+Release:    66
+Group:      TO_BE/FILLED_IN
+License:    Samsung Proprietary License
+Source0:    ui-gadget-%{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:  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 -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+
+
+
+
+
+
+
+%files
+%defattr(-,root,root,-)
+%{_libdir}/*.so.*
+%{_libdir}/libug-efl-engine.so
+/usr/share/edje/ug_effect.edj
+
+%files devel
+%defattr(-,root,root,-)
+%{_includedir}/*.h
+%{_libdir}/*.so
+%{_libdir}/pkgconfig/ui-gadget.pc
+
diff --git a/src/engine.c b/src/engine.c
new file mode 100644 (file)
index 0000000..68d887b
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the UI Gadget
+ * Written by Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+
+#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/libug-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\n", dlerror());
+               goto engine_free;
+       }
+
+       engine_init = dlsym(handle, UG_ENGINE_INIT_SYM);
+       if (!engine_init) {
+               _ERR("dlsym failed: %s\n", 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\n", dlerror());
+
+               dlclose(engine->handle);
+       }
+
+       free(engine);
+       return 0;
+}
diff --git a/src/manager.c b/src/manager.c
new file mode 100755 (executable)
index 0000000..5cfc7e3
--- /dev/null
@@ -0,0 +1,804 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the UI Gadget
+ * Written by Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <glib.h>
+#include <utilX.h>
+
+#include "ug.h"
+#include "ug-manager.h"
+#include "ug-engine.h"
+#include "ug-dbg.h"
+
+struct ug_manager {
+       struct ui_gadget *root;
+       struct ui_gadget *fv_top;
+       GSList *fv_list;
+
+       void *win;
+       Window win_id;
+       Display *disp;
+
+       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(struct ui_gadget *p, struct ui_gadget *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(struct ui_gadget *ug)
+{
+       struct ui_gadget *p;
+
+       p = ug->parent;
+       if (!p) {
+               _ERR("ug_relation_del failed: no parent\n");
+               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(struct ui_gadget *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(struct ui_gadget *c)
+{
+       struct ui_gadget *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(struct ui_gadget *ug)
+{
+       static int i;
+       int lv;
+       const char *name;
+       GSList *child;
+       struct ui_gadget *c;
+
+       if (!ug)
+               return;
+
+       name = ug->name;
+       if (ug == ug_man.root) {
+               i = 0;
+               _DBG("\n============== TREE_DUMP =============\n");
+               _DBG("ROOT: Manager\n");
+               name = "Manager";
+       }
+
+       child = ug->children;
+       if (!child)
+               return;
+
+       i++;
+       lv = i;
+
+       while (child) {
+               c = child->data;
+               _DBG("[%d] %s [%c] (%p) (PARENT:  %s)\n",
+                    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(struct ui_gadget *p, struct ui_gadget *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)
+{
+       struct ui_gadget *ug = data;
+       struct ug_module_ops *ops = NULL;
+
+       if (!ug || ug->state != UG_STATE_CREATED
+           || ug->state == UG_STATE_RUNNING)
+               return 0;
+
+       ug->state = UG_STATE_RUNNING;
+
+       if (ug->module)
+               ops = &ug->module->ops;
+
+       if (ops && ops->start)
+               ops->start(ug, ug->data, ops->priv);
+
+       return 0;
+}
+
+static int ugman_ug_pause(void *data)
+{
+       struct ui_gadget *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->data, ops->priv);
+
+ end:
+       job_end();
+       return 0;
+}
+
+static int ugman_ug_resume(void *data)
+{
+       struct ui_gadget *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->data, ops->priv);
+
+ end:
+       job_end();
+       return 0;
+}
+
+static int ugman_indicator_update(enum ug_option opt, enum ug_event event)
+{
+       int enable;
+       int cur_state;
+
+       if (!ug_man.win) {
+               _ERR("ugman_indicator_update failed: no window\n");
+               return -1;
+       }
+
+       switch (UG_OPT_INDICATOR(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;
+       default:
+               _ERR("ugman_indicator_update failed: Invalid opt\n");
+               return -1;
+       }
+
+       utilx_enable_indicator(ug_man.disp, ug_man.win_id, enable);
+
+       return 0;
+}
+
+static int ugman_ug_getopt(struct ui_gadget *ug)
+{
+       if (!ug)
+               return -1;
+       /* Indicator Option */
+       if (ug->mode == UG_MODE_FULLVIEW)
+               ugman_indicator_update(UG_OPT_INDICATOR(ug->opt), UG_EVENT_NONE);
+
+       return 0;
+}
+
+static int ugman_ug_event(struct ui_gadget *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->data, ops->priv);
+
+       return 0;
+}
+
+static int ugman_ug_destroy(void *data)
+{
+       struct ui_gadget *ug = data;
+       struct ug_module_ops *ops = NULL;
+       GSList *child, *trail;
+
+       job_start();
+
+       if (!ug)
+               goto end;
+
+       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)
+               ops->destroy(ug, ug->data, 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(struct ui_gadget *ug)
+{
+       g_idle_add(ugman_ug_destroy, ug);
+}
+
+static int ugman_ug_create(void *data)
+{
+       struct ui_gadget *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->data, ops->priv);
+               if (!ug->layout) {
+                       ug_relation_del(ug);
+                       return -1;
+               }
+
+               if (ug->mode == (UG_MODE_FULLVIEW)) {
+                       if (eng_ops && eng_ops->create)
+                               ug->effect_layout = eng_ops->create(ug_man.win, ug, ug_hide_end_cb);
+               }
+               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);
+       ugman_ug_start(ug);
+       ugman_tree_dump(ug_man.root);
+
+       return 0;
+}
+
+int ugman_ug_add(struct ui_gadget *parent, struct ui_gadget *ug)
+{
+       if (!ug_man.is_initted) {
+               _ERR("ugman_ug_add failed: manager is not initted\n");
+               return -1;
+       }
+
+       if (!ug_man.root) {
+               if (parent) {
+                       _ERR("ugman_ug_add failed: parent has to be NULL w/o root\n");
+                       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;
+}
+
+struct ui_gadget *ugman_ug_load(struct ui_gadget *parent,
+                               const char *name,
+                               enum ug_mode mode,
+                               bundle *data, struct ug_cbs *cbs)
+{
+       int r;
+       struct ui_gadget *ug;
+
+       ug = calloc(1, sizeof(struct ui_gadget));
+       if (!ug) {
+               _ERR("ug_create() failed: Memory allocation failed\n");
+               return NULL;
+       }
+
+       ug->module = ug_module_load(name);
+       if (!ug->module) {
+               _ERR("ug_create() failed: Module loading failed\n");
+               goto load_fail;
+       }
+
+       ug->name = strdup(name);
+
+       ug->mode = mode;
+       ug->data = bundle_dup(data);
+       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\n");
+               goto load_fail;
+       }
+
+       return ug;
+
+ load_fail:
+       ug_free(ug);
+       return NULL;
+}
+
+int ugman_ug_destroying(struct ui_gadget *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->data, ops->priv);
+
+       return 0;
+}
+
+int ugman_ug_del(struct ui_gadget *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\n");
+               errno = EINVAL;
+               return -1;
+       }
+
+       if (ug->destroy_me) {
+               _ERR("ugman_ug_del failed: ug is alreay on destroying\n");
+               return -1;
+       }
+
+       if (!ug_man.is_initted) {
+               _ERR("ugman_ug_del failed: manager is not initted\n");
+               return -1;
+       }
+
+       if (!ug_man.root) {
+               _ERR("ugman_ug_del failed: no root\n");
+               return -1;
+       }
+
+       ugman_ug_destroying(ug);
+
+       if (ug->mode == UG_MODE_FULLVIEW) {
+               if (ug_man.engine)
+                       eng_ops = &ug_man.engine->ops;
+
+               if (eng_ops && eng_ops->destroy) {
+                       eng_ops->destroy(ug, ug_man.fv_top);
+               }
+               else {
+                       g_idle_add(ugman_ug_destroy, ug);
+               }
+       }
+       else {
+               g_idle_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\n");
+               return -1;
+       }
+
+       if (!ug_man.root) {
+               _ERR("ugman_ug_del_all failed: no root\n");
+               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\n");
+               return -1;
+       }
+
+       if (!ug_man.root) {
+               _ERR("ugman_resume failed: no root\n");
+               return -1;
+       }
+
+       g_idle_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\n");
+               return -1;
+       }
+
+       if (!ug_man.root) {
+               _ERR("ugman_pause failed: no root\n");
+               return -1;
+       }
+
+       g_idle_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\n");
+               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\n");
+               return -1;
+       }
+
+       g_idle_add(ugman_send_event_pre, (void *)event);
+
+       if (is_rotation && ug_man.fv_top)
+               ugman_indicator_update(UG_OPT_INDICATOR(ug_man.fv_top->opt), event);
+
+       return 0;
+}
+
+static int ugman_send_key_event_to_ug(struct ui_gadget *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->data, 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\n");
+               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\n");
+               return -1;
+       }
+
+       return ugman_send_key_event_to_ug(ug_man.fv_top, event);
+}
+
+int ugman_send_message(struct ui_gadget *ug, bundle *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\n");
+               errno = EINVAL;
+               return -1;
+       }
+
+       if (!msg) {
+               _ERR("ugman_send_message failed: Invalid msg\n");
+               errno = EINVAL;
+               return -1;
+       }
+
+       if (ug->module)
+               ops = &ug->module->ops;
+
+       if (ops && ops->message)
+               ops->message(ug, msg, ug->data, ops->priv);
+
+       return 0;
+}
+
+void *ugman_get_window(void)
+{
+       return ug_man.win;
+}
+
+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(struct ui_gadget *ug)
+{
+       return ugman_ug_find(ug_man.root, ug);
+}
diff --git a/src/module.c b/src/module.c
new file mode 100644 (file)
index 0000000..661b8cc
--- /dev/null
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the UI Gadget
+ * Written by Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+
+#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-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 0;
+       }
+
+       return -1;
+}
+
+struct ug_module *ug_module_load(const char *name)
+{
+       void *handle;
+       struct ug_module *module;
+       char ug_file[PATH_MAX];
+
+       char *pkg_name = NULL;
+       uid_t uid;
+
+       int (*module_init) (struct ug_module_ops *ops);
+
+       module = calloc(1, sizeof(struct ug_module));
+
+       if (!module) {
+               errno = ENOMEM;
+               return NULL;
+       }
+
+       pkg_name = getenv("PKG_NAME");
+       uid = geteuid();
+
+       if (pkg_name) {
+               if (snprintf
+                   (ug_file, PATH_MAX, "/opt/apps/%s/lib/libug-%s.so",
+                    pkg_name, name) < 0) {
+                       goto module_free;
+               } else if (file_exist(ug_file) < 0) {
+                       if (snprintf
+                           (ug_file, PATH_MAX, "/usr/ug/lib/libug-%s.so",
+                            name) < 0) {
+                               goto module_free;
+                       } else if (file_exist(ug_file) < 0) {
+                               if (snprintf
+                                   (ug_file, PATH_MAX,
+                                    "/opt/ug/lib/libug-%s.so", name) < 0) {
+                                       goto module_free;
+                               } else if (file_exist(ug_file) < 0) {
+                                       goto module_free;
+                               }
+                       }
+               }
+       } else {
+               if (snprintf(ug_file, PATH_MAX, "/usr/ug/lib/libug-%s.so", name)
+                   < 0) {
+                       goto module_free;
+               } else if (file_exist(ug_file) < 0) {
+                       if (snprintf
+                           (ug_file, PATH_MAX, "/opt/ug/lib/libug-%s.so",
+                            name) < 0) {
+                               goto module_free;
+                       } else if (file_exist(ug_file) < 0) {
+                               goto module_free;
+                       }
+               }
+       }
+
+       handle = dlopen(ug_file, RTLD_LAZY);
+       if (!handle) {
+               _ERR("dlopen failed: %s\n", dlerror());
+               goto module_free;
+       }
+
+       module_init = dlsym(handle, UG_MODULE_INIT_SYM);
+       if (!module_init) {
+               _ERR("dlsym failed: %s\n", 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\n", dlerror());
+
+               dlclose(module->handle);
+       }
+
+       free(module);
+       return 0;
+}
diff --git a/src/ug.c b/src/ug.c
new file mode 100644 (file)
index 0000000..19527fe
--- /dev/null
+++ b/src/ug.c
@@ -0,0 +1,272 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the UI Gadget
+ * Written by Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+
+#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
+
+struct ui_gadget *ug_root_create(void)
+{
+       struct ui_gadget *ug;
+
+       ug = calloc(1, sizeof(struct ui_gadget));
+       if (!ug) {
+               _ERR("ug root create failed: Memory allocation failed\n");
+               return NULL;
+       }
+
+       ug->mode = UG_MODE_FULLVIEW;
+       ug->state = UG_STATE_RUNNING;
+       ug->children = NULL;
+
+       return ug;
+}
+
+int ug_free(struct ui_gadget *ug)
+{
+       if (!ug) {
+               _ERR("ug free failed: Invalid ug\n");
+               errno = EINVAL;
+               return -1;
+       }
+
+       if (ug->module)
+               ug_module_unload(ug->module);
+       if (ug->name)
+               free((void *)ug->name);
+       if (ug->data)
+               bundle_free(ug->data);
+       free(ug);
+       return 0;
+}
+
+UG_API struct ui_gadget *ug_create(struct ui_gadget *parent,
+                                  const char *name,
+                                  enum ug_mode mode,
+                                  bundle *data, struct ug_cbs *cbs)
+{
+       if (!name) {
+               _ERR("ug_create() failed: Invalid name\n");
+               errno = EINVAL;
+               return NULL;
+       }
+
+       if (mode < UG_MODE_FULLVIEW || mode >= UG_MODE_INVALID) {
+               _ERR("ug_create() failed: Invalid mode\n");
+               errno = EINVAL;
+               return NULL;
+       }
+
+       return ugman_ug_load(parent, name, mode, data, 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\n");
+               return -1;
+       }
+
+       if (opt < UG_OPT_INDICATOR_ENABLE || opt >= UG_OPT_MAX) {
+               _ERR("ug_init() failed: Invalid option\n");
+               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(struct ui_gadget *ug)
+{
+       return ugman_ug_del(ug);
+}
+
+UG_API int ug_destroy_all(void)
+{
+       return ugman_ug_del_all();
+}
+
+UG_API int ug_destroy_me(struct ui_gadget *ug)
+{
+       if (!ug || !ugman_ug_exist(ug)) {
+               _ERR("ug_destroy_me() failed: Invalid ug\n");
+               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\n");
+               return -1;
+       }
+
+       ug->cbs.destroy_cb(ug, ug->cbs.priv);
+       return 0;
+}
+
+UG_API void *ug_get_layout(struct ui_gadget *ug)
+{
+       if (!ug || !ugman_ug_exist(ug)) {
+               _ERR("ug_get_layout() failed: Invalid ug\n");
+               errno = EINVAL;
+               return NULL;
+       }
+       return ug->layout;
+}
+
+UG_API void *ug_get_parent_layout(struct ui_gadget *ug)
+{
+       struct ui_gadget *parent;
+       if (!ug || !ugman_ug_exist(ug)) {
+               _ERR("ug_get_parent_layout() failed: Invalid ug\n");
+               errno = EINVAL;
+               return NULL;
+       }
+
+       parent = ug->parent;
+
+       if (parent)
+               return parent->layout;
+       return NULL;
+}
+
+UG_API enum ug_mode ug_get_mode(struct ui_gadget *ug)
+{
+       if (!ug || !ugman_ug_exist(ug)) {
+               _ERR("ug_get_mode() failed: Invalid ug\n");
+               errno = EINVAL;
+               return UG_MODE_INVALID;
+       }
+
+       return ug->mode;
+}
+
+UG_API void *ug_get_window(void)
+{
+       return ugman_get_window();
+}
+
+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\n");
+               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\n");
+               return -1;
+       }
+
+       return ugman_send_key_event(event);
+}
+
+UG_API int ug_send_result(struct ui_gadget *ug, bundle *result)
+{
+       bundle *result_dup = NULL;
+
+       if (!ug || !ugman_ug_exist(ug)) {
+               _ERR("ug_send_result() failed: Invalid ug\n");
+               errno = EINVAL;
+               return -1;
+       }
+
+       if (!ug->cbs.result_cb) {
+               _ERR("ug_send_result() failed: result callback does not exist\n");
+               return -1;
+       }
+
+       if (result) {
+               result_dup = bundle_dup(result);
+               if (!result_dup) {
+                       _ERR("ug_send_result() failed: bundle_dup failed\n");
+                       return -1;
+               }
+       }
+
+       ug->cbs.result_cb(ug, result_dup, ug->cbs.priv);
+
+       if (result_dup)
+               bundle_free(result_dup);
+
+       return 0;
+}
+
+UG_API int ug_send_message(struct ui_gadget *ug, bundle *msg)
+{
+       int r;
+
+       bundle *msg_dup = NULL;
+       if (msg) {
+               msg_dup = bundle_dup(msg);
+               if (!msg_dup) {
+                       _ERR("ug_send_message() failed: bundle_dup failed\n");
+                       return -1;
+               }
+       }
+
+       r = ugman_send_message(ug, msg_dup);
+
+       if (msg_dup)
+               bundle_free(msg_dup);
+
+       return r;
+}
+
+UG_API int ug_disable_effect(struct ui_gadget *ug)
+{
+       if (ug->layout_state != UG_LAYOUT_INIT) {
+               _ERR("ug_disable_effect() failed: ug has already been shown\n");
+               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 100644 (file)
index 0000000..e576933
--- /dev/null
@@ -0,0 +1,36 @@
+SET(UG_EFL_ENGINE ug-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
+       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 (executable)
index 0000000..df4bcd2
--- /dev/null
@@ -0,0 +1,261 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the UI Gadget
+ * Written by Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+
+
+
+#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 void _on_hideonly_cb(void *data, Evas_Object *obj)
+{
+       struct ui_gadget *ug = (struct ui_gadget *)data;
+       if (!ug)
+               return;
+
+       if (ug->layout_state == UG_LAYOUT_SHOW) {
+               ug->layout_state = UG_LAYOUT_HIDEEFFECT;
+               edje_object_signal_emit(elm_layout_edje_get(ug->effect_layout),
+                                       "elm,state,hideonly", "");
+       }
+}
+
+static void _signal_hideonly_finished(void *data, Evas_Object *obj,
+                                     const char *emission, const char *source)
+{
+       struct ui_gadget *ug = (struct ui_gadget *)data;
+       if (!ug)
+               return;
+
+       evas_object_intercept_hide_callback_del(ug->layout, _on_hideonly_cb);
+
+       evas_object_hide(ug->layout);
+       elm_object_part_content_unset(ug->effect_layout, "elm.swallow.content");
+
+       if (ug->layout_state == UG_LAYOUT_NOEFFECT)
+               return;
+
+       evas_object_hide(ug->effect_layout);
+
+       if (ug->layout_state == UG_LAYOUT_DESTROY)
+               edje_object_signal_emit(elm_layout_edje_get(ug->effect_layout),
+                                       "elm,state,hidealready", "");
+       else
+               ug->layout_state = UG_LAYOUT_HIDE;
+}
+
+static void _signal_hide_finished(void *data, Evas_Object *obj,
+                                 const char *emission, const char *source)
+{
+       struct ui_gadget *ug = (struct ui_gadget *)data;
+       if (!ug)
+               return;
+
+       evas_object_intercept_hide_callback_del(ug->layout, _on_hideonly_cb);
+
+       evas_object_hide(ug->layout);
+       elm_object_part_content_unset(ug->effect_layout, "elm.swallow.content");
+       evas_object_hide(ug->effect_layout);
+       evas_object_del(ug->effect_layout);
+       ug->effect_layout = NULL;
+}
+
+static void _del_effect_layout(struct ui_gadget *ug)
+{
+       if (!ug || !ug->effect_layout)
+               return;
+
+       evas_object_intercept_hide_callback_del(ug->layout, _on_hideonly_cb);
+
+       evas_object_hide(ug->layout);
+       elm_object_part_content_unset(ug->effect_layout, "elm.swallow.content");
+       evas_object_hide(ug->effect_layout);
+       evas_object_del(ug->effect_layout);
+       ug->effect_layout = NULL;
+}
+
+static void _signal_hidealready_finished(void *data, Evas_Object *obj,
+                               const char *emission, const char *source)
+{
+       _del_effect_layout((struct ui_gadget*)data);
+}
+
+static void _do_destroy(struct ui_gadget *ug, struct ui_gadget *fv_top)
+{
+       GSList *child;
+       GSList *trail;
+       static int depth = 0;
+
+       if (ug->children) {
+               child = ug->children;
+               while (child) {
+                       trail = g_slist_next(child);
+                       depth++;
+                       _do_destroy(child->data, fv_top);
+                       depth--;
+                       child = trail;
+               }
+       }
+
+       _DBG("[UG Effect Plug-in] : start destroy. ug(%p), fv_top(%p),"
+                                       " depth(%d), layout_state(%d)\n",
+                                        ug, fv_top, depth, ug->layout_state);
+       /* only show transition effect of top view UG */
+       if (ug != fv_top) {
+               if (depth) {
+                       _del_effect_layout(ug);
+                       return;
+               }
+       }
+
+       if (ug->layout_state == UG_LAYOUT_SHOW) {
+               evas_object_intercept_hide_callback_del(ug->layout,
+                                                       _on_hideonly_cb);
+               edje_object_signal_emit(elm_layout_edje_get(ug->effect_layout),
+                                       "elm,state,hide", "");
+       } else if (ug->layout_state == UG_LAYOUT_HIDE
+                  || ug->layout_state == UG_LAYOUT_NOEFFECT) {
+               edje_object_signal_emit(elm_layout_edje_get(ug->effect_layout),
+                                       "elm,state,hidealready", "");
+       } 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 on_destroy(struct ui_gadget *ug, struct ui_gadget *fv_top)
+{
+       if (!ug)
+               return;
+       _do_destroy(ug, fv_top);
+}
+
+static void _signal_show_finished(void *data, Evas_Object *obj,
+                                 const char *emission, const char *source)
+{
+       struct ui_gadget *ug = (struct ui_gadget *)data;
+       if (!ug)
+               return;
+
+       if (ug->layout_state == UG_LAYOUT_NOEFFECT)
+               return;
+
+       if (ug->layout_state == UG_LAYOUT_DESTROY)
+               edje_object_signal_emit(elm_layout_edje_get(ug->effect_layout),
+                                       "elm,state,hide", "");
+       else
+               ug->layout_state = UG_LAYOUT_SHOW;
+}
+
+static void on_show_cb(void *data, Evas *e, Evas_Object *obj,
+                      void *event_info)
+{
+       struct ui_gadget *ug = (struct ui_gadget *)data;
+       if (!ug)
+               return;
+
+       if (ug->layout_state == UG_LAYOUT_NOEFFECT) {
+               evas_object_hide(ug->effect_layout);
+               evas_object_show(ug->layout);
+               return;
+       }
+
+       if (ug->layout_state == UG_LAYOUT_HIDE
+           || ug->layout_state == UG_LAYOUT_INIT) {
+               ug->layout_state = UG_LAYOUT_SHOWEFFECT;
+               evas_object_show(ug->effect_layout);
+               elm_object_part_content_set(ug->effect_layout, "elm.swallow.content",
+                                      ug->layout);
+               evas_object_intercept_hide_callback_add(ug->layout,
+                                                       _on_hideonly_cb, ug);
+               edje_object_signal_emit(elm_layout_edje_get(ug->effect_layout),
+                                       "elm,state,show", "");
+       }
+}
+
+static void *on_create(void *win, struct ui_gadget *ug,
+                      void (*hide_end_cb) (struct ui_gadget * ug))
+{
+       static const char *ug_effect_edj_name = "/usr/share/edje/ug_effect.edj";
+
+       Evas_Object *ly = elm_layout_add((Evas_Object *) win);
+
+       if (!ly)
+               return NULL;
+
+       evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND,
+                                        EVAS_HINT_EXPAND);
+       elm_win_resize_object_add((Evas_Object *) win, ly);
+       elm_layout_file_set(ly, ug_effect_edj_name, "ug_effect");
+       evas_object_show(ly);
+
+       evas_object_hide(ug->layout);
+       edje_object_signal_callback_add(elm_layout_edje_get(ly),
+                                       "elm,action,hide,finished", "",
+                                       _signal_hide_finished, ug);
+       edje_object_signal_callback_add(elm_layout_edje_get(ly),
+                                       "elm,action,hide,finished", "",
+                                       (Edje_Signal_Cb) hide_end_cb, ug);
+       edje_object_signal_callback_add(elm_layout_edje_get(ly),
+                                       "elm,action,hidealready,finished", "",
+                                       _signal_hidealready_finished, ug);
+       edje_object_signal_callback_add(elm_layout_edje_get(ly),
+                                       "elm,action,hidealready,finished", "",
+                                       (Edje_Signal_Cb) hide_end_cb, ug);
+       edje_object_signal_callback_add(elm_layout_edje_get(ly),
+                                       "elm,action,hideonly,finished", "",
+                                       _signal_hideonly_finished, ug);
+       edje_object_signal_callback_add(elm_layout_edje_get(ly),
+                                       "elm,action,show,finished", "",
+                                       _signal_show_finished, ug);
+
+       evas_object_event_callback_add(ug->layout, EVAS_CALLBACK_SHOW,
+                                      on_show_cb, ug);
+
+       ug->layout_state = UG_LAYOUT_INIT;
+
+       return ly;
+}
+
+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 (file)
index 0000000..c76e7b1
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This file is part of the UI Gadget
+ * Written by Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of
+ * SAMSUNG ELECTRONICS (Confidential Information).
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement
+ * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
+ * representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
+ * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ *
+ */
+
+
+
+#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 (file)
index 0000000..8e93125
--- /dev/null
@@ -0,0 +1,135 @@
+/*
+ *  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
+collections {
+       group {
+               name: "ug_effect";
+               parts {
+                       part {
+                               name: "clip";
+                               type: RECT;
+                               description {
+                                       state: "default" 0.0;
+                                       rel1 { relative: 1 0; }
+                                       rel2 { relative: 2 1; }
+                                       color: 255 255 255 0;
+                               }
+                               description {
+                                       state: "show" 0.0;
+                                       rel1 { relative: 0 0; }
+                                       rel2 { relative: 1 1; }
+                                       color: 255 255 255 255;
+                               }
+                       }
+                       part {
+                               name: "elm.swallow.content";
+                               type: SWALLOW;
+                               clip_to: "clip";
+                               description {
+                                       rel1.to: "clip";
+                                       rel2.to: "clip";
+                               }
+                       }
+                       part {
+                               name: "event_blocker";
+                               description {
+                                       state: "default" 0.0;
+                                       visible: 1;
+                               }
+                               description {
+                                       state: "show" 0.0;
+                                       inherit: "default" 0.0;
+                               }
+                               description {
+                                       state: "disabled" 0.0;
+                                       inherit: "default" 0.0;
+                                       visible: 0;
+                               }
+                       }
+               }
+               programs {
+                       program {
+                               name: "show";
+                               signal: "elm,state,show";
+                               action: STATE_SET "show" 0.0;
+                               target: "clip";
+                               target: "event_blocker";
+                               transition: "DECELERATE" 0.2;
+                               after: "show_end";
+                       }
+                       program {
+                               name: "hide";
+                               signal: "elm,state,hide";
+                               action: STATE_SET "default" 0.0;
+                               target: "clip";
+                               target: "event_blocker";
+                               transition: "DECELERATE" 0.2;
+                               after: "hide_end";
+                       }
+                       program {
+                               name: "disable_event_blocker";
+                               signal: "elm,state,blocker,disabled";
+                               action: STATE_SET "disabled" 0.0;
+                               target: "event_blocker";
+                       }
+                       program {
+                               name: "disable_blocker";
+                               action: SIGNAL_EMIT "elm,state,blocker,disabled" "";
+                       }
+                       program {
+                               name: "show_end";
+                               action: SIGNAL_EMIT "elm,action,show,finished" "";
+                               after: "disable_blocker";
+                       }
+                       program {
+                               name: "hide_end";
+                               action: SIGNAL_EMIT "elm,action,hide,finished" "";
+                               after: "disable_blocker";
+                       }
+
+                       program {
+                               name: "hide_already";
+                               signal: "elm,state,hidealready";
+                               after: "hide_already_end";
+                       }
+                       program {
+                               name: "hide_already_end";
+                               action: SIGNAL_EMIT "elm,action,hidealready,finished" "";
+                       }
+
+                       program {
+                               name: "hide_only";
+                               signal: "elm,state,hideonly";
+                               action: STATE_SET "default" 0.0;
+                               target: "clip";
+                               target: "event_blocker";
+                               transition: "DECELERATE" 0.2;
+                               after: "hide_only_end";
+                       }
+                       program {
+                               name: "hide_only_end";
+                               action: SIGNAL_EMIT "elm,action,hideonly,finished" "";
+                               after: "disable_blocker";
+                       }
+               }
+       }
+}
diff --git a/ug-efl-engine/ug_effect_3d.edc b/ug-efl-engine/ug_effect_3d.edc
new file mode 100644 (file)
index 0000000..97cd77e
--- /dev/null
@@ -0,0 +1,298 @@
+//TRANSLATION EFFECT
+
+collections {
+       group {
+               name: "ug_effect";
+               parts {
+                       part { name: "bg";
+                               type: RECT;
+                               description {
+                                       state: "default" 0.0;
+                                       color: 0 0 0 255;
+                                       rel1 { relative: 0.0 0.0; }
+                                       rel2 { relative: 1.0 1.0; }
+                               }
+                       }
+                       part { name: "point_prev1";
+                               type: RECT;
+                               scale: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       color: 0 0 0 0;
+                                       rel1 { relative: 0.0 0.0; }
+                                       rel2 { relative: 0.0 1.0; }
+                               }
+                       }
+                       part { name: "point_prev2";
+                               type: RECT;
+                               scale: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       color: 0 0 0 0;
+                                       rel1 { relative: -0.1 0.0; }
+                                       rel2 { relative: -0.1 1.0; }
+                                       perspective {
+                                               zplane: -135;
+                                               focal: 1000;
+                                       }
+                               }
+                       }
+                       part { name: "point1";
+                               type: RECT;
+                               scale: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       color: 0 0 0 0;
+                                       rel1 { relative: 1.0 0.0; }
+                                       rel2 { relative: 1.0 1.0; }
+                               }
+                       }
+                       part { name: "point2";
+                               type: RECT;
+                               scale: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       color: 0 0 0 0;
+                                       rel1 { relative: 0.0 0.0; }
+                                       rel2 { relative: 0.0 1.0; }
+                               }
+                       }
+                       part {
+                               name: "elm.swallow.content_prev";
+                               type: SWALLOW;
+                               description {
+                                       state: "default" 0.0;
+                                       rel1 { relative: 0.0 0.0; }
+                                       rel2 { relative: 1.0 1.0; }
+                               }
+                               description { state: "map_transition" 0.0;
+                                       inherit: "default" 0.0;
+                                       color: 86 76 65 255;
+                                       map {
+                                               perspective: "point_prev1";
+                                               on: 1;
+                                               smooth: 1;
+                                               perspective_on: 1;
+                                               backface_cull: 1;
+                                               rotation {
+                                                       center: "point_prev1";
+                                                       x: 0;
+                                                       y: 0;
+                                                       z: 0;
+                                               }
+                                       }
+                               }
+                               description {
+                                       state: "hide" 0.0;
+                                       inherit: "default" 0.0;
+                                       visible: 0;
+                               }
+                               description {
+                                       state: "show" 0.0;
+                                       inherit: "default" 0.0;
+                                       map {
+                                               perspective: "point_prev2";
+                                               on: 1;
+                                               smooth: 1;
+                                               perspective_on: 1;
+                                               backface_cull: 1;
+                                               rotation {
+                                                       center: "point_prev2";
+                                                       x: 0;
+                                                       y: 60;
+                                                       z: 0;
+                                               }
+                                       }
+                               }
+                       }
+                       part { name: "bg_shawdow";
+                               type: RECT;
+                               effect: OUTLINE;
+                               effect: OUTLINE_SHADOW;
+                               effect: SHADOW;
+                               effect: FAR_SHADOW;
+                               effect: GLOW;
+
+                               description {
+                                       state: "default" 0.0;
+                                       color: 0 255 255 255;
+                                       rel1 { relative: 1.0 0.0; }
+                                       rel2 { relative: 2.0 1.0; }
+                               }
+                               description {
+                                       state: "show" 0.0;
+                                       inherit: "default" 0.0;
+                                       rel1 { relative: 0.0 0.0; }
+                                       rel2 { relative: 1.0 1.0; }
+                               }
+                       }
+                       part {
+                               name: "elm.swallow.content";
+                               type: SWALLOW;
+                               description {
+                                       state: "default" 0.0;
+                                       rel1 { relative: 1 0; }
+                                       rel2 { relative: 2 1; }
+                                       visible: 0;
+                               }
+                               description {
+                                       state: "map_transition" 0.0;
+                                       rel1 { relative: 1 0; }
+                                       rel2 { relative: 2 1; }
+                                       color: 86 76 65 255;
+                                       map {
+                                               perspective: "point1";
+                                               on: 1;
+                                               smooth: 1;
+                                               perspective_on: 1;
+                                               backface_cull: 1;
+                                               rotation {
+                                                       center: "point1";
+                                                       x: 0;
+                                                       y: 60;
+                                                       z: 0;
+                                               }
+                                       }
+                               }
+                               description {
+                                       state: "show" 0.0;
+                                       rel1 { relative: 0 0; }
+                                       rel2 { relative: 1 1; }
+                                       map {
+                                               perspective: "point2";
+                                               on: 1;
+                                               smooth: 1;
+                                               perspective_on: 1;
+                                               backface_cull: 1;
+                                               rotation {
+                                                       center: "point2";
+                                                       x: 0;
+                                                       y: 0;
+                                                       z: 0;
+                                               }
+                                       }
+                               }
+                               description {
+                                       state: "hide" 0.0;
+                                       inherit: "default" 0.0;
+                                       visible: 0;
+                               }
+                       }
+                       part {
+                               name: "event_blocker";
+                               description {
+                                       state: "default" 0.0;
+                                       visible: 1;
+                               }
+                               description {
+                                       state: "show" 0.0;
+                                       inherit: "default" 0.0;
+                               }
+                               description {
+                                       state: "map_transition" 0.0;
+                                       inherit: "default" 0.0;
+                               }
+                               description {
+                                       state: "disabled" 0.0;
+                                       inherit: "default" 0.0;
+                                       visible: 0;
+                               }
+                       }
+               }
+               programs {
+                       program {
+                               name: "show";
+                               signal: "elm,state,show";
+                               action: STATE_SET "map_transition" 0.0;
+                               target: "elm.swallow.content";
+                               target: "elm.swallow.content_prev";
+                               after: "show_start";
+                       }
+                       program {
+                               name: "show_start";
+                               action: STATE_SET "show" 0.0;
+                               target: "elm.swallow.content";
+                               target: "elm.swallow.content_prev";
+//                             target: "bg_shawdow";
+                               target: "event_blocker";
+                               transition: ACCELERATE 0.5;
+                               after: "show_end";
+                       }
+                       program {
+                               name: "hide";
+                               signal: "elm,state,hide";
+                               action: STATE_SET "map_transition" 0.0;
+                               target: "elm.swallow.content";
+                               target: "elm.swallow.content_prev";
+                               target: "event_blocker";
+                               transition: "ACCELERATE" 0.5;
+                               after: "hide_end";
+                       }
+
+                       program {
+                               name: "disable_blocker";
+                               action: STATE_SET "disabled" 0.0;
+                               target: "event_blocker";
+                       }
+                       program {
+                               name: "show_end";
+                               action: SIGNAL_EMIT "elm,action,show,finished" "";
+                               after: "disable_blocker";
+                       }
+                       program {
+                               name: "hide_end";
+                               action: SIGNAL_EMIT "elm,action,hide,finished" "";
+                               after: "disable_blocker";
+                       }
+
+                       program {
+                               name: "hide_already";
+                               signal: "elm,state,hidealready";
+                               after: "hide_already_end";
+                       }
+                       program {
+                               name: "hide_already_end";
+                               action: SIGNAL_EMIT "elm,action,hidealready,finished" "";
+                       }
+
+                       program {
+                               name: "hide_only";
+                               signal: "elm,state,hideonly";
+                               action: STATE_SET "map_transition" 0.0;
+                               target: "elm.swallow.content";
+                               target: "elm.swallow.content_prev";
+                               target: "event_blocker";
+                               transition: "ACCELERATE" 0.5;
+                               after: "hide_only_end";
+                       }
+                       program {
+                               name: "hide_only_end";
+                               action: SIGNAL_EMIT "elm,action,hideonly,finished" "";
+                               after: "disable_blocker";
+                       }
+
+                       program {
+                               name: "rotaion_transition";
+                               action: STATE_SET "map_transition" 0.0;
+                               target: "elm.swallow.content";
+                               target: "elm.swallow.content_prev";
+                               after: "rotation";
+                       }
+                       program {
+                               name: "rotation";
+                               action: STATE_SET "map_rotate" 0.0;
+                               transition: LINEAR second;
+                               target: "elm.swallow.content";
+                               target: "elm.swallow.content_prev";
+                               after: "show_end";
+                       }
+                       program {
+                               name: "rotation_end";
+                               action: STATE_SET "default" 0.0;
+                               target: "elm.swallow.content";
+                               target: "elm.swallow.content_prev";
+                               after: "show_end";
+                       }
+               }
+       }
+}
diff --git a/ui-gadget.pc.in b/ui-gadget.pc.in
new file mode 100644 (file)
index 0000000..8fe0ecf
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: UI Gadget
+Description: UI Gadget Library
+Version: @VERSION@
+Requires: bundle x11
+Libs: -L${libdir} -lui-gadget
+Cflags: -I${includedir}