Enlightenment CVS committal Author : dj2 Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: ewl_combo.c ewl_combo.h ewl_label.c ewl_label.h ewl_widget.h Log Message: - cleanup the combo widget a bit. this has API BREAKAGE as I changed what _selected_get/set deals with. They now takes the menu item and returns the menu item that is selected, instead of the name. (So this changes the VALUE_CHANGE callback also.) Look at the ewl_combo_test for an example. - add some comments to the label widget =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_combo.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- ewl_combo.c 28 Mar 2005 07:04:27 -0000 1.3 +++ ewl_combo.c 21 Jun 2005 02:15:51 -0000 1.4 @@ -7,15 +7,17 @@ * @return Returns a pointer to a new combo on success, NULL on failure. * @brief Create a new internal combo */ -Ewl_Widget *ewl_combo_new(char *title) +Ewl_Widget * +ewl_combo_new(char *title) { - Ewl_Combo *combo; + Ewl_Combo *combo; DENTER_FUNCTION(DLEVEL_STABLE); combo = NEW(Ewl_Combo, 1); - if (!combo) + if (!combo) { DRETURN_PTR(NULL, DLEVEL_STABLE); + } ewl_combo_init(combo, title); @@ -28,12 +30,12 @@ * @return Returns no value. * @brief Initialize an internal combo to starting values */ -void ewl_combo_init(Ewl_Combo * combo, char *title) +void +ewl_combo_init(Ewl_Combo * combo, char *title) { Ewl_Container *redirect; DENTER_FUNCTION(DLEVEL_STABLE); - DCHECK_PARAM_PTR("combo", combo); /* @@ -116,21 +118,20 @@ /** * @param combo: the combo to set the selected item of - * @param item: the string to be set as selected + * @param item: the entry to be set selected * @return Returns no value * @brief Set the currently selected item */ -void ewl_combo_selected_set(Ewl_Combo * combo, char *item ) +void +ewl_combo_selected_set(Ewl_Combo *combo, Ewl_Widget *item) { DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR("combo", combo); + DCHECK_PARAM_PTR("item", item); - if (combo->selected) { - ewl_entry_text_set(EWL_ENTRY(combo->selected), item); - ewl_callback_call_with_event_data(EWL_WIDGET(combo), - EWL_CALLBACK_VALUE_CHANGED, - item); - } - + combo->selected = item; + ewl_callback_call_with_event_data(EWL_WIDGET(combo), + EWL_CALLBACK_VALUE_CHANGED, item); DLEAVE_FUNCTION(DLEVEL_STABLE); } @@ -139,34 +140,27 @@ * @return Returns the currently selected item (possibly NULL) * @brief Gets the currently selected item */ -char *ewl_combo_selected_get(Ewl_Combo * combo ) +Ewl_Widget * +ewl_combo_selected_get(Ewl_Combo * combo) { - char *val = NULL; - DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR_RET("combo", combo, NULL); - if( combo->selected ) - val = ewl_entry_text_get( EWL_ENTRY(combo->selected) ); - - DRETURN_PTR(val, DLEVEL_STABLE); + DRETURN_PTR(combo->selected, DLEVEL_STABLE); } -void ewl_combo_item_select_cb(Ewl_Widget *w, void *ev_data __UNUSED__, - void *user_data) +void +ewl_combo_item_select_cb(Ewl_Widget *w, void *ev_data __UNUSED__, + void *user_data) { - char *item; Ewl_Combo *combo; - Ewl_Menu_Base *menu; DENTER_FUNCTION(DLEVEL_STABLE); combo = EWL_COMBO(user_data); - menu = EWL_MENU_BASE(user_data); - - item = ewl_text_text_get(EWL_TEXT(EWL_MENU_ITEM(w)->text)); - ewl_combo_selected_set(combo, item); - ewl_widget_hide(menu->popup); + ewl_combo_selected_set(combo, w); + ewl_widget_hide(EWL_MENU_BASE(combo)->popup); ewl_widget_appearance_set(combo->button, "button_decrement"); ewl_callback_del(EWL_MENU_BASE(combo)->popbox, EWL_CALLBACK_FOCUS_OUT, @@ -179,8 +173,9 @@ DLEAVE_FUNCTION(DLEVEL_STABLE); } -void ewl_combo_configure_cb(Ewl_Widget *w, void *ev_data __UNUSED__, - void *user_data __UNUSED__) +void +ewl_combo_configure_cb(Ewl_Widget *w, void *ev_data __UNUSED__, + void *user_data __UNUSED__) { Ewl_Combo *combo; @@ -202,8 +197,9 @@ DLEAVE_FUNCTION(DLEVEL_STABLE); } -void ewl_combo_value_changed_cb(Ewl_Widget *w __UNUSED__, - void *ev_data __UNUSED__, void *user_data) +void +ewl_combo_value_changed_cb(Ewl_Widget *w __UNUSED__, + void *ev_data __UNUSED__, void *user_data) { Ewl_Widget *cw; Ewl_Combo *combo; @@ -213,13 +209,14 @@ cw = EWL_WIDGET(user_data); combo = EWL_COMBO(user_data); - ewl_callback_call_with_event_data(cw, EWL_CALLBACK_VALUE_CHANGED, - ewl_entry_text_get(EWL_ENTRY(combo->selected))); + ewl_callback_call_with_event_data(cw, EWL_CALLBACK_VALUE_CHANGED, + combo->selected); DLEAVE_FUNCTION(DLEVEL_STABLE); } -void ewl_combo_expand_cb(Ewl_Widget * w, void *ev_data, void *user_data) +void +ewl_combo_expand_cb(Ewl_Widget * w, void *ev_data, void *user_data) { Ewl_Combo *combo; Ewl_Embed *emb; @@ -229,9 +226,7 @@ DENTER_FUNCTION(DLEVEL_STABLE); combo = EWL_COMBO(user_data); - ewl_widget_appearance_set(combo->button, "button_increment"); - ewl_menu_base_expand_cb(EWL_WIDGET(combo), ev_data, NULL); if (!REALIZED(combo->base.popup)) { @@ -265,18 +260,16 @@ DLEAVE_FUNCTION(DLEVEL_STABLE); } -void ewl_combo_collapse_cb(Ewl_Widget *w __UNUSED__, - void *ev_data __UNUSED__, void *user_data) +void +ewl_combo_collapse_cb(Ewl_Widget *w __UNUSED__, + void *ev_data __UNUSED__, void *user_data) { - Ewl_Menu_Base *menu; - Ewl_Combo *combo; + Ewl_Combo *combo; DENTER_FUNCTION(DLEVEL_STABLE); - menu = EWL_MENU_BASE(user_data); combo = EWL_COMBO(user_data); - - ewl_widget_hide(menu->popup); + ewl_widget_hide(EWL_MENU_BASE(combo)->popup); ewl_widget_appearance_set(combo->button, "button_decrement"); ewl_callback_del(EWL_MENU_BASE(combo)->popbox, EWL_CALLBACK_FOCUS_OUT, @@ -288,3 +281,4 @@ DLEAVE_FUNCTION(DLEVEL_STABLE); } + =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_combo.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- ewl_combo.h 17 Feb 2005 19:14:54 -0000 1.3 +++ ewl_combo.h 21 Jun 2005 02:15:51 -0000 1.4 @@ -41,8 +41,8 @@ Ewl_Widget *ewl_combo_new(char *title); void ewl_combo_init(Ewl_Combo * combo, char *title); -char *ewl_combo_selected_get(Ewl_Combo * combo ); -void ewl_combo_selected_set(Ewl_Combo * combo, char *item ); +Ewl_Widget *ewl_combo_selected_get(Ewl_Combo * combo); +void ewl_combo_selected_set(Ewl_Combo * combo, Ewl_Widget *item); /* * Internally used callbacks, override at your own risk. =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_label.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- ewl_label.c 16 Jun 2005 02:10:56 -0000 1.2 +++ ewl_label.c 21 Jun 2005 02:15:51 -0000 1.3 @@ -4,6 +4,11 @@ static void ewl_label_apply(Ewl_Label *la); +/** + * @param text: The text to set into the label + * @return Returns a new Ewl_Widget if successful, NULL on failure + * @brief Creates a new Ewl_Label widget with the @a text text in it + */ Ewl_Widget * ewl_label_new(char *text) { @@ -23,6 +28,12 @@ DRETURN_PTR(EWL_WIDGET(label), DLEVEL_STABLE); } +/** + * @param la: The Ewl_Label to initialize + * @param text: The text to initialize into the widget + * @return Returns TRUE on success, FALSE on falure + * @brief Initializes the @a la widget + */ int ewl_label_init(Ewl_Label *la, char *text) { @@ -44,6 +55,12 @@ DRETURN_INT(1, DLEVEL_STABLE); } +/** + * @param la: The Ewl_Widget to set the text on + * @param text: The text to set into the widget + * @return Returns no value + * @brief Sets the given @a text into the widget @a la + */ void ewl_label_text_set(Ewl_Label *la, char *text) { @@ -59,6 +76,11 @@ DLEAVE_FUNCTION(DLEVEL_STABLE); } +/** + * @param la: The Ewl_Label to get the text from + * @return Returns no value. + * @brief Gets the current text set into the label + */ char * ewl_label_text_get(Ewl_Label *la) { =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_label.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- ewl_label.h 15 Jun 2005 20:17:43 -0000 1.1 +++ ewl_label.h 21 Jun 2005 02:15:51 -0000 1.2 @@ -27,8 +27,8 @@ */ struct Ewl_Label { - Ewl_Widget widget; - char * text; + Ewl_Widget widget; /**< Inherit from Ewl_Widget */ + char * text; /**< The text set into the widget */ }; Ewl_Widget *ewl_label_new(char *text); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_widget.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- ewl_widget.h 20 Jun 2005 20:35:03 -0000 1.6 +++ ewl_widget.h 21 Jun 2005 02:15:51 -0000 1.7 @@ -65,7 +65,7 @@ char *inheritance; /**< Key to lookup inhertiance of widget */ int layer; /**< Current layer of widget on canvas */ - Ewl_Color_Set color; + Ewl_Color_Set color; /**< The colour of the widget */ Ecore_Hash *theme; /**< Overriding theme settings of this widget */ Ecore_Hash *data; /**< Arbitrary data attached to this widget */ ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs