* Fix elm_conform didn't change indicator mode when create.
+2013-03-06 ChunEon Park (Hermet)
+
+ * Add elm_object_item_signal_callback_add(), elm_object_item_signal_callback_del().
+
* Add omit feature to elm_index.
* Add elm_transit_smooth_set(), elm_transit_smooth_get()
* Add edje_object_message_signal_process before edje_object_size_min_restricted_calc.
+ * Add elm_object_item_signal_callback_add(), elm_object_item_signal_callback_del().
Improvements:
_elm_widget_item_signal_emit((Elm_Widget_Item *)it, emission, source);
}
+EAPI void
+elm_object_item_signal_callback_add(Elm_Object_Item *it, const char *emission, const char *source, Elm_Object_Item_Signal_Cb func, void *data)
+{
+ _elm_widget_item_signal_callback_add((Elm_Widget_Item *)it, emission, source, (Elm_Widget_Item_Signal_Cb) func, data);
+}
+
+EAPI void *
+elm_object_item_signal_callback_del(Elm_Object_Item *it, const char *emission, const char *source, Elm_Object_Item_Signal_Cb func)
+{
+ return _elm_widget_item_signal_callback_del((Elm_Widget_Item *)it, emission, source, (Elm_Widget_Item_Signal_Cb) func);
+}
+
EAPI void elm_object_item_disabled_set(Elm_Object_Item *it, Eina_Bool disabled)
{
_elm_widget_item_disabled_set((Elm_Widget_Item *)it, disabled);
/**
+ * @typedef Elm_Object_Item_Signal_Cb
+ *
+ * Elm_Object_Item Signal Callback functions' prototype definition. @c data
+ * will have the auxiliary data pointer at the time the callback registration.
+ * @c it will be a pointer the Elm_Object_Item that have the edje object where
+ * the signal comes from. @c emission will identify the exact signal's emission
+ * string and @c source the exact signal's source one.
+ *
+ * @see elm_object_item_signal_callback_add()
+ * @since 1.8
+ */
+typedef void (*Elm_Object_Item_Signal_Cb)(void *data, Elm_Object_Item *it, const char *emission, const char *source);
+
+/**
* Get the widget object's handle which contains a given item
*
* @param it The Elementary object item
EAPI void elm_object_item_signal_emit(Elm_Object_Item *it, const char *emission, const char *source);
/**
+ * Add a callback for a signal emitted by object item edje.
+ *
+ * This function connects a callback function to a signal emitted by the
+ * edje object of the object item.
+ * Globs can occur in either the emission or source name.
+ *
+ * @param it The elementary object item
+ * @param emission The signal's name.
+ * @param source The signal's source.
+ * @param func The callback function to be executed when the signal is
+ * emitted.
+ * @param data A pointer to data to pass to the callback function.
+ * @since 1.8
+ *
+ * @ingroup General
+ */
+EAPI void elm_object_item_signal_callback_add(Elm_Object_Item *it, const char *emission, const char *source, Elm_Object_Item_Signal_Cb func, void *data);
+
+/**
+ * Remove a signal-triggered callback from a object item edje object.
+ *
+ * @param it The elementary object item
+ * @param emission The signal's name.
+ * @param source The signal's source.
+ * @param func The callback function to be executed when the signal is
+ * emitted.
+ * @return The data pointer of the signal callback or @c NULL, on
+ * errors.
+ *
+ * This function removes the @b last callback, previously attached to
+ * a signal emitted by an underlying Edje object of @a it, whose
+ * parameters @a emission, @a source and @c func match exactly with
+ * those passed to a previous call to
+ * elm_object_item_signal_callback_add(). The data pointer that was passed
+ * to this call will be returned.
+ *
+ * @see elm_object_item_signal_callback_add()
+ * @since 1.8
+ *
+ * @ingroup General
+ */
+EAPI void *elm_object_item_signal_callback_del(Elm_Object_Item *it, const char *emission, const char *source, Elm_Object_Item_Signal_Cb func);
+
+/**
* Set the disabled state of an widget item.
*
* @param it The Elementary object item
_elm_widget_item_free(Elm_Widget_Item *item)
{
Elm_Translate_String_Data *ts;
+ Elm_Widget_Item_Signal_Data *wisd;
ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
if (item->access_info)
eina_stringshare_del(item->access_info);
+ EINA_LIST_FREE (item->signals, wisd)
+ {
+ eina_stringshare_del(wisd->emission);
+ eina_stringshare_del(wisd->source);
+ free(wisd);
+ }
+
EINA_LIST_FREE (item->translate_strings, ts)
{
eina_stringshare_del(ts->id);
item->signal_emit_func = func;
}
+
+static void
+_elm_widget_item_signal_cb(void *data, Evas_Object *obj __UNUSED__, const char *emission,
+ const char *source)
+{
+ Elm_Widget_Item_Signal_Data *wisd = data;
+ wisd->func(wisd->data, wisd->item, emission, source);
+}
+
+EAPI void
+_elm_widget_item_signal_callback_add(Elm_Widget_Item *item,
+ const char *emission,
+ const char *source,
+ Elm_Widget_Item_Signal_Cb func,
+ void *data)
+{
+ ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
+ EINA_SAFETY_ON_NULL_RETURN(func);
+
+ Elm_Widget_Item_Signal_Data *wisd;
+
+ wisd = malloc(sizeof(Elm_Widget_Item_Signal_Data));
+ if (!wisd) return;
+
+ wisd->item = item;
+ wisd->func = func;
+ wisd->data = data;
+ wisd->emission = eina_stringshare_add(emission);
+ wisd->source = eina_stringshare_add(source);
+
+ if (_elm_widget_is(item->view))
+ elm_object_signal_callback_add(item->view, emission, source, _elm_widget_item_signal_cb, wisd);
+ else if (!strcmp(eo_class_name_get(eo_class_get(item->view)), "edje"))
+ edje_object_signal_callback_add(item->view, emission, source, _elm_widget_item_signal_cb, wisd);
+ else
+ {
+ WRN("The %s widget item doesn't support signal callback add!",
+ eo_class_name_get(eo_class_get(item->widget)));
+ free(wisd);
+ return;
+ }
+
+ item->signals = eina_list_append(item->signals, wisd);
+}
+
+EAPI void *
+_elm_widget_item_signal_callback_del(Elm_Widget_Item *item,
+ const char *emission,
+ const char *source,
+ Elm_Widget_Item_Signal_Cb func)
+{
+ ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, NULL);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(func, NULL);
+
+ Elm_Widget_Item_Signal_Data *wisd;
+ Eina_List *l;
+ void *data = NULL;
+
+ EINA_LIST_FOREACH(item->signals, l, wisd)
+ {
+ if ((wisd->func == func) && !strcmp(wisd->emission, emission) &&
+ !strcmp(wisd->source, source))
+ {
+ item->signals = eina_list_remove_list(item->signals, l);
+ eina_stringshare_del(wisd->emission);
+ eina_stringshare_del(wisd->source);
+ data = wisd->data;
+
+ if (_elm_widget_is(item->view))
+ elm_object_signal_callback_del(item->view, emission, source,
+ _elm_widget_item_signal_cb);
+ else if (!strcmp(eo_class_name_get(eo_class_get(item->view)),
+ "edje"))
+ edje_object_signal_callback_del_full(item->view, emission,
+ source,
+ _elm_widget_item_signal_cb,
+ data);
+ }
+ }
+
+ return data;
+}
+
EAPI void
_elm_widget_item_access_info_set(Elm_Widget_Item *item,
const char *txt)
/**< base structure for all widget items that are not Elm_Widget themselves */
typedef struct _Elm_Widget_Item Elm_Widget_Item;
+typedef struct _Elm_Widget_Item_Signal_Data Elm_Widget_Item_Signal_Data;
/**< accessibility information to be able to set and get from the access API */
typedef struct _Elm_Access_Info Elm_Access_Info;
typedef void (*Elm_Widget_Signal_Emit_Cb)(void *data, const char *emission, const char *source);
typedef void (*Elm_Widget_Disable_Cb)(void *data);
typedef Eina_Bool (*Elm_Widget_Del_Pre_Cb)(void *data);
+typedef void (*Elm_Widget_Item_Signal_Cb)(void *data, Elm_Widget_Item *item, const char *emission, const char *source);
#define ELM_ACCESS_DONE -1 /* sentence done - send done event here */
#define ELM_ACCESS_CANCEL -2 /* stop reading immediately */
/**< put this as the first member in your widget item struct */
#define ELM_WIDGET_ITEM Elm_Widget_Item base
+struct _Elm_Widget_Item_Signal_Data
+{
+ Elm_Widget_Item *item;
+ Elm_Widget_Item_Signal_Cb func;
+ const char *emission;
+ const char *source;
+ void *data;
+};
+
struct _Elm_Widget_Item
{
/* ef1 ~~ efl, el3 ~~ elm */
const char *access_info;
Eina_List *access_order;
Eina_List *translate_strings;
+ Eina_List *signals;
Eina_Bool disabled : 1;
};
EAPI Evas_Object *_elm_widget_item_part_content_unset(Elm_Widget_Item *item, const char *part);
EAPI void _elm_widget_item_part_text_set(Elm_Widget_Item *item, const char *part, const char *label);
EAPI const char *_elm_widget_item_part_text_get(const Elm_Widget_Item *item, const char *part);
+
+EAPI void _elm_widget_item_signal_callback_add(Elm_Widget_Item *item, const char *emission, const char *source, Elm_Widget_Item_Signal_Cb func, void *data);
+EAPI void *_elm_widget_item_signal_callback_del(Elm_Widget_Item *it, const char *emission, const char *source, Elm_Widget_Item_Signal_Cb func);
EAPI void _elm_widget_item_signal_emit(Elm_Widget_Item *item, const char *emission, const char *source);
EAPI void _elm_widget_item_content_set_hook_set(Elm_Widget_Item *item, Elm_Widget_Content_Set_Cb func);
EAPI void _elm_widget_item_content_get_hook_set(Elm_Widget_Item *item, Elm_Widget_Content_Get_Cb func);