From: hermet Date: Thu, 17 Nov 2011 01:58:03 +0000 (+0000) Subject: elementray - +2 APIs X-Git-Tag: REL_F_I9500_20111128_2~78 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bd89d64b2ccfcf682f0e7b0de5d020ae09a9ca63;p=framework%2Fuifw%2Felementary.git elementray - +2 APIs elm_object_item_disabled_set/get git-svn-id: https://svn.enlightenment.org/svn/e/trunk/elementary@65324 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in index 5b4ef9b..1cb1117 100644 --- a/src/lib/Elementary.h.in +++ b/src/lib/Elementary.h.in @@ -1153,6 +1153,16 @@ extern "C" { #define elm_object_content_unset(obj) elm_object_part_content_unset((obj), NULL) /** + * Set the text to read out when in accessibility mode + * + * @param obj The object which is to be described + * @param txt The text that describes the widget to people with poor or no vision + * + * @ingroup General + */ + EAPI void elm_object_access_info_set(Evas_Object *obj, const char *txt); + + /** * Get the widget object's handle which contains a given item * * @param item The Elementary object item @@ -1262,16 +1272,6 @@ extern "C" { /** * Set the text to read out when in accessibility mode * - * @param obj The object which is to be described - * @param txt The text that describes the widget to people with poor or no vision - * - * @ingroup General - */ - EAPI void elm_object_access_info_set(Evas_Object *obj, const char *txt); - - /** - * Set the text to read out when in accessibility mode - * * @param it The object item which is to be described * @param txt The text that describes the widget to people with poor or no vision * @@ -1309,7 +1309,40 @@ extern "C" { * @param source The signal's source. * @ingroup General */ - EAPI void elm_object_item_signal_emit(Elm_Object_Item *it, const char *emission, const char *source) EINA_ARG_NONNULL(1); + EAPI void elm_object_item_signal_emit(Elm_Object_Item *it, const char *emission, const char *source) EINA_ARG_NONNULL(1); + + /** + * Set the disabled state of an widget item. + * + * @param obj The Elementary object item + * @param disabled The state to put in in: @c EINA_TRUE for + * disabled, @c EINA_FALSE for enabled + * + * Elementary object item can be @b disabled, in which state they won't + * receive input and, in general, will be themed differently from + * their normal state, usually greyed out. Useful for contexts + * where you don't want your users to interact with some of the + * parts of you interface. + * + * This sets the state for the widget item, either disabling it or + * enabling it back. + * + * @ingroup Styles + */ + EAPI void elm_object_item_disabled_set(Elm_Object_Item *it, Eina_Bool disabled) EINA_ARG_NONNULL(1); + + /** + * Get the disabled state of an widget item. + * + * @param obj The Elementary object + * @return @c EINA_TRUE, if the widget item is disabled, @c EINA_FALSE + * if it's enabled (or on errors) + * + * This gets the state of the widget, which might be enabled or disabled. + * + * @ingroup Styles + */ + EAPI Eina_Bool elm_object_item_disabled_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1); /** * @} diff --git a/src/lib/elm_main.c b/src/lib/elm_main.c index d7acc84..c7df1a4 100644 --- a/src/lib/elm_main.c +++ b/src/lib/elm_main.c @@ -2261,3 +2261,13 @@ elm_object_item_access_info_set(Elm_Object_Item *it, const char *txt) _elm_widget_item_access_info_set((Elm_Widget_Item *)it, txt); } +EAPI void elm_object_item_disabled_set(Elm_Object_Item *it, Eina_Bool disabled) +{ + _elm_widget_item_disabled_set((Elm_Widget_Item *) it, disabled); +} + +EAPI Eina_Bool elm_object_item_disabled_get(const Elm_Object_Item *it) +{ + return _elm_widget_item_disabled_get((Elm_Widget_Item *) it); +} + diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c index 74e9f70..a11644a 100644 --- a/src/lib/elm_widget.c +++ b/src/lib/elm_widget.c @@ -2831,6 +2831,31 @@ _elm_widget_item_data_get(const Elm_Widget_Item *item) return (void *)item->data; } +EAPI void +_elm_widget_item_disabled_set(Elm_Widget_Item *item, Eina_Bool disabled) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + + if (item->disabled == disabled) return; + item->disabled = !!disabled; + if (item->disable_func) item->disable_func(item); +} + +EAPI Eina_Bool +_elm_widget_item_disabled_get(const Elm_Widget_Item *item) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, EINA_FALSE); + return item->disabled; +} + +EAPI void +_elm_widget_item_disable_set_hook_set(Elm_Widget_Item *item, + Elm_Widget_On_Disable_Set_Cb func) +{ + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + item->disable_func = func; +} + typedef struct _Elm_Widget_Item_Tooltip Elm_Widget_Item_Tooltip; struct _Elm_Widget_Item_Tooltip diff --git a/src/lib/elm_widget.h b/src/lib/elm_widget.h index 18cd9ec..d0354d3 100644 --- a/src/lib/elm_widget.h +++ b/src/lib/elm_widget.h @@ -201,6 +201,8 @@ typedef const char *(*Elm_Widget_On_Text_Get_Cb)(const void *data, const char *p typedef Evas_Object *(*Elm_Widget_On_Content_Get_Cb)(const void *data, const char *part); 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); +typedef void (*Elm_Widget_On_Disable_Set_Cb)(void *data); + #define ELM_ACCESS_TYPE 0 // when reading out widget or item this is read first #define ELM_ACCESS_INFO 1 // next read is info - this is normally label @@ -260,8 +262,10 @@ struct _Elm_Widget_Item Elm_Widget_On_Text_Set_Cb on_text_set_func; Elm_Widget_On_Text_Get_Cb on_text_get_func; Elm_Widget_On_Signal_Emit_Cb on_signal_emit_func; + Elm_Widget_On_Disable_Set_Cb disable_func; Elm_Access_Info *access; const char *access_info; + Eina_Bool disabled: 1; /* widget variations should have data from here and on */ /* @todo: TODO check if this is enough for 1.0 release, maybe add padding! */ }; @@ -454,6 +458,9 @@ EAPI void _elm_widget_item_text_set_hook_set(Elm_Widget_Item *item, EAPI void _elm_widget_item_text_get_hook_set(Elm_Widget_Item *item, Elm_Widget_On_Text_Get_Cb func); EAPI void _elm_widget_item_signal_emit_hook_set(Elm_Widget_Item *it, Elm_Widget_On_Signal_Emit_Cb func); EAPI void _elm_widget_item_access_info_set(Elm_Widget_Item *item, const char *txt); +EAPI void _elm_widget_item_disabled_set(Elm_Widget_Item *item, Eina_Bool disabled); +EAPI Eina_Bool _elm_widget_item_disabled_get(const Elm_Widget_Item *item); +EAPI void _elm_widget_item_disable_set_hook_set(Elm_Widget_Item *item, Elm_Widget_On_Disable_Set_Cb func); /* debug function. don't use it unless you are tracking parenting issues */ @@ -658,7 +665,21 @@ 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) +/** + * Convenience function to query disable get hook. + * @see _elm_widget_item_disabled_get() + */ +#define elm_widget_item_disabled_get(item) \ + _elm_widget_item_disabled_get((Elm_Widget_Item *)item) +EAPI Eina_Bool _elm_widget_item_disabled_get(const Elm_Widget_Item *item); + +/** + * Convenience function to query disable set hook. + * @see _elm_widget_item_disable_set_hook_set() + */ +#define elm_widget_item_disable_set_hook_set(item, func) \ + _elm_widget_item_disable_set_hook_set((Elm_Widget_Item *) item, (Elm_Widget_On_Disable_Set_Cb)func) #define ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, ...) \ do { \