forked from enlightenment/efl
And as Bruno Dilly pointed out, we already have hooks for these things, so better use them.
SVN revision: 53963
This commit is contained in:
parent
16cead1e35
commit
7801aade62
|
@ -887,10 +887,6 @@ extern "C" {
|
|||
EAPI Evas_Object *elm_layout_table_unpack(Evas_Object *obj, const char *part, Evas_Object *child_obj);
|
||||
EAPI void elm_layout_table_clear(Evas_Object *obj, const char *part, Eina_Bool clear);
|
||||
|
||||
EAPI void elm_layout_signal_emit(Evas_Object *obj, const char *signal, const char *source);
|
||||
EAPI void elm_layout_signal_callback_add(Evas_Object *obj, const char *signal, const char *source, Edje_Signal_Cb func, void *data);
|
||||
EAPI void *elm_layout_signal_callback_del(Evas_Object *obj, const char *signal, const char *source, Edje_Signal_Cb func);
|
||||
|
||||
EAPI Evas_Object *elm_layout_edje_get(const Evas_Object *obj);
|
||||
EAPI void elm_layout_sizing_eval(Evas_Object *obj);
|
||||
|
||||
|
@ -916,7 +912,7 @@ extern "C" {
|
|||
sig = "elm,state,icon,visible"; \
|
||||
else \
|
||||
sig = "elm,state,icon,hidden"; \
|
||||
elm_layout_signal_emit((_ly), sig, "elm"); \
|
||||
elm_object_signal_emit((_ly), sig, "elm"); \
|
||||
} while(0)
|
||||
|
||||
/**
|
||||
|
@ -944,7 +940,7 @@ extern "C" {
|
|||
sig = "elm,state,end,visible"; \
|
||||
else \
|
||||
sig = "elm,state,end,hidden"; \
|
||||
elm_layout_signal_emit((_ly), sig, "elm"); \
|
||||
elm_object_signal_emit((_ly), sig, "elm"); \
|
||||
} while(0)
|
||||
|
||||
/**
|
||||
|
|
|
@ -108,6 +108,29 @@ _changed_hook(Evas_Object *obj)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_signal_emit_hook(Evas_Object *obj, const char *emission, const char *source)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
edje_object_signal_emit(wd->lay, emission, source);
|
||||
}
|
||||
|
||||
static void
|
||||
_signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, void (*func_cb) (void *data, Evas_Object *o, const char *emission, const char *source), void *data)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
edje_object_signal_callback_add(wd->lay, emission, source, func_cb, data);
|
||||
}
|
||||
|
||||
static void *
|
||||
_signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, void (*func_cb) (void *data, Evas_Object *o, const char *emission, const char *source))
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
return edje_object_signal_callback_del(wd->lay, emission, source,
|
||||
func_cb);
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
_elm_layout_list_data_get(const Eina_List *list)
|
||||
{
|
||||
|
@ -299,6 +322,9 @@ elm_layout_add(Evas_Object *parent)
|
|||
elm_widget_changed_hook_set(obj, _changed_hook);
|
||||
elm_widget_can_focus_set(obj, EINA_FALSE);
|
||||
elm_widget_focus_next_hook_set(obj, _elm_layout_focus_next_hook);
|
||||
elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
|
||||
elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
|
||||
elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
|
||||
|
||||
wd->lay = edje_object_add(e);
|
||||
elm_widget_resize_object_set(obj, wd->lay);
|
||||
|
@ -932,71 +958,6 @@ elm_layout_table_clear(Evas_Object *obj, const char *part, Eina_Bool clear)
|
|||
edje_object_part_table_clear(wd->lay, part, clear);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a signal to the Edje object of the layout
|
||||
*
|
||||
* Just a wrapper function around edje_object_signal_emit() so users don't
|
||||
* need to fetch the edje from the layout every time.
|
||||
*
|
||||
* @param obj The layout object
|
||||
* @param signal The signal to emit
|
||||
* @param source The signal source
|
||||
*
|
||||
* @ingroup Layout
|
||||
*/
|
||||
EAPI void
|
||||
elm_layout_signal_emit(Evas_Object *obj, const char *signal, const char *source)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
ELM_CHECK_WIDTYPE(obj, widtype);
|
||||
edje_object_signal_emit(wd->lay, signal, source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a callback for signals emitted from Edje
|
||||
*
|
||||
* Wrapper function so users don't have to retrieve the edje object
|
||||
* every time.
|
||||
*
|
||||
* @param obj The layout object
|
||||
* @param signal Signal to listen for
|
||||
* @param source Source to listen for
|
||||
* @param func The function to call on signal emissions
|
||||
* @param data User data
|
||||
*
|
||||
* @ingroup Layout
|
||||
*/
|
||||
EAPI void
|
||||
elm_layout_signal_callback_add(Evas_Object *obj, const char *signal, const char *source, Edje_Signal_Cb func, void *data)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
ELM_CHECK_WIDTYPE(obj, widtype);
|
||||
edje_object_signal_callback_add(wd->lay, signal, source, func, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a callback for signals.
|
||||
*
|
||||
* Wrapper function so users don't have to retrieve the edje object
|
||||
* every time.
|
||||
*
|
||||
* @param obj The layout object
|
||||
* @param signal Signal it was listening to
|
||||
* @param source Source it was listening to
|
||||
* @param func The function set as callback
|
||||
*
|
||||
* @return The user data given on @f elm_layout_signal_callback_add
|
||||
*
|
||||
* @ingroup Layout
|
||||
*/
|
||||
EAPI void *
|
||||
elm_layout_signal_callback_del(Evas_Object *obj, const char *signal, const char *source, Edje_Signal_Cb func)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
||||
return edje_object_signal_callback_del(wd->lay, signal, source, func);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the edje layout
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue