Plug
This feature is supported in mobile applications only.
The plug component shows an Evas_Object created by an other process. It can be used anywhere the same way as any other elementary UI component.
For more information, see the Plug API.
Figure: Plug hierarchy
Adding a Plug Component
To create a plug, use the elm_plug_add() function:
Evas_Object *plug, *parent; plug = elm_plug_add(parent);
Using the Plug
To use the plug:
-
The socket image provides the service where to connect the plug object with the elm_plug_connect() function. In this process, use the service name and number set by the socket you want to connect to.
The following example connects to a service named plug_test on the number 0.
elm_plug_connect(plug, "plug_test", 0, EINA_FALSE);
-
Retrieve the Evas_Object corresponding to the distant image with the elm_plug_image_object_get() function:
Evas_Object *plug_img = elm_plug_image_object_get(plug);
Note The socket to connect to must be started with the elm_win_socket_listen() function in the other process on the remote window object (it is called remote_win here). // Create a remote window in the other process Elm_Win *remote_win = elm_win_add(NULL, "Window Socket", ELM_WIN_SOCKET_IMAGE); // Create a socket named "plug_test" and listen to it elm_win_socket_listen(remote_win, "plug_test", 0, EINA_FALSE);
Using Plug Callbacks
The plug component emits the following signals:
- clicked: The image was clicked (press/release). The event parameter of the callback is NULL.
- image,deleted: The server side was deleted. The event parameter of the callback is NULL.
- image,resized: The server side was resized. The event parameter of the callback is Evas_Coord_Size (2 integers).
The following example shows how to register a callback on the clicked signal:
{ evas_object_smart_callback_add(plug, "clicked", clicked_cb, data); } // Callback function for the "clicked" signal // This callback is called when a plug is clicked void clicked_cb(void *data, Evas_Object *obj, void *event_info) { dlog_print(DLOG_INFO, LOG_TAG, "Plug is clicked\n"); }
Note |
---|
Except as noted, this content is licensed under LGPLv2.1+. |