clean up some of this horrific function pointer debacle
SVN revision: 62322
This commit is contained in:
parent
16fc78925d
commit
49ab1fb009
|
@ -10,6 +10,12 @@ static const char SMART_NAME[] = "elm_widget";
|
|||
Smart_Data * sd = evas_object_smart_data_get(obj); \
|
||||
if (!sd) return;
|
||||
|
||||
#undef elm_widget_text_set_hook_set
|
||||
#undef elm_widget_text_get_hook_set
|
||||
#undef elm_widget_content_set_hook_set
|
||||
#undef elm_widget_content_get_hook_set
|
||||
#undef elm_widget_content_unset_hook_set
|
||||
|
||||
typedef struct _Smart_Data Smart_Data;
|
||||
typedef struct _Edje_Signal_Data Edje_Signal_Data;
|
||||
typedef struct _Elm_Event_Cb_Data Elm_Event_Cb_Data;
|
||||
|
@ -71,18 +77,11 @@ struct _Smart_Data
|
|||
Evas_Coord *y,
|
||||
Evas_Coord *w,
|
||||
Evas_Coord *h);
|
||||
void (*on_text_set_func)(Evas_Object *obj,
|
||||
const char *item,
|
||||
const char *text);
|
||||
const char *(*on_text_get_func)(const Evas_Object *obj,
|
||||
const char *item);
|
||||
void (*on_content_set_func)(Evas_Object *obj,
|
||||
const char *item,
|
||||
Evas_Object *content);
|
||||
Evas_Object *(*on_content_get_func)(const Evas_Object *obj,
|
||||
const char *item);
|
||||
Evas_Object *(*on_content_unset_func)(Evas_Object *obj,
|
||||
const char *item);
|
||||
Elm_Widget_On_Text_Set_Cb on_text_set_func;
|
||||
Elm_Widget_On_Text_Get_Cb on_text_get_func;
|
||||
Elm_Widget_On_Content_Set_Cb on_content_set_func;
|
||||
Elm_Widget_On_Content_Get_Cb on_content_get_func;
|
||||
Elm_Widget_On_Content_Unset_Cb on_content_unset_func;
|
||||
void *data;
|
||||
Evas_Coord rx, ry, rw, rh;
|
||||
int scroll_hold;
|
||||
|
@ -507,9 +506,7 @@ elm_widget_event_hook_set(Evas_Object *obj,
|
|||
|
||||
EAPI void
|
||||
elm_widget_text_set_hook_set(Evas_Object *obj,
|
||||
void (*func)(Evas_Object *obj,
|
||||
const char *part,
|
||||
const char *text))
|
||||
Elm_Widget_On_Text_Set_Cb func)
|
||||
{
|
||||
API_ENTRY return;
|
||||
sd->on_text_set_func = func;
|
||||
|
@ -517,8 +514,7 @@ elm_widget_text_set_hook_set(Evas_Object *obj,
|
|||
|
||||
EAPI void
|
||||
elm_widget_text_get_hook_set(Evas_Object *obj,
|
||||
const char *(*func)(const Evas_Object *obj,
|
||||
const char *part))
|
||||
Elm_Widget_On_Text_Get_Cb func)
|
||||
{
|
||||
API_ENTRY return;
|
||||
sd->on_text_get_func = func;
|
||||
|
@ -526,9 +522,7 @@ elm_widget_text_get_hook_set(Evas_Object *obj,
|
|||
|
||||
EAPI void
|
||||
elm_widget_content_set_hook_set(Evas_Object *obj,
|
||||
void (*func)(Evas_Object *obj,
|
||||
const char *part,
|
||||
Evas_Object *content))
|
||||
Elm_Widget_On_Content_Set_Cb func)
|
||||
{
|
||||
API_ENTRY return;
|
||||
sd->on_content_set_func = func;
|
||||
|
@ -536,8 +530,7 @@ elm_widget_content_set_hook_set(Evas_Object *obj,
|
|||
|
||||
EAPI void
|
||||
elm_widget_content_get_hook_set(Evas_Object *obj,
|
||||
Evas_Object *(*func)(const Evas_Object *obj,
|
||||
const char *part))
|
||||
Elm_Widget_On_Content_Get_Cb func)
|
||||
{
|
||||
API_ENTRY return;
|
||||
sd->on_content_get_func = func;
|
||||
|
@ -545,8 +538,7 @@ elm_widget_content_get_hook_set(Evas_Object *obj,
|
|||
|
||||
EAPI void
|
||||
elm_widget_content_unset_hook_set(Evas_Object *obj,
|
||||
Evas_Object *(*func)(Evas_Object *obj,
|
||||
const char *part))
|
||||
Elm_Widget_On_Content_Unset_Cb func)
|
||||
{
|
||||
API_ENTRY return;
|
||||
sd->on_content_unset_func = func;
|
||||
|
@ -3040,9 +3032,7 @@ _elm_widget_item_text_part_get(const Elm_Widget_Item *item,
|
|||
|
||||
EAPI void
|
||||
_elm_widget_item_content_set_hook_set(Elm_Widget_Item *item,
|
||||
void (*func)(Elm_Object_Item *it,
|
||||
const char *part,
|
||||
Evas_Object *content))
|
||||
Elm_Widget_On_Content_Set_Cb func)
|
||||
{
|
||||
ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
|
||||
item->on_content_set_func = func;
|
||||
|
@ -3050,8 +3040,7 @@ _elm_widget_item_content_set_hook_set(Elm_Widget_Item *item,
|
|||
|
||||
EAPI void
|
||||
_elm_widget_item_content_get_hook_set(Elm_Widget_Item *item,
|
||||
Evas_Object *(*func)(const Elm_Object_Item *it,
|
||||
const char *part))
|
||||
Elm_Widget_On_Content_Get_Cb func)
|
||||
{
|
||||
ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
|
||||
item->on_content_get_func = func;
|
||||
|
@ -3059,8 +3048,7 @@ _elm_widget_item_content_get_hook_set(Elm_Widget_Item *item,
|
|||
|
||||
EAPI void
|
||||
_elm_widget_item_content_unset_hook_set(Elm_Widget_Item *item,
|
||||
Evas_Object *(*func)(Elm_Object_Item *it,
|
||||
const char *part))
|
||||
Elm_Widget_On_Content_Unset_Cb func)
|
||||
{
|
||||
ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
|
||||
item->on_content_unset_func = func;
|
||||
|
@ -3068,9 +3056,7 @@ _elm_widget_item_content_unset_hook_set(Elm_Widget_Item *item,
|
|||
|
||||
EAPI void
|
||||
_elm_widget_item_text_set_hook_set(Elm_Widget_Item *item,
|
||||
void (*func)(Elm_Object_Item *it,
|
||||
const char *part,
|
||||
const char *label))
|
||||
Elm_Widget_On_Text_Set_Cb func)
|
||||
{
|
||||
ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
|
||||
item->on_text_set_func = func;
|
||||
|
@ -3078,8 +3064,7 @@ _elm_widget_item_text_set_hook_set(Elm_Widget_Item *item,
|
|||
|
||||
EAPI void
|
||||
_elm_widget_item_text_get_hook_set(Elm_Widget_Item *item,
|
||||
const char *(*func)(const Elm_Object_Item *it,
|
||||
const char *part))
|
||||
Elm_Widget_On_Text_Get_Cb func)
|
||||
{
|
||||
ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
|
||||
item->on_text_get_func = func;
|
||||
|
|
|
@ -192,6 +192,12 @@ typedef struct _Elm_Tooltip Elm_Tooltip;
|
|||
typedef struct _Elm_Cursor Elm_Cursor;
|
||||
typedef struct _Elm_Widget_Item Elm_Widget_Item; /**< base structure for all widget items that are not Elm_Widget themselves */
|
||||
|
||||
typedef void (*Elm_Widget_On_Text_Set_Cb)(void *, const char *part, const char *text);
|
||||
typedef void (*Elm_Widget_On_Content_Set_Cb)(void *, const char *part, Evas_Object *content);
|
||||
typedef const char *(*Elm_Widget_On_Text_Get_Cb)(const void *, const char *part);
|
||||
typedef Evas_Object *(*Elm_Widget_On_Content_Get_Cb)(const void *, const char *part);
|
||||
typedef Evas_Object *(*Elm_Widget_On_Content_Unset_Cb)(const void *, const char *part);
|
||||
|
||||
struct _Elm_Widget_Item
|
||||
{
|
||||
/* ef1 ~~ efl, el3 ~~ elm */
|
||||
|
@ -202,18 +208,11 @@ struct _Elm_Widget_Item
|
|||
Evas_Object *view; /**< the base view object */
|
||||
const void *data; /**< item specific data */
|
||||
Evas_Smart_Cb del_cb; /**< used to notify the item is being deleted */
|
||||
void (*on_content_set_func)(Elm_Object_Item *item,
|
||||
const char *part,
|
||||
Evas_Object *content);
|
||||
Evas_Object *(*on_content_get_func)(const Elm_Object_Item *item,
|
||||
const char *part);
|
||||
Evas_Object *(*on_content_unset_func)(Elm_Object_Item *item,
|
||||
const char *part);
|
||||
void (*on_text_set_func)(Elm_Object_Item *item,
|
||||
const char *part,
|
||||
const char *label);
|
||||
const char *(*on_text_get_func)(const Elm_Object_Item *item,
|
||||
const char *part);
|
||||
Elm_Widget_On_Content_Set_Cb on_content_set_func;
|
||||
Elm_Widget_On_Content_Get_Cb on_content_get_func;
|
||||
Elm_Widget_On_Content_Unset_Cb on_content_unset_func;
|
||||
Elm_Widget_On_Text_Set_Cb on_text_set_func;
|
||||
Elm_Widget_On_Text_Get_Cb on_text_get_func;
|
||||
/* widget variations should have data from here and on */
|
||||
/* @todo: TODO check if this is enough for 1.0 release, maybe add padding! */
|
||||
};
|
||||
|
@ -251,11 +250,16 @@ EAPI void elm_widget_on_focus_hook_set(Evas_Object *obj, void (*func
|
|||
EAPI void elm_widget_on_change_hook_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj), void *data);
|
||||
EAPI void elm_widget_on_show_region_hook_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj), void *data);
|
||||
EAPI void elm_widget_focus_region_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h));
|
||||
EAPI void elm_widget_text_set_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj, const char *part, const char *text));
|
||||
EAPI void elm_widget_text_get_hook_set(Evas_Object *obj, const char *(*func)(const Evas_Object *obj, const char *part));
|
||||
EAPI void elm_widget_content_set_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj, const char *part, Evas_Object *content));
|
||||
EAPI void elm_widget_content_get_hook_set(Evas_Object *obj, Evas_Object *(*func)(const Evas_Object *obj, const char *part));
|
||||
EAPI void elm_widget_content_unset_hook_set(Evas_Object *obj, Evas_Object *(*func)(Evas_Object *obj, const char *part));
|
||||
EAPI void elm_widget_text_set_hook_set(Evas_Object *obj, Elm_Widget_On_Text_Set_Cb func);
|
||||
#define elm_widget_text_set_hook_set(obj, func) elm_widget_text_set_hook_set(obj, (Elm_Widget_On_Text_Set_Cb)(func))
|
||||
EAPI void elm_widget_text_get_hook_set(Evas_Object *obj, Elm_Widget_On_Text_Get_Cb func);
|
||||
#define elm_widget_text_get_hook_set(obj, func) elm_widget_text_get_hook_set(obj, (Elm_Widget_On_Text_Get_Cb)(func))
|
||||
EAPI void elm_widget_content_set_hook_set(Evas_Object *obj, Elm_Widget_On_Content_Set_Cb func);
|
||||
#define elm_widget_content_set_hook_set(obj, func) elm_widget_content_set_hook_set(obj, (Elm_Widget_On_Content_Set_Cb)(func))
|
||||
EAPI void elm_widget_content_get_hook_set(Evas_Object *obj, Elm_Widget_On_Content_Get_Cb func);
|
||||
#define elm_widget_content_get_hook_set(obj, func) elm_widget_content_get_hook_set(obj, (Elm_Widget_On_Content_Get_Cb)(func))
|
||||
EAPI void elm_widget_content_unset_hook_set(Evas_Object *obj, Elm_Widget_On_Content_Unset_Cb func);
|
||||
#define elm_widget_content_unset_hook_set(obj, func) elm_widget_content_unset_hook_set(obj, (Elm_Widget_On_Content_Unset_Cb)(func))
|
||||
EAPI void elm_widget_on_focus_region_hook_set(Evas_Object *obj, void (*func) (const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h));
|
||||
EAPI void elm_widget_data_set(Evas_Object *obj, void *data);
|
||||
EAPI void *elm_widget_data_get(const Evas_Object *obj);
|
||||
|
@ -264,8 +268,8 @@ EAPI void elm_widget_sub_object_del(Evas_Object *obj, Evas_Object *s
|
|||
EAPI void elm_widget_resize_object_set(Evas_Object *obj, Evas_Object *sobj);
|
||||
EAPI void elm_widget_hover_object_set(Evas_Object *obj, Evas_Object *sobj);
|
||||
EAPI void elm_widget_signal_emit(Evas_Object *obj, const char *emission, const char *source);
|
||||
EAPI void elm_widget_signal_callback_add(Evas_Object *obj, const char *emission, const char *source, void (*func) (void *data, Evas_Object *o, const char *emission, const char *source), void *data);
|
||||
EAPI void *elm_widget_signal_callback_del(Evas_Object *obj, const char *emission, const char *source, void (*func) (void *data, Evas_Object *o, const char *emission, const char *source));
|
||||
EAPI void elm_widget_signal_callback_add(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data);
|
||||
EAPI void *elm_widget_signal_callback_del(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func);
|
||||
EAPI void elm_widget_can_focus_set(Evas_Object *obj, Eina_Bool can_focus);
|
||||
EAPI Eina_Bool elm_widget_can_focus_get(const Evas_Object *obj);
|
||||
EAPI Eina_Bool elm_widget_child_can_focus_get(const Evas_Object *obj);
|
||||
|
@ -390,11 +394,11 @@ EAPI Evas_Object *_elm_widget_item_content_part_get(const Elm_Widget_Item *i
|
|||
EAPI Evas_Object *_elm_widget_item_content_part_unset(Elm_Widget_Item *item, const char *part);
|
||||
EAPI void _elm_widget_item_text_part_set(Elm_Widget_Item *item, const char *part, const char *label);
|
||||
EAPI const char *_elm_widget_item_text_part_get(const Elm_Widget_Item *item, const char *part);
|
||||
EAPI void _elm_widget_item_content_set_hook_set(Elm_Widget_Item *item, void (*func)(Elm_Object_Item *it, const char *part, Evas_Object *content));
|
||||
EAPI void _elm_widget_item_content_get_hook_set(Elm_Widget_Item *item, Evas_Object *(*func)(const Elm_Object_Item *it, const char *part));
|
||||
EAPI void _elm_widget_item_content_unset_hook_set(Elm_Widget_Item *item, Evas_Object *(*func)(Elm_Object_Item *it, const char *part));
|
||||
EAPI void _elm_widget_item_text_set_hook_set(Elm_Widget_Item *item, void (*func)(Elm_Object_Item *it, const char *part, const char *label));
|
||||
EAPI void _elm_widget_item_text_get_hook_set(Elm_Widget_Item *item, const char *(*func)(const Elm_Object_Item *it, const char *part));
|
||||
EAPI void _elm_widget_item_content_set_hook_set(Elm_Widget_Item *item, Elm_Widget_On_Content_Set_Cb func);
|
||||
EAPI void _elm_widget_item_content_get_hook_set(Elm_Widget_Item *item, Elm_Widget_On_Content_Get_Cb func);
|
||||
EAPI void _elm_widget_item_content_unset_hook_set(Elm_Widget_Item *item, Elm_Widget_On_Content_Unset_Cb func);
|
||||
EAPI void _elm_widget_item_text_set_hook_set(Elm_Widget_Item *item, Elm_Widget_On_Text_Set_Cb func);
|
||||
EAPI void _elm_widget_item_text_get_hook_set(Elm_Widget_Item *item, Elm_Widget_On_Text_Get_Cb func);
|
||||
|
||||
|
||||
/* debug function. don't use it unless you are tracking parenting issues */
|
||||
|
@ -556,31 +560,31 @@ EAPI void elm_widget_tree_dot_dump(const Evas_Object *top, FILE *out
|
|||
* @see _elm_widget_item_content_set_hook_set()
|
||||
*/
|
||||
#define elm_widget_item_content_set_hook_set(item, func) \
|
||||
_elm_widget_item_content_set_hook_set((Elm_Widget_Item *)item, func)
|
||||
_elm_widget_item_content_set_hook_set((Elm_Widget_Item *)item, (Elm_Widget_On_Content_Set_Cb)func)
|
||||
/**
|
||||
* Convenience function to query item's content get hook.
|
||||
* @see _elm_widget_item_content_get_hook_set()
|
||||
*/
|
||||
#define elm_widget_item_content_get_hook_set(item, func) \
|
||||
_elm_widget_item_content_get_hook_set((Elm_Widget_Item *)item, func)
|
||||
_elm_widget_item_content_get_hook_set((Elm_Widget_Item *)item, (Elm_Widget_On_Content_Get_Cb)func)
|
||||
/**
|
||||
* Convenience function to query item's content unset hook.
|
||||
* @see _elm_widget_item_content_unset_hook_set()
|
||||
*/
|
||||
#define elm_widget_item_content_unset_hook_set(item, func) \
|
||||
_elm_widget_item_content_unset_hook_set((Elm_Widget_Item *)item, func)
|
||||
_elm_widget_item_content_unset_hook_set((Elm_Widget_Item *)item, (Elm_Widget_On_Content_Unset_Cb)func)
|
||||
/**
|
||||
* Convenience function to query item's text set hook.
|
||||
* @see _elm_widget_item_text_set_hook_set()
|
||||
*/
|
||||
#define elm_widget_item_text_set_hook_set(item, func) \
|
||||
_elm_widget_item_text_set_hook_set((Elm_Widget_Item *)item, func)
|
||||
_elm_widget_item_text_set_hook_set((Elm_Widget_Item *)item, (Elm_Widget_On_Text_Set_Cb)func)
|
||||
/**
|
||||
* Convenience function to query item's text get hook.
|
||||
* @see _elm_widget_item_text_get_hook_set()
|
||||
*/
|
||||
#define elm_widget_item_text_get_hook_set(item, func) \
|
||||
_elm_widget_item_text_get_hook_set((Elm_Widget_Item *)item, func)
|
||||
_elm_widget_item_text_get_hook_set((Elm_Widget_Item *)item, (Elm_Widget_On_Text_Get_Cb)func)
|
||||
|
||||
/**
|
||||
* Cast and ensure the given pointer is an Elm_Widget_Item or return NULL.
|
||||
|
|
Loading…
Reference in New Issue