implemented ecore_evas_data_get/set

SVN revision: 11501
This commit is contained in:
tsauerbeck 2004-09-02 16:50:18 +00:00 committed by tsauerbeck
parent f56ba99d4d
commit 325cc6fe68
3 changed files with 38 additions and 2 deletions

View File

@ -10,7 +10,6 @@
* to do soon:
* - iconfication api needs to work
* - maximization api nees to work
* - attach keyed data to an ecore_evas canvas
* - document all calls
*
* later:
@ -59,6 +58,8 @@ Ecore_Evas *ecore_evas_fb_new(char *disp_name, int rotation, int w, int h);
/* generic manipulation calls */
void ecore_evas_free(Ecore_Evas *ee);
void *ecore_evas_data_get(Ecore_Evas *ee, const char *key);
void ecore_evas_data_set(Ecore_Evas *ee, const char *key, const void *data);
void ecore_evas_callback_resize_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
void ecore_evas_callback_move_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
void ecore_evas_callback_show_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));

View File

@ -62,6 +62,7 @@ ecore_evas_free(Ecore_Evas *ee)
return;
}
ECORE_MAGIC_SET(ee, ECORE_MAGIC_NONE);
if (ee->data) evas_hash_free(ee->data);
if (ee->driver) free(ee->driver);
if (ee->name) free(ee->name);
if (ee->prop.title) free(ee->prop.title);
@ -70,6 +71,7 @@ ecore_evas_free(Ecore_Evas *ee)
if (ee->prop.cursor.file) free(ee->prop.cursor.file);
if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object);
if (ee->evas) evas_free(ee->evas);
ee->data = NULL;
ee->driver = NULL;
ee->name = NULL;
ee->prop.title = NULL;
@ -82,6 +84,37 @@ ecore_evas_free(Ecore_Evas *ee)
free(ee);
}
void *
ecore_evas_data_get(Ecore_Evas *ee, const char *key)
{
if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
{
ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
"ecore_evas_data_get");
return NULL;
}
if (!key) return NULL;
return evas_hash_find(ee->data, key);
}
void
ecore_evas_data_set(Ecore_Evas *ee, const char *key, const void *data)
{
if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
{
ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
"ecore_evas_data_set");
return;
}
if (!key) return;
ee->data = evas_hash_del(ee->data, key, NULL);
ee->data = evas_hash_add(ee->data, key, data);
}
#define IFC(_ee, _fn) if (_ee->engine.func->_fn) {_ee->engine.func->_fn
#define IFE return;}

View File

@ -104,7 +104,9 @@ struct _Ecore_Evas
char shaped : 1;
char visible : 1;
char should_be_visible : 1;
Evas_Hash *data;
struct {
int x, y;
} mouse;