Enlightenment CVS committal Author : dj2 Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/bin Modified Files: ewl_combo_test.c 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/bin/ewl_combo_test.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- ewl_combo_test.c 28 May 2005 20:32:49 -0000 1.2 +++ ewl_combo_test.c 21 Jun 2005 02:15:51 -0000 1.3 @@ -16,18 +16,22 @@ __combo_value_changed(Ewl_Widget *w __UNUSED__, void *ev_data, void *user_data __UNUSED__) { + Ewl_Widget *entry; char *text; - - text = ev_data; + + entry = EWL_WIDGET(ev_data); + text = ewl_menu_item_text_get(EWL_MENU_ITEM(entry)); + printf("value changed to %s\n", text); -} + + if (!strcmp(text, "button")) + { + char *t2; + t2 = ewl_widget_data_get(entry, "dummy"); + printf("with data: %s\n", t2); + } -static void -__combo_configure(Ewl_Widget *w, void *ev_data __UNUSED__, - void *user_data __UNUSED__) -{ - printf("Combo configured to (%d, %d) %dx%d\n", CURRENT_X(w), - CURRENT_Y(w), CURRENT_W(w), CURRENT_H(w)); + IF_FREE(text); } void @@ -69,8 +73,6 @@ */ combo1 = ewl_combo_new("test menu"); ewl_container_child_append(EWL_CONTAINER(combo_box), combo1); - ewl_callback_append(combo1, EWL_CALLBACK_CONFIGURE, - __combo_configure, NULL); ewl_callback_append(combo1, EWL_CALLBACK_VALUE_CHANGED, __combo_value_changed, NULL); ewl_widget_show(combo1); @@ -91,6 +93,7 @@ ewl_widget_show(item); item = ewl_menu_item_new(NULL, "button"); + ewl_widget_data_set(item, "dummy", "data"); ewl_container_child_append(EWL_CONTAINER(combo1), item); ewl_widget_show(item); } ------------------------------------------------------- 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