Enlightenment CVS committal Author : pfritz Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: ewl_radiobutton.c ewl_radiobutton.h Log Message: add ewl_radiobutton_chain_selected_get() =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_radiobutton.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -3 -r1.20 -r1.21 --- ewl_radiobutton.c 12 Nov 2007 22:42:22 -0000 1.20 +++ ewl_radiobutton.c 14 Nov 2007 20:00:51 -0000 1.21 @@ -62,6 +62,39 @@ DRETURN_INT(TRUE, DLEVEL_STABLE); } +/* + * @param rb: the radio button to set the value + * @param value: A user defined value. Ewl does't use this value at all. + * @return Returns no value. + * @brief Set an user defined value. + */ +void +ewl_radiobutton_value_set(Ewl_Radiobutton *rb, void *value) +{ + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR(rb); + DCHECK_TYPE(rb, EWL_RADIOBUTTON_TYPE); + + rb->value = value; + + DLEAVE_FUNCTION(DLEVEL_STABLE); +} + +/* + * @param rb: the radio button to get the value + * @return Returns the value of the radio button. + * @brief Get the user defined value. + */ +void * +ewl_radiobutton_value_get(Ewl_Radiobutton *rb) +{ + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR_RET(rb, 0); + DCHECK_TYPE_RET(rb, EWL_RADIOBUTTON_TYPE, 0); + + DRETURN_INT(rb->value, DLEVEL_STABLE); +} + /** * @param rb: the radio button to be added to a chain of radio buttons * @param crb: a radio button already in the chain of radio buttons @@ -97,6 +130,40 @@ rb->chain = crb->chain; DLEAVE_FUNCTION(DLEVEL_STABLE); +} + +/* + * @param rb: the radio button to get the checked chain link + * @return Returns the current checked chain link + * @brief XXX write me + */ +Ewl_Radiobutton * +ewl_radiobutton_chain_selected_get(Ewl_Radiobutton *rb) +{ + Ewl_Checkbutton *c; + + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR_RET(rb, NULL); + DCHECK_TYPE_RET(rb, EWL_RADIOBUTTON_TYPE, NULL); + + /* if there is no chain or the chain is empty we have to + * treat it special */ + if (!rb->chain || ecore_list_empty_is(rb->chain)) { + if (ewl_checkbutton_is_checked(EWL_CHECKBUTTON(rb))) { + DRETURN_PTR(rb, DLEVEL_STABLE); + } + else { + DRETURN_PTR(NULL, DLEVEL_STABLE); + } + } + + ecore_list_first_goto(rb->chain); + while ((c = ecore_list_next(rb->chain))) { + if (ewl_checkbutton_is_checked(c)) + DRETURN_PTR(c, DLEVEL_STABLE); + } + + DRETURN_PTR(NULL, DLEVEL_STABLE); } /** =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_radiobutton.h,v retrieving revision 1.17 retrieving revision 1.18 diff -u -3 -r1.17 -r1.18 --- ewl_radiobutton.h 11 Nov 2007 06:07:46 -0000 1.17 +++ ewl_radiobutton.h 14 Nov 2007 20:00:51 -0000 1.18 @@ -54,12 +54,17 @@ { Ewl_Checkbutton button; /**< Inherit from Ewl_Checkbutton */ Ecore_List *chain; /**< List of members of the group */ + void *value; /**< the value of the radio button */ }; Ewl_Widget *ewl_radiobutton_new(void); -int ewl_radiobutton_init(Ewl_Radiobutton *cb); +int ewl_radiobutton_init(Ewl_Radiobutton *rb); -void ewl_radiobutton_chain_set(Ewl_Radiobutton *w, Ewl_Radiobutton *c); +void ewl_radiobutton_value_set(Ewl_Radiobutton *rb, void *v); +void *ewl_radiobutton_value_get(Ewl_Radiobutton *rb); + +void ewl_radiobutton_chain_set(Ewl_Radiobutton *rb, Ewl_Radiobutton *crb); +Ewl_Radiobutton *ewl_radiobutton_chain_selected_get(Ewl_Radiobutton *rb); /** * @def ewl_radiobutton_checked_set(r, c) ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs