From 1258eda430dff0f59c3a7a3d5a0105dfd98c9ea9 Mon Sep 17 00:00:00 2001 From: discomfitor Date: Fri, 21 Oct 2011 00:45:19 +0000 Subject: [PATCH] create and use ELM_WIDGET_ITEM for elm widget structs to ensure location/name git-svn-id: https://svn.enlightenment.org/svn/e/trunk/elementary@64218 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/elc_ctxpopup.c | 2 +- src/lib/elc_hoversel.c | 2 +- src/lib/elc_naviframe.c | 2 +- src/lib/elm_diskselector.c | 2 +- src/lib/elm_flipselector.c | 2 +- src/lib/elm_gengrid.c | 2 +- src/lib/elm_index.c | 2 +- src/lib/elm_list.c | 2 +- src/lib/elm_menu.c | 2 +- src/lib/elm_segment_control.c | 2 +- src/lib/elm_slideshow.c | 2 +- src/lib/elm_toolbar.c | 2 +- src/lib/elm_widget.h | 11 +++-------- 13 files changed, 15 insertions(+), 20 deletions(-) diff --git a/src/lib/elc_ctxpopup.c b/src/lib/elc_ctxpopup.c index d318eda..c8f7a6b 100644 --- a/src/lib/elc_ctxpopup.c +++ b/src/lib/elc_ctxpopup.c @@ -8,7 +8,7 @@ typedef struct _Elm_Ctxpopup_Item Elm_Ctxpopup_Item; struct _Elm_Ctxpopup_Item { - Elm_Widget_Item base; + ELM_WIDGET_ITEM; const char *label; Evas_Object *icon; Evas_Smart_Cb func; diff --git a/src/lib/elc_hoversel.c b/src/lib/elc_hoversel.c index 50ddba2..493fd41 100644 --- a/src/lib/elc_hoversel.c +++ b/src/lib/elc_hoversel.c @@ -14,7 +14,7 @@ struct _Widget_Data struct _Elm_Hoversel_Item { - Elm_Widget_Item base; + ELM_WIDGET_ITEM; const char *label; const char *icon_file; const char *icon_group; diff --git a/src/lib/elc_naviframe.c b/src/lib/elc_naviframe.c index ce112f1..8032efe 100644 --- a/src/lib/elc_naviframe.c +++ b/src/lib/elc_naviframe.c @@ -33,7 +33,7 @@ struct _Elm_Naviframe_Text_Item_Pair struct _Elm_Naviframe_Item { - Elm_Widget_Item base; + ELM_WIDGET_ITEM; EINA_INLIST; Eina_Inlist *content_list; Eina_Inlist *text_list; diff --git a/src/lib/elm_diskselector.c b/src/lib/elm_diskselector.c index d3ad63d..1a76271 100644 --- a/src/lib/elm_diskselector.c +++ b/src/lib/elm_diskselector.c @@ -41,7 +41,7 @@ struct _Widget_Data struct _Elm_Diskselector_Item { - Elm_Widget_Item base; + ELM_WIDGET_ITEM; Eina_List *node; Evas_Object *icon; const char *label; diff --git a/src/lib/elm_flipselector.c b/src/lib/elm_flipselector.c index e081d85..60c0e1f 100644 --- a/src/lib/elm_flipselector.c +++ b/src/lib/elm_flipselector.c @@ -26,7 +26,7 @@ struct _Elm_Flipselector_Item { - Elm_Widget_Item base; + ELM_WIDGET_ITEM; const char *label; Evas_Smart_Cb func; void *data; diff --git a/src/lib/elm_gengrid.c b/src/lib/elm_gengrid.c index 85f2f70..5d7827a 100644 --- a/src/lib/elm_gengrid.c +++ b/src/lib/elm_gengrid.c @@ -11,7 +11,7 @@ struct _Elm_Gengrid_Item { - Elm_Widget_Item base; + ELM_WIDGET_ITEM; EINA_INLIST; Evas_Object *spacer; const Elm_Gengrid_Item_Class *gic; diff --git a/src/lib/elm_index.c b/src/lib/elm_index.c index 0143f8e..b2d98c0 100644 --- a/src/lib/elm_index.c +++ b/src/lib/elm_index.c @@ -49,7 +49,7 @@ struct _Widget_Data struct _Elm_Index_Item { - Elm_Widget_Item base; + ELM_WIDGET_ITEM; const char *letter, *vis_letter; int level, size; Eina_Bool selected : 1; diff --git a/src/lib/elm_list.c b/src/lib/elm_list.c index b71d8c1..197ed6d 100644 --- a/src/lib/elm_list.c +++ b/src/lib/elm_list.c @@ -32,7 +32,7 @@ struct _Widget_Data struct _Elm_List_Item { - Elm_Widget_Item base; + ELM_WIDGET_ITEM; Widget_Data *wd; Eina_List *node; const char *label; diff --git a/src/lib/elm_menu.c b/src/lib/elm_menu.c index 8fd4549..492fecd 100644 --- a/src/lib/elm_menu.c +++ b/src/lib/elm_menu.c @@ -5,7 +5,7 @@ typedef struct _Widget_Data Widget_Data; struct _Elm_Menu_Item { - Elm_Widget_Item base; + ELM_WIDGET_ITEM; Elm_Menu_Item *parent; Evas_Object *icon; const char *icon_str; diff --git a/src/lib/elm_segment_control.c b/src/lib/elm_segment_control.c index 9f96f3d..f4ea621 100644 --- a/src/lib/elm_segment_control.c +++ b/src/lib/elm_segment_control.c @@ -15,7 +15,7 @@ struct _Widget_Data struct _Elm_Segment_Item { - Elm_Widget_Item base; + ELM_WIDGET_ITEM; Evas_Object *icon; const char *label; int seg_index; diff --git a/src/lib/elm_slideshow.c b/src/lib/elm_slideshow.c index 4d28296..5e8b653 100644 --- a/src/lib/elm_slideshow.c +++ b/src/lib/elm_slideshow.c @@ -5,7 +5,7 @@ typedef struct _Widget_Data Widget_Data; struct _Elm_Slideshow_Item { - Elm_Widget_Item base; + ELM_WIDGET_ITEM; Eina_List *l, *l_built; diff --git a/src/lib/elm_toolbar.c b/src/lib/elm_toolbar.c index 451aa1b..e965981 100644 --- a/src/lib/elm_toolbar.c +++ b/src/lib/elm_toolbar.c @@ -23,7 +23,7 @@ struct _Widget_Data struct _Elm_Toolbar_Item { - Elm_Widget_Item base; + ELM_WIDGET_ITEM; EINA_INLIST; const char *label; const char *icon_str; diff --git a/src/lib/elm_widget.h b/src/lib/elm_widget.h index dababf6..ab5a806 100644 --- a/src/lib/elm_widget.h +++ b/src/lib/elm_widget.h @@ -199,6 +199,7 @@ typedef Evas_Object *(*Elm_Widget_On_Content_Get_Cb)(const void *data, const cha typedef Evas_Object *(*Elm_Widget_On_Content_Unset_Cb)(const void *data, const char *part); typedef void (*Elm_Widget_On_Signal_Emit_Cb)(void *data, const char *emission, const char *source); +#define ELM_WIDGET_ITEM Elm_Widget_Item base /**< put this as the first member in your widget item struct */ struct _Elm_Widget_Item { /* ef1 ~~ efl, el3 ~~ elm */ @@ -221,7 +222,7 @@ struct _Elm_Widget_Item struct _Elm_Object_Item { - Elm_Widget_Item it; + ELM_WIDGET_ITEM; }; #define ELM_NEW(t) calloc(1, sizeof(t)) @@ -230,7 +231,7 @@ struct _Elm_Object_Item #define ELM_OBJ_ITEM_CHECK_OR_RETURN(it, ...) \ ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *) (it), __VA_ARGS__); \ - ELM_CHECK_WIDTYPE(it->it.widget, widtype) __VA_ARGS__; + ELM_CHECK_WIDTYPE(it->base.widget, widtype) __VA_ARGS__; EAPI Eina_Bool elm_widget_api_check(int ver); EAPI Evas_Object *elm_widget_add(Evas *evas); @@ -590,12 +591,6 @@ EAPI void elm_widget_tree_dot_dump(const Evas_Object *top, FILE *out #define elm_widget_item_signal_emit_hook_set(item, func) \ _elm_widget_item_signal_emit_hook_set((Elm_Widget_Item *)item, (Elm_Widget_On_Signal_Emit_Cb)func) -/** - * Cast and ensure the given pointer is an Elm_Widget_Item or return NULL. - */ -#define ELM_WIDGET_ITEM(item) \ - (((item) && (EINA_MAGIC_CHECK(item, ELM_WIDGET_ITEM_MAGIC))) ? \ - ((Elm_Widget_Item *)(item)) : NULL) #define ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, ...) \ do { \ -- 2.7.4