summaryrefslogtreecommitdiff
path: root/ug-efl-engine
diff options
context:
space:
mode:
Diffstat (limited to 'ug-efl-engine')
-rwxr-xr-xug-efl-engine/CMakeLists.txt37
-rwxr-xr-xug-efl-engine/ug-efl-engine.c348
-rw-r--r--ug-efl-engine/ug-efl-engine.h32
-rw-r--r--ug-efl-engine/ug_effect.edc137
4 files changed, 554 insertions, 0 deletions
diff --git a/ug-efl-engine/CMakeLists.txt b/ug-efl-engine/CMakeLists.txt
new file mode 100755
index 0000000..d0414f6
--- /dev/null
+++ b/ug-efl-engine/CMakeLists.txt
@@ -0,0 +1,37 @@
+SET(UG_EFL_ENGINE "${PROJECT_NAME}-efl-engine")
+SET(UG_EFL_ENGINE_SRCS ug-efl-engine.c)
+SET(UG_ENGINE_EDJ_DIR "${CMAKE_INSTALL_PREFIX}/share/edje")
+SET(VERSION_MAJOR 0)
+SET(VERSION "${VERSION_MAJOR}.1.0")
+
+PKG_CHECK_MODULES(UG_EFL_ENGINE_PKGS REQUIRED
+ dlog
+ elementary
+ ecore
+ ecore-x
+ edje
+ capi-appfw-application
+ evas)
+
+FOREACH(flag ${UG_EFL_ENGINE_PKGS_CFLAGS})
+ SET(UG_EFL_ENGINE_CFLAGS "${UG_EFL_ENGINE_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+SET(UG_EFL_ENGINE_CFLAGS, "${UG_EFL_ENGINE_CFLAGS} -DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+
+ADD_LIBRARY(${UG_EFL_ENGINE} SHARED ${UG_EFL_ENGINE_SRCS})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
+SET_TARGET_PROPERTIES(${UG_EFL_ENGINE} PROPERTIES COMPILE_FLAGS "${UG_EFL_ENGINE_CFLAGS}")
+TARGET_LINK_LIBRARIES(${UG_EFL_ENGINE} ${PROJECT_NAME} ${UG_EFL_ENGINE_PKGS_LDFLAGS})
+
+INSTALL(TARGETS ${UG_EFL_ENGINE} DESTINATION /usr/lib)
+
+ADD_CUSTOM_TARGET(ug_effect.edj
+ COMMAND edje_cc -id ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/ug_effect.edc ${CMAKE_BINARY_DIR}/ug_effect.edj
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ug_effect.edc
+)
+ADD_DEPENDENCIES(${PROJECT_NAME} ug_effect.edj)
+INSTALL(FILES ${CMAKE_BINARY_DIR}/ug_effect.edj DESTINATION ${UG_ENGINE_EDJ_DIR})
+
+
diff --git a/ug-efl-engine/ug-efl-engine.c b/ug-efl-engine/ug-efl-engine.c
new file mode 100755
index 0000000..f4bf697
--- /dev/null
+++ b/ug-efl-engine/ug-efl-engine.c
@@ -0,0 +1,348 @@
+/*
+ * UI Gadget
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <glib.h>
+#include <Elementary.h>
+#include <ui-gadget-engine.h>
+
+#include "ug.h"
+#include "ug-efl-engine.h"
+#include "ug-dbg.h"
+
+#ifndef UG_ENGINE_API
+#define UG_ENGINE_API __attribute__ ((visibility("default")))
+#endif
+
+static Evas_Object *navi = NULL;
+static Evas_Object *conform = NULL;
+struct cb_data {
+ ui_gadget_h ug;
+ void (*transition_cb)(ui_gadget_h ug);
+};
+static void __hide_finished(void *data, Evas_Object *obj, void *event_info);
+static void on_show_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
+
+static void _on_hideonly_cb(void *data, Evas_Object *obj)
+{
+ ui_gadget_h ug = (ui_gadget_h)data;
+
+ if (!ug)
+ return;
+
+ _DBG("\t obj=%p ug=%p state=%d", obj, ug, ug->layout_state);
+
+ evas_object_intercept_hide_callback_del(ug->layout, _on_hideonly_cb);
+
+ struct cb_data *cb_d;
+ cb_d = (struct cb_data *)calloc(1, sizeof(struct cb_data));
+ cb_d->ug = ug;
+ cb_d->transition_cb = NULL;
+
+ evas_object_event_callback_add(ug->layout, EVAS_CALLBACK_SHOW, on_show_cb, cb_d);
+
+ if (ug->layout_state == UG_LAYOUT_NOEFFECT) {
+ ;
+ }
+
+ if (ug->layout_state == UG_LAYOUT_SHOW) {
+ ug->layout_state = UG_LAYOUT_HIDEEFFECT;
+ }
+
+ if (GET_OPT_OVERLAP_VAL(ug->opt) == UG_OPT_OVERLAP_ENABLE) {
+ _DBG("\t this is Overlap UG. Send nooverlap sig on hide_cb");
+ elm_object_signal_emit(conform, "elm,state,indicator,nooverlap", "");
+ }
+
+ if (elm_naviframe_top_item_get(navi) == ug->effect_layout) {
+ elm_naviframe_item_pop(navi);
+ } else {
+ elm_object_item_del(ug->effect_layout);
+ ug->effect_layout = NULL;
+ }
+}
+
+static void _del_effect_layout(ui_gadget_h ug)
+{
+ GSList *child, *trail;
+
+ if (!ug)
+ return;
+
+ _DBG("\t ug=%p state=%d", ug, ug->layout_state);
+
+ evas_object_intercept_hide_callback_del(ug->layout, _on_hideonly_cb);
+
+ if (ug->children) {
+ child = ug->children;
+ while (child) {
+ trail = g_slist_next(child);
+ _del_effect_layout(child->data);
+ child = trail;
+ }
+ }
+
+ /* effect_layout of frameview is null */
+ /* remove navi item */
+ if (ug->effect_layout) {
+ _DBG("\t remove navi item: ug=%p", ug);
+ if (ug->layout_state == UG_LAYOUT_HIDEEFFECT) {
+ _DBG("\t del cb, ug=%p", ug);
+ evas_object_smart_callback_del(navi, "transition,finished",
+ __hide_finished);
+ }
+ elm_object_item_del(ug->effect_layout);
+ ug->effect_layout = NULL;
+ }
+
+ if (navi) {
+ Elm_Object_Item *t = elm_naviframe_top_item_get(navi);
+ Elm_Object_Item *b = elm_naviframe_bottom_item_get(navi);
+ if (t == b) {
+ _DBG("\t remove navi");
+ evas_object_del(navi);
+ navi = NULL;
+ }
+ }
+ evas_object_hide(ug->layout);
+}
+
+static void __hide_finished(void *data, Evas_Object *obj, void *event_info)
+{
+ struct cb_data *cb_d = (struct cb_data *)data;
+
+ if (!cb_d)
+ return;
+
+ evas_object_smart_callback_del(obj, "transition,finished",
+ __hide_finished);
+
+ ui_gadget_h ug = cb_d->ug;
+ _DBG("\t obj=%p ug=%p state=%d", obj, ug, ug->layout_state);
+
+ ug->effect_layout = NULL;
+ _del_effect_layout(ug);
+ cb_d->transition_cb(ug);
+ free(cb_d);
+}
+
+static int __find_child(ui_gadget_h p, ui_gadget_h ug)
+{
+ GSList *child = NULL;
+
+ if (!p || !ug)
+ return 0;
+ child = p->children;
+
+ while (child) {
+ if (child->data == ug)
+ return 1;
+ if (__find_child(child->data, ug))
+ return 1;
+ child = g_slist_next(child);
+ }
+
+ return 0;
+}
+
+static void on_destroy(ui_gadget_h ug, ui_gadget_h t_ug,
+ void (*hide_end_cb) (ui_gadget_h ug))
+{
+ if (!ug)
+ return;
+ _DBG("\t ug=%p tug=%p state=%d", ug, t_ug, ug->layout_state);
+
+ evas_object_intercept_hide_callback_del(ug->layout,
+ _on_hideonly_cb);
+
+ if (ug != t_ug) {
+ _DBG("requested ug(%p) is not top ug(%p)", ug, t_ug);
+ _del_effect_layout(ug);
+ hide_end_cb(ug);
+ return;
+ }
+
+ if (ug->layout_state == UG_LAYOUT_SHOW) {
+ struct cb_data *cb_d;
+ cb_d = (struct cb_data *)calloc(1, sizeof(struct cb_data));
+ cb_d->ug = ug;
+ cb_d->transition_cb = hide_end_cb;
+
+ _DBG("\t cb add ug=%p", ug);
+
+ /* overlap update does not needed because manager will do that at on_destroy scenario */
+
+ evas_object_smart_callback_add(navi, "transition,finished",
+ __hide_finished, cb_d);
+ elm_naviframe_item_pop(navi);
+ ug->layout_state = UG_LAYOUT_HIDEEFFECT;
+ } else if (ug->layout_state == UG_LAYOUT_HIDE
+ || ug->layout_state == UG_LAYOUT_NOEFFECT) {
+ _del_effect_layout(ug);
+ hide_end_cb(ug);
+ } else if (ug->layout_state == UG_LAYOUT_HIDEEFFECT
+ || ug->layout_state == UG_LAYOUT_SHOWEFFECT) {
+ ug->layout_state = UG_LAYOUT_DESTROY;
+ } else {
+ _ERR("[UG Effect Plug-in] : layout state error!!");
+ }
+}
+
+static void __show_finished(void *data, Evas_Object *obj, void *event_info)
+{
+ struct cb_data *cb_d = (struct cb_data *)data;
+ if (!cb_d)
+ return;
+
+ ui_gadget_h ug = cb_d->ug;
+ if (!ug)
+ return;
+
+ _DBG("\tobj=%p ug=%p state=%d", obj, ug, ug->layout_state);
+
+ evas_object_smart_callback_del(obj, "transition,finished",
+ __show_finished);
+
+ if (ug->layout_state == UG_LAYOUT_NOEFFECT)
+ return;
+
+ if (ug->layout_state == UG_LAYOUT_DESTROY)
+ ;
+ else
+ ug->layout_state = UG_LAYOUT_SHOW;
+
+ if(cb_d->transition_cb)
+ cb_d->transition_cb(ug);
+ free(cb_d);
+}
+
+static void on_show_cb(void *data, Evas *e, Evas_Object *obj,
+ void *event_info)
+{
+ struct cb_data *cb_d = (struct cb_data *)data;
+ if (!cb_d)
+ return;
+ ui_gadget_h ug = cb_d->ug;
+ if (!ug)
+ return;
+ _DBG("\tobj=%p ug=%p layout=%p state=%d", obj, ug, ug->layout, ug->layout_state);
+
+ evas_object_event_callback_del(ug->layout, EVAS_CALLBACK_SHOW, on_show_cb);
+
+ evas_object_intercept_hide_callback_add(ug->layout,
+ _on_hideonly_cb, ug);
+
+ elm_object_part_content_set(conform, "elm.swallow.ug", navi);
+
+ if (ug->layout_state == UG_LAYOUT_HIDE
+ || ug->layout_state == UG_LAYOUT_INIT) {
+ _DBG("\t UG_LAYOUT_Init(%d) obj=%p", ug->layout_state, obj);
+ ug->layout_state = UG_LAYOUT_SHOWEFFECT;
+
+ if (GET_OPT_OVERLAP_VAL(ug->opt)) {
+ _DBG("\t this is Overlap UG. Send overlap sig on_show_cb");
+ elm_object_signal_emit(conform, "elm,state,indicator,overlap", "");
+ }
+
+ evas_object_smart_callback_add(navi, "transition,finished",
+ __show_finished, cb_d);
+ ug->effect_layout = elm_naviframe_item_push(navi, NULL, NULL, NULL,
+ ug->layout, NULL);
+ } else if (ug->layout_state == UG_LAYOUT_NOEFFECT) {
+ _DBG("\t UG_LAYOUT_NOEFFECT obj=%p", obj);
+
+ if (GET_OPT_OVERLAP_VAL(ug->opt)) {
+ _DBG("\t this is Overlap UG. Send overlap sig on_show_cb");
+ elm_object_signal_emit(conform, "elm,state,indicator,overlap", "");
+ }
+
+ Elm_Object_Item *navi_top = elm_naviframe_top_item_get(navi);
+ ug->effect_layout = elm_naviframe_item_insert_after(navi,
+ navi_top, NULL, NULL, NULL, ug->layout, NULL);
+
+ //ug start cb
+ if(cb_d->transition_cb)
+ cb_d->transition_cb(ug);
+ free(cb_d);
+ } else {
+ _ERR("\tlayout state error!! state=%d\n", ug->layout_state);
+ free(cb_d);
+ }
+}
+
+static void *on_create(void *win, ui_gadget_h ug,
+ void (*show_end_cb) (void* data))
+{
+ Evas_Object *navi_bg;
+ Evas_Object *con = NULL;
+
+ if (!ug)
+ return NULL;
+ _DBG("\t ug=%p state=%d", ug, ug->layout_state);
+
+ con = evas_object_data_get(win, "\377 elm,conformant");
+ if (con) {
+ conform = con;
+ _DBG("\t There is conformant");
+ }
+ else
+ _DBG("\t There is NO conformant");
+
+ if (!navi) {
+ navi = elm_naviframe_add(conform);
+ elm_object_style_set(navi, "uglib");
+ elm_naviframe_content_preserve_on_pop_set(navi, EINA_TRUE);
+ _DBG("\t new navi first navi=%p", navi);
+ elm_naviframe_prev_btn_auto_pushed_set(navi, EINA_FALSE);
+
+ navi_bg = evas_object_rectangle_add(evas_object_evas_get(navi));
+ evas_object_size_hint_fill_set(navi_bg, EVAS_HINT_FILL,
+ EVAS_HINT_FILL);
+ evas_object_color_set(navi_bg, 0, 0, 0, 0);
+ elm_naviframe_item_push(navi, NULL, NULL, NULL, navi_bg, NULL);
+ }
+
+ struct cb_data *cb_d;
+ cb_d = (struct cb_data *)calloc(1, sizeof(struct cb_data));
+ cb_d->ug = ug;
+ cb_d->transition_cb = show_end_cb;
+
+ evas_object_hide(ug->layout);
+ evas_object_event_callback_add(ug->layout, EVAS_CALLBACK_SHOW, on_show_cb, cb_d);
+
+ ug->layout_state = UG_LAYOUT_INIT;
+
+ return conform;
+}
+
+UG_ENGINE_API int UG_ENGINE_INIT(struct ug_engine_ops *ops)
+{
+ if (!ops)
+ return -1;
+
+ ops->create = on_create;
+ ops->destroy = on_destroy;
+
+ return 0;
+}
+
+UG_ENGINE_API void UG_ENGINE_EXIT(struct ug_engine_ops *ops)
+{
+}
diff --git a/ug-efl-engine/ug-efl-engine.h b/ug-efl-engine/ug-efl-engine.h
new file mode 100644
index 0000000..fbfce5b
--- /dev/null
+++ b/ug-efl-engine/ug-efl-engine.h
@@ -0,0 +1,32 @@
+/*
+ * UI Gadget
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+
+#ifndef __UG_EFL_ENGINE_H__
+#define __UG_EFL_ENGINE_H__
+
+#include <Elementary.h>
+#include <libintl.h>
+
+#define _EDJ(o) elm_layout_edje_get(o)
+
+#endif /* __UG_EFL_ENGINE_H__ */
diff --git a/ug-efl-engine/ug_effect.edc b/ug-efl-engine/ug_effect.edc
new file mode 100644
index 0000000..0be0ed3
--- /dev/null
+++ b/ug-efl-engine/ug_effect.edc
@@ -0,0 +1,137 @@
+/*
+ * UI Gadget
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+//TRANSLATION EFFECT
+#define NAVIFRAME_VIEW_TRANS_TIME 0.1
+
+collections {
+/* group { name:"elm/naviframe/item/basic/uglib";
+ parts {
+ part { name: "base";
+ type: RECT;
+ mouse_events: 0;
+ description { state: "default" 0.0;
+ color: 255 255 255 255;
+ }
+ description { state: "right" 0.0;
+ inherit: "default" 0.0;
+ rel1.relative: 1.0 0.0;
+ rel2.relative: 2.0 1.0;
+ color: 255 255 255 0;
+ }
+ }
+ part { name: "elm.swallow.content";
+ type: SWALLOW;
+ scale: 1;
+ repeat_events: 0;
+ clip_to: "base";
+ description { state: "default" 0.0;
+ align: 0.0 0.0;
+ rel1.relative: 0.0 0.0;
+ rel1.to: "base";
+ rel2.relative: 1.0 1.0;
+ rel2.to: "base";
+ }
+ }
+ }
+ programs {
+ program { name: "content_new_pushed";
+ signal: "elm,state,new,pushed,internal";
+ source: "";
+ action: STATE_SET "default" 0.0;
+ target: "base";
+ transition: DECELERATE NAVIFRAME_VIEW_TRANS_TIME;
+ after: "show_finished";
+ }
+ program { name: "content_cur_pushed";
+ signal: "elm,state,cur,pushed,internal";
+ source: "";
+ action: STATE_SET "default" 0.0;
+ target: "base";
+ transition: DECELERATE NAVIFRAME_VIEW_TRANS_TIME;
+ after: "pushed_finished";
+ }
+ program { name: "content_prev_popped";
+ signal: "elm,state,prev,popped,internal";
+ source: "";
+ action: STATE_SET "default" 0.0;
+ target: "base";
+ transition: DECELERATE NAVIFRAME_VIEW_TRANS_TIME;
+ after: "show_finished";
+ }
+ program { name: "content_cur_popped";
+ signal: "elm,state,cur,popped,internal";
+ source: "";
+ action: STATE_SET "right" 0.0;
+ target: "base";
+ transition: DECELERATE NAVIFRAME_VIEW_TRANS_TIME;
+ after: "popped_finished";
+ }
+ program { name: "cur_pushed";
+ signal: "elm,state,cur,pushed";
+ source: "elm";
+ script {
+ set_state(PART:"base", "default", 0.0);
+ emit("elm,state,cur,pushed,internal", "");
+ }
+ }
+ program { name: "new_pushed";
+ signal: "elm,state,new,pushed";
+ source: "elm";
+ script {
+ set_state(PART:"base", "right", 0.0);
+ emit("elm,state,new,pushed,internal", "");
+ }
+ }
+ program { name: "prev_popped";
+ signal: "elm,state,prev,popped";
+ source: "elm";
+ script {
+ set_state(PART:"base", "default", 0.0);
+ emit("elm,state,prev,popped,internal", "");
+ }
+ }
+ program { name: "cur_popped";
+ signal: "elm,state,cur,popped";
+ source: "elm";
+ script {
+ set_state(PART:"base", "default", 0.0);
+ emit("elm,state,cur,popped,internal", "");
+ }
+ }
+ program { name: "visible";
+ signal: "elm,state,visible";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "base";
+ }
+ program { name: "show_finished";
+ action: SIGNAL_EMIT "elm,action,show,finished" "";
+ }
+ program { name: "pushed_finished";
+ action: SIGNAL_EMIT "elm,action,pushed,finished" "";
+ }
+ program { name: "popped_finished";
+ action: SIGNAL_EMIT "elm,action,popped,finished" "";
+ }
+ }
+ }*/
+}