Add new widget for extn socket and plug.
authorjypark <jypark@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 16 Jan 2012 17:18:20 +0000 (17:18 +0000)
committerjypark <jypark@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 16 Jan 2012 17:18:20 +0000 (17:18 +0000)
application can use ecore extn socket easyily
by using elm_window_add with ELM_WIN_SOCKET_IMAGE style.
And new widget Elm plug is similar with Elm image.
it can show socket's image using connect API.
I add test code also(test_win_socket/plug).

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@67245 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/bin/Makefile.am
src/bin/test.c
src/bin/test_win_plug.c [new file with mode: 0755]
src/bin/test_win_socket.c [new file with mode: 0755]
src/lib/Elementary.h.in
src/lib/Makefile.am
src/lib/elm_plug.c [new file with mode: 0755]
src/lib/elm_plug.h [new file with mode: 0755]
src/lib/elm_win.c
src/lib/elm_win.h

index a815f27..3094cc0 100644 (file)
@@ -111,6 +111,8 @@ test_video.c \
 test_weather.c \
 test_web.c \
 test_win_inline.c \
+test_win_socket.c \
+test_win_plug.c \
 test_win_state.c
 
 if HAVE_EIO
index d03b8f5..6741762 100644 (file)
@@ -145,6 +145,8 @@ void test_bubble(void *data, Evas_Object *obj, void *event_info);
 void test_segment_control(void *data, Evas_Object *obj, void *event_info);
 void test_store(void *data, Evas_Object *obj, void *event_info);
 void test_win_inline(void *data, Evas_Object *obj, void *event_info);
+void test_win_socket(void *data, Evas_Object *obj, void *event_info);
+void test_win_plug(void *data, Evas_Object *obj, void *event_info);
 void test_grid(void *data, Evas_Object *obj, void *event_info);
 void test_glview_simple(void *data, Evas_Object *obj, void *event_info);
 void test_glview(void *data, Evas_Object *obj, void *event_info);
@@ -321,6 +323,8 @@ add_tests:
    ADD_TEST(NULL, "Window / Background", "Inwin", test_inwin);
    ADD_TEST(NULL, "Window / Background", "Inwin 2", test_inwin2);
    ADD_TEST(NULL, "Window / Background", "Window Inline", test_win_inline);
+   ADD_TEST(NULL, "Window / Background", "Window Socket", test_win_socket);
+   ADD_TEST(NULL, "Window / Background", "Window Plug", test_win_plug);
 
    //------------------------------//
    ADD_TEST(NULL, "Images", "Icon Transparent", test_icon);
diff --git a/src/bin/test_win_plug.c b/src/bin/test_win_plug.c
new file mode 100755 (executable)
index 0000000..8f00a7c
--- /dev/null
@@ -0,0 +1,110 @@
+#include <Elementary.h>
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#ifndef ELM_LIB_QUICKLAUNCH
+
+
+static void
+cb_mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info)
+{
+   Evas_Event_Mouse_Move *ev = event_info;
+   Evas_Object *orig = data;
+   Evas_Coord x, y;
+   Evas_Map *p;
+   int i, w, h;
+
+   if (!ev->buttons) return;
+   evas_object_geometry_get(obj, &x, &y, NULL, NULL);
+   evas_object_move(obj,
+                    x + (ev->cur.canvas.x - ev->prev.output.x),
+                    y + (ev->cur.canvas.y - ev->prev.output.y));
+   evas_object_image_size_get(orig, &w, &h);
+   p = evas_map_new(4);
+   evas_object_map_enable_set(orig, EINA_TRUE);
+   evas_object_raise(orig);
+   for (i = 0; i < 4; i++)
+     {
+        Evas_Object *hand;
+        char key[32];
+
+        snprintf(key, sizeof(key), "h-%i\n", i);
+        hand = evas_object_data_get(orig, key);
+        evas_object_raise(hand);
+        evas_object_geometry_get(hand, &x, &y, NULL, NULL);
+        x += 15;
+        y += 15;
+        evas_map_point_coord_set(p, i, x, y, 0);
+        if (i == 0) evas_map_point_image_uv_set(p, i, 0, 0);
+        else if (i == 1) evas_map_point_image_uv_set(p, i, w, 0);
+        else if (i == 2) evas_map_point_image_uv_set(p, i, w, h);
+        else if (i == 3) evas_map_point_image_uv_set(p, i, 0, h);
+     }
+   evas_object_map_set(orig, p);
+   evas_map_free(p);
+}
+
+static void
+create_handles(Evas_Object *obj)
+{
+   int i;
+   Evas_Coord x, y, w, h;
+
+   evas_object_geometry_get(obj, &x, &y, &w, &h);
+   for (i = 0; i < 4; i++)
+     {
+        Evas_Object *hand;
+        char buf[PATH_MAX];
+        char key[32];
+
+        hand = evas_object_image_filled_add(evas_object_evas_get(obj));
+        evas_object_resize(hand, 31, 31);
+        snprintf(buf, sizeof(buf), "%s/images/pt.png", elm_app_data_dir_get());
+        evas_object_image_file_set(hand, buf, NULL);
+        if (i == 0)      evas_object_move(hand, x     - 15, y     - 15);
+        else if (i == 1) evas_object_move(hand, x + w - 15, y     - 15);
+        else if (i == 2) evas_object_move(hand, x + w - 15, y + h - 15);
+        else if (i == 3) evas_object_move(hand, x     - 15, y + h - 15);
+        evas_object_event_callback_add(hand, EVAS_CALLBACK_MOUSE_MOVE, cb_mouse_move, obj);
+        evas_object_show(hand);
+        snprintf(key, sizeof(key), "h-%i\n", i);
+        evas_object_data_set(obj, key, hand);
+     }
+}
+
+void
+test_win_plug(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+   Evas_Object *win, *bg, *plug;
+   char buf[PATH_MAX];
+
+   win = elm_win_add(NULL, "window-inline", ELM_WIN_BASIC);
+   elm_win_title_set(win, "Window Inline");
+   elm_win_autodel_set(win, EINA_TRUE);
+
+   bg = elm_bg_add(win);
+   snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get());
+   elm_bg_file_set(bg, buf, NULL);
+   elm_win_resize_object_add(win, bg);
+   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   evas_object_show(bg);
+
+
+   plug = elm_plug_add(win);
+   if (!elm_plug_connect(plug, "ello", 0, EINA_FALSE))
+       {
+          printf("Cannot connect plug\n");
+          return;
+       }
+
+
+   evas_object_resize(plug, 380, 500);
+   evas_object_move(plug, 10, 10);
+   evas_object_show(plug);
+
+   create_handles(elm_plug_image_object_get(plug));
+
+   evas_object_resize(win, 400, 600);
+   evas_object_show(win);
+}
+#endif
diff --git a/src/bin/test_win_socket.c b/src/bin/test_win_socket.c
new file mode 100755 (executable)
index 0000000..23245bc
--- /dev/null
@@ -0,0 +1,213 @@
+#include <Elementary.h>
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#ifndef ELM_LIB_QUICKLAUNCH
+
+static void
+_win_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+   Evas_Object *socket_win = data;
+   evas_object_del(socket_win);
+}
+
+static void
+fill(Evas_Object *win, Eina_Bool do_bg)
+{
+   Evas_Object *bg, *sc, *bx, *ic, *bb, *av, *en;
+   char buf[PATH_MAX];
+
+   if (do_bg)
+     {
+        bg = elm_bg_add(win);
+        elm_win_resize_object_add(win, bg);
+        evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+        evas_object_show(bg);
+     }
+
+   sc = elm_scroller_add(win);
+   evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   elm_win_resize_object_add(win, sc);
+
+   bx = elm_box_add(win);
+   evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+   en = elm_entry_add(win);
+   elm_entry_scrollable_set(en, EINA_TRUE);
+   evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5);
+   elm_object_text_set(en, "This is a single line");
+   elm_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
+   elm_entry_single_line_set(en, 1);
+   evas_object_show(en);
+   elm_box_pack_end(bx, en);
+
+   en = elm_entry_add(win);
+   elm_entry_scrollable_set(en, EINA_TRUE);
+   evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5);
+   elm_object_text_set(en, "Entry 2");
+   elm_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
+   elm_entry_single_line_set(en, 1);
+   evas_object_show(en);
+   elm_box_pack_end(bx, en);
+
+   ic = elm_icon_add(win);
+   snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
+   elm_icon_file_set(ic, buf, NULL);
+   elm_icon_scale_set(ic, 0, 0);
+   evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1);
+
+   bb = elm_bubble_add(win);
+   elm_object_text_set(bb, "Message 3");
+   elm_object_part_text_set(bb, "info", "10:32 4/11/2008");
+   elm_object_part_content_set(bb, "icon", ic);
+   evas_object_show(ic);
+   evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
+   av = elm_anchorblock_add(win);
+   elm_anchorblock_hover_style_set(av, "popout");
+   elm_anchorblock_hover_parent_set(av, win);
+   elm_object_text_set(av,
+                          "Hi there. This is the most recent message in the "
+                          "list of messages. It has one <a href=tel:+614321234>+61 432 1234</a> "
+                          "(phone number) to click on.");
+   elm_object_content_set(bb, av);
+   evas_object_show(av);
+   elm_box_pack_end(bx, bb);
+   evas_object_show(bb);
+
+   ic = elm_icon_add(win);
+   snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
+   elm_icon_file_set(ic, buf, NULL);
+   evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+
+   bb = elm_bubble_add(win);
+   elm_object_text_set(bb, "Message 2");
+   elm_object_part_text_set(bb, "info", "7:16 27/10/2008");
+   elm_object_part_content_set(bb, "icon", ic);
+   evas_object_show(ic);
+   evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
+   av = elm_anchorblock_add(win);
+   elm_anchorblock_hover_style_set(av, "popout");
+   elm_anchorblock_hover_parent_set(av, win);
+   elm_object_text_set(av,
+                          "Hey what are you doing? This is the second last message "
+                          "Hi there. This is the most recent message in the "
+                          "list. It's a longer one so it can wrap more and "
+                          "contains a <a href=contact:john>John</a> contact "
+                          "link in it to test popups on links. The idea is that "
+                          "all SMS's are scanned for things that look like phone "
+                          "numbers or names that are in your contacts list, and "
+                          "if they are, they become clickable links that pop up "
+                          "a menus of obvious actions to perform on this piece "
+                          "of information. This of course can be later explicitly "
+                          "done by links maybe running local apps or even being "
+                          "web URL's too that launch the web browser and point it "
+                          "to that URL. <item relsize=16x16 vsize=full href=emoticon/omg></item>");
+   elm_object_content_set(bb, av);
+   evas_object_show(av);
+   elm_box_pack_end(bx, bb);
+   evas_object_show(bb);
+
+   ic = elm_icon_add(win);
+   snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
+   elm_icon_file_set(ic, buf, NULL);
+   elm_icon_scale_set(ic, 0, 0);
+   evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1);
+
+   bb = elm_bubble_add(win);
+   elm_object_text_set(bb, "Message 1");
+   elm_object_part_text_set(bb, "info", "20:47 18/6/2008");
+   elm_object_part_content_set(bb, "icon", ic);
+   evas_object_show(ic);
+   evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+   av = elm_anchorblock_add(win);
+   elm_anchorblock_hover_style_set(av, "popout");
+   elm_anchorblock_hover_parent_set(av, win);
+   elm_object_text_set(av, "This is a short message. <item relsize=16x16 vsize=full href=emoticon/haha></item>");
+   elm_object_content_set(bb, av);
+   evas_object_show(av);
+   elm_box_pack_end(bx, bb);
+   evas_object_show(bb);
+
+   elm_object_content_set(sc, bx);
+   evas_object_show(bx);
+
+   evas_object_show(sc);
+}
+
+void
+test_win_socket(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+   Evas_Object *win, *bg, *bx, *lb;
+   Evas_Object *win_socket;
+
+   /* for socket info window */
+   win = elm_win_add(NULL, "label", ELM_WIN_BASIC);
+   elm_win_title_set(win, "Label");
+   elm_win_autodel_set(win, EINA_TRUE);
+
+   bg = elm_bg_add(win);
+   elm_win_resize_object_add(win, bg);
+   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   evas_object_show(bg);
+
+   bx = elm_box_add(win);
+   evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+   lb = elm_label_add(win);
+   elm_object_text_set(lb,
+                       "<b>This is a small label</b>"
+                       );
+   evas_object_size_hint_weight_set(lb, 0.0, 0.0);
+   evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL);
+   elm_box_pack_end(bx, lb);
+   evas_object_show(lb);
+
+   lb = elm_label_add(win);
+   elm_object_text_set(lb,
+                       "If you runs more than Window Plug Program<br/>"
+                       "you can see each plug programs shared same<br/>"
+                       "canvas<br/>"
+                       );
+   evas_object_size_hint_weight_set(lb, 0.0, 0.0);
+   evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL);
+   elm_box_pack_end(bx, lb);
+   evas_object_show(lb);
+
+   
+
+   evas_object_resize(win, 320, 300);
+
+   evas_object_show(bx);
+   evas_object_show(win);
+   elm_win_resize_object_add(win, bx);
+
+   /* for socket window */
+   win_socket = elm_win_add(NULL, "Window Socket", ELM_WIN_SOCKET_IMAGE);
+
+   if (!elm_win_socket_listen(win_socket, "ello", 0, EINA_FALSE))
+       {
+          printf("Fail to elm win socket listen \n");
+          evas_object_del(win_socket);
+          evas_object_del(win);
+          return; 
+       }
+   elm_win_title_set(win_socket, "Window Socket");
+   elm_win_autodel_set(win_socket, EINA_TRUE);
+
+   fill(win_socket, EINA_TRUE);
+
+   evas_object_resize(win_socket, 400, 600);
+   evas_object_show(win_socket);
+
+   evas_object_event_callback_add(win, EVAS_CALLBACK_DEL, _win_del,
+                                  win_socket);   
+}
+#endif
index bc2f300..4d99b8b 100644 (file)
@@ -220,6 +220,7 @@ EAPI extern Elm_Version *elm_version;
 #include <elm_password.h>
 #include <elm_photocam.h>
 #include <elm_photo.h>
+#include <elm_plug.h>
 #include <elm_progressbar.h>
 #include <elm_radio.h>
 #include <elm_route.h>
index c7e4121..3c124cd 100644 (file)
@@ -93,6 +93,7 @@ elm_grid.h \
 elm_hover.h \
 elm_icon.h \
 elm_image.h \
+elm_plug.h \
 elm_index.h \
 elm_intro.h \
 elm_label.h \
@@ -179,6 +180,7 @@ elm_grid.c \
 elm_hover.c \
 elm_icon.c \
 elm_image.c \
+elm_plug.c \
 elm_index.c \
 elm_label.c \
 elm_layout.c \
diff --git a/src/lib/elm_plug.c b/src/lib/elm_plug.c
new file mode 100755 (executable)
index 0000000..bf9db91
--- /dev/null
@@ -0,0 +1,128 @@
+#include <Elementary.h>
+#include "elm_priv.h"
+
+typedef struct _Widget_Data Widget_Data;
+
+struct _Widget_Data
+{
+   Evas_Object *img;
+};
+
+static const char *widtype = NULL;
+static void _del_hook(Evas_Object *obj);
+static void _theme_hook(Evas_Object *obj);
+static void _sizing_eval(Evas_Object *obj);
+static void _mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info);
+
+static const char SIG_CLICKED[] = "clicked";
+
+static const Evas_Smart_Cb_Description _signals[] = {
+       {SIG_CLICKED, ""},
+       {NULL, NULL}
+};
+
+
+static void
+_del_hook(Evas_Object *obj)
+{
+   Widget_Data *wd = elm_widget_data_get(obj);
+
+   if (!wd) return;
+   free(wd);
+}
+
+static void
+_del_pre_hook(Evas_Object *obj)
+{
+   Widget_Data *wd = elm_widget_data_get(obj);
+
+   if (!wd) return;
+   evas_object_del(wd->img);
+}
+
+static void
+_theme_hook(Evas_Object *obj)
+{
+   Widget_Data *wd = elm_widget_data_get(obj);
+
+   if (!wd) return;
+   _sizing_eval(obj);
+}
+
+static void
+_sizing_eval(Evas_Object *obj)
+{
+   Widget_Data *wd = elm_widget_data_get(obj);
+   Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
+
+   if (!wd) return;
+   //TODO: get socket object size
+   evas_object_size_hint_min_set(obj, minw, minh);
+   evas_object_size_hint_max_set(obj, maxw, maxh);
+}
+
+static void
+_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+   evas_object_smart_callback_call(data, SIG_CLICKED, NULL);
+}
+
+
+EAPI Evas_Object *
+elm_plug_image_object_get(const Evas_Object *obj)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return NULL;
+   if (!wd->img) return NULL;
+   return wd->img;
+}
+
+EAPI Evas_Object *
+elm_plug_add(Evas_Object *parent)
+{
+   Evas_Object *obj;
+   Evas *e;
+   Widget_Data *wd;
+   Ecore_Evas *ee;
+
+   ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
+   ELM_SET_WIDTYPE(widtype, "plug");
+   elm_widget_type_set(obj, "plug");
+   elm_widget_sub_object_add(parent, obj);
+   elm_widget_data_set(obj, wd);
+   elm_widget_del_hook_set(obj, _del_hook);
+   elm_widget_del_pre_hook_set(obj, _del_pre_hook);
+   elm_widget_theme_hook_set(obj, _theme_hook);
+   elm_widget_can_focus_set(obj, EINA_FALSE);
+
+   ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
+   if (!ee) return NULL;
+   wd->img = ecore_evas_extn_plug_new(ee);
+   if (!wd->img) return NULL;
+
+   evas_object_event_callback_add(wd->img, EVAS_CALLBACK_MOUSE_UP,
+                                  _mouse_up, obj);
+   elm_widget_resize_object_set(obj, wd->img);
+
+   evas_object_smart_callbacks_descriptions_set(obj, _signals);
+
+   _sizing_eval(obj);
+   return obj;
+}
+
+EAPI Eina_Bool
+elm_plug_connect(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys)
+{
+   Evas_Object *plug_img = NULL;
+
+   plug_img = elm_plug_image_object_get(obj);
+   if (!plug_img) return EINA_FALSE;
+
+   if (ecore_evas_extn_plug_connect(plug_img, svcname, svcnum, svcsys))
+     return EINA_TRUE;
+   else
+     return EINA_FALSE;
+}
+
diff --git a/src/lib/elm_plug.h b/src/lib/elm_plug.h
new file mode 100755 (executable)
index 0000000..634e9af
--- /dev/null
@@ -0,0 +1,65 @@
+/**
+ * @defgroup Plug Plug
+ *
+ *
+ * An object that allows one to show an image which other process created. 
+ * It can be used anywhere like any other elementary widget.
+ *
+ * This widget provides the limited functionality because this widget usually used to show socket's image. 
+ *
+ * If more functionality is needed, it will be added. 
+ *
+ *
+ */
+
+/**
+ * @addtogroup Plug
+ * @{
+ */
+
+/**
+ * Add a new plug image to the parent.
+ *
+ * @param parent The parent object
+ * @return The new plug image object or NULL if it cannot be created
+ *
+ *
+ * @ingroup Plug
+ */
+EAPI Evas_Object    *elm_plug_add(Evas_Object *parent);
+
+/**
+ * Connect a plug widget to service provided by socket image.
+ *
+ * @param ee_target The Ecore_Evas containing the canvas in which the new image object will live.
+ * @param svcname The service name to connect to set up by the socket.
+ * @param svcnum The service number to connect to (set up by socket).
+ * @param svcsys Booleain to set if the service is a system one or not (set up by socket).
+ * @return (@c EINA_TRUE = success, @c EINA_FALSE = error)
+ *
+ *
+ * @ingroup Plug
+ */
+
+EAPI Eina_Bool       elm_plug_connect(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys);
+
+/**
+ * Get the basic Evas_Image object from this object (widget).
+ *
+ * @param obj The image object to get the inlined image from
+ * @return The inlined image object, or NULL if none exists
+ *
+ * This function allows one to get the underlying @c Evas_Object of type
+ * Image from this elementary widget. It can be useful to do things like get
+ * the pixel data, save the image to a file, etc.
+ *
+ * @note Be careful to not manipulate it, as it is under control of
+ * elementary.
+ *
+ * @ingroup Plug
+ */
+EAPI Evas_Object    *elm_plug_image_object_get(const Evas_Object *obj);
+
+/**
+ * @}
+ */
index 588c1af..37aa6ab 100644 (file)
@@ -1545,6 +1545,11 @@ elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
            win->img_obj = NULL;
         }
         break;
+
+      case ELM_WIN_SOCKET_IMAGE:
+        win->ee = ecore_evas_extn_socket_new(1, 1);
+        break;
+
       default:
         if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
           {
@@ -2884,6 +2889,24 @@ elm_win_inwin_content_unset(Evas_Object *obj)
    return content;
 }
 
+EAPI Eina_Bool
+elm_win_socket_listen(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys)
+{
+
+   Elm_Win *win;
+   Ecore_Evas *ee = NULL;
+
+   ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
+   win = elm_widget_data_get(obj);
+   if (!win) return EINA_FALSE;
+   if (!win->ee) return EINA_FALSE;
+
+   if(!ecore_evas_extn_socket_listen(win->ee, svcname, svcnum, svcsys))
+     return EINA_FALSE;
+
+   return EINA_TRUE;
+}
+
 /* windowing spcific calls - shall we do this differently? */
 
 static Ecore_X_Window
index 14fc336..6ff9795 100644 (file)
@@ -133,6 +133,12 @@ typedef enum
                              of window that requires the @c parent
                              parameter of elm_win_add() to be a valid @c
                              Evas_Object. */
+   ELM_WIN_SOCKET_IMAGE,/**< The window is rendered onto an image buffer
+                            and can be shown other process's plug image object.
+                            No actural window is created for this type, 
+                            instead the window and all of its contents will be
+                            rendered to an image buffer and can be shown 
+                            other process's plug image object*/
 } Elm_Win_Type;
 
 /**
@@ -877,6 +883,17 @@ EAPI Eina_Bool             elm_win_keyboard_win_get(const Evas_Object *obj);
 EAPI void                  elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y);
 
 /**
+ * Create a socket to provide the service for Plug widget
+ *
+ * @param obj The window object
+ * @param svcname The name of the service to be advertised. ensure that it is unique (when combined with @p svcnum) otherwise creation may fail.
+ * @param svcnum A number (any value, 0 beig the common default) to differentiate multiple instances of services with the same name.
+ * @param svcsys A boolean that if true, specifies to create a system-wide service all users can connect to, otherwise the service is private to the user ide that created the service.
+ * @return If socket creation is successful
+ */
+EAPI Eina_Bool             elm_win_socket_listen(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys);
+
+/**
  * @}
  */