forked from enlightenment/efl
Ecore_Evas: add new API for unset the cursor from Ecore_Evas.
Summary: Add ecore_evas_cursor_unset function. Use the new function in the ecore_evas_object_example. @feature Test Plan: ecore_evas_object_example Reviewers: raster, cedric, seoz, Hermet CC: cedric Differential Revision: https://phab.enlightenment.org/D812
This commit is contained in:
parent
bb3d5190b8
commit
69552fc392
|
@ -12,20 +12,20 @@
|
|||
#include <Ecore.h>
|
||||
#include <Ecore_Evas.h>
|
||||
|
||||
Evas_Object *cursor;
|
||||
|
||||
static void
|
||||
_mouse_down_cb(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
static Eina_Bool flag = EINA_FALSE;
|
||||
|
||||
if (!flag)
|
||||
ecore_evas_object_cursor_set(data, NULL, 0, 1, 1);
|
||||
else
|
||||
{
|
||||
Evas_Object *cursor = evas_object_rectangle_add(ecore_evas_get(data));
|
||||
evas_object_color_set(cursor, 0, 255, 0, 255);
|
||||
evas_object_resize(cursor, 5, 10);
|
||||
ecore_evas_object_cursor_set(data, cursor, 0, 1, 1);
|
||||
ecore_evas_cursor_unset(data);
|
||||
ecore_evas_object_cursor_set(data, NULL, 0, 1, 1);
|
||||
}
|
||||
else
|
||||
ecore_evas_object_cursor_set(data, cursor, 0, 1, 1);
|
||||
|
||||
flag = !flag;
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ int
|
|||
main(void)
|
||||
{
|
||||
Ecore_Evas *ee;
|
||||
Evas_Object *bg, *cursor, *obj;
|
||||
Evas_Object *bg, *obj;
|
||||
int layer, x, y;
|
||||
|
||||
ecore_evas_init();
|
||||
|
|
|
@ -1939,6 +1939,7 @@ EAPI void ecore_evas_cursor_set(Ecore_Evas *ee, const char *file, int lay
|
|||
* @see ecore_evas_object_cursor_set()
|
||||
*/
|
||||
EAPI void ecore_evas_cursor_get(const Ecore_Evas *ee, Evas_Object **obj, int *layer, int *hot_x, int *hot_y);
|
||||
|
||||
/**
|
||||
* @brief Set the cursor of an Ecore_Evas
|
||||
*
|
||||
|
@ -1958,6 +1959,21 @@ EAPI void ecore_evas_cursor_get(const Ecore_Evas *ee, Evas_Object **obj,
|
|||
*/
|
||||
EAPI void ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y);
|
||||
|
||||
/**
|
||||
* @brief Unset the Ecore_Evas cursor
|
||||
*
|
||||
* @param ee The Ecore_Evas to uset the cursor.
|
||||
*
|
||||
* This function unset the cursor from the Ecore_Evas and return the cursor
|
||||
* object. If the cursor was setted from ecore_evas_cursor_set() fuction
|
||||
* returned the image. In this case this image need to delete when it not be
|
||||
* needed.
|
||||
*
|
||||
* @see ecore_evas_cursor_set()
|
||||
* @see ecore_evas_object_cursor_set()
|
||||
*/
|
||||
EAPI Evas_Object* ecore_evas_cursor_unset(Ecore_Evas *ee);
|
||||
|
||||
/**
|
||||
* Tell the WM whether or not to ignore an Ecore_Evas' window
|
||||
*
|
||||
|
|
|
@ -1725,6 +1725,24 @@ ecore_evas_cursor_get(const Ecore_Evas *ee, Evas_Object **obj, int *layer, int *
|
|||
if (hot_y) *hot_y = ee->prop.cursor.hot.y;
|
||||
}
|
||||
|
||||
EAPI Evas_Object *
|
||||
ecore_evas_cursor_unset(Ecore_Evas *ee)
|
||||
{
|
||||
Evas_Object *obj;
|
||||
|
||||
if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
|
||||
"ecore_evas_cursor_unset");
|
||||
return NULL;
|
||||
}
|
||||
obj = ee->prop.cursor.object;
|
||||
evas_object_hide(obj);
|
||||
ee->prop.cursor.object = NULL;
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_evas_layer_set(Ecore_Evas *ee, int layer)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue