elm_plug: callback when server side image changed.
changelog and news will come later. SVN revision: 81312
This commit is contained in:
parent
c02d084ef7
commit
3a80bee71c
|
@ -59,6 +59,15 @@ cb_plug_disconnected(void *data __UNUSED__,
|
|||
evas_object_data_set(obj, "test-timer", timer);
|
||||
}
|
||||
|
||||
static void
|
||||
cb_plug_resized(void *data __UNUSED__,
|
||||
Evas_Object *obj __UNUSED__,
|
||||
void *event_info)
|
||||
{
|
||||
Evas_Coord_Size *size = event_info;
|
||||
printf("server image resized to %dx%d\n", size->w, size->h);
|
||||
}
|
||||
|
||||
static void
|
||||
cb_mouse_down(void *data __UNUSED__, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
|
@ -161,6 +170,7 @@ test_win_plug(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
|
|||
}
|
||||
|
||||
evas_object_smart_callback_add(plug, "image.deleted", cb_plug_disconnected, NULL);
|
||||
evas_object_smart_callback_add(plug, "image,resized", cb_plug_resized, NULL);
|
||||
|
||||
evas_object_resize(plug, 380, 500);
|
||||
evas_object_move(plug, 10, 10);
|
||||
|
|
|
@ -12,9 +12,11 @@ static const char PLUG_KEY[] = "__Plug_Ecore_Evas";
|
|||
|
||||
static const char SIG_CLICKED[] = "clicked";
|
||||
static const char SIG_IMAGE_DELETED[] = "image.deleted";
|
||||
static const char SIG_IMAGE_RESIZED[] = "image,resized";
|
||||
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
||||
{SIG_CLICKED, ""},
|
||||
{SIG_IMAGE_DELETED, ""},
|
||||
{SIG_IMAGE_RESIZED, "ii"},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
@ -40,6 +42,17 @@ _elm_plug_disconnected(Ecore_Evas *ee)
|
|||
evas_object_smart_callback_call(plug, SIG_IMAGE_DELETED, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_plug_resized(Ecore_Evas *ee)
|
||||
{
|
||||
Evas_Coord_Size size = {0, 0};
|
||||
Evas_Object *plug = ecore_evas_data_get(ee, PLUG_KEY);
|
||||
EINA_SAFETY_ON_NULL_RETURN(plug);
|
||||
|
||||
ecore_evas_geometry_get(ee, NULL, NULL, &(size.w), &(size.h));
|
||||
evas_object_smart_callback_call(plug, SIG_IMAGE_RESIZED, &size);
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_plug_smart_theme(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
|
||||
{
|
||||
|
@ -170,6 +183,7 @@ _connect(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
|
|||
|
||||
ecore_evas_data_set(ee, PLUG_KEY, obj);
|
||||
ecore_evas_callback_delete_request_set(ee, _elm_plug_disconnected);
|
||||
ecore_evas_callback_resize_set(ee, _elm_plug_resized);
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,21 @@
|
|||
* 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 emits the following signals:
|
||||
* @li "clicked": the user clicked the image (press/release). The @c
|
||||
* event parameter of the callback will be @c NULL.
|
||||
* @li "image.deleted": the server side was deleted. The @c event
|
||||
* parameter of the callback will be @c NULL.
|
||||
* @li "image,resized": the server side was resized. The @c event parameter of
|
||||
* the callback will be @c Evas_Coord_Size (two integers).
|
||||
*
|
||||
* @note the event "image,resized" will be sent whenever the server
|
||||
* resized its image and this @b always happen on the first
|
||||
* time. Then it can be used to track when the server-side image
|
||||
* is fully known (client connected to server, retrieved its
|
||||
* image buffer through shared memory and resized the evas
|
||||
* object).
|
||||
*
|
||||
*/
|
||||
|
||||
#define ELM_OBJ_PLUG_CLASS elm_obj_plug_class_get()
|
||||
|
|
Loading…
Reference in New Issue