Enlightenment CVS committal
Author : dj2
Project : e17
Module : libs/ewl
Dir : e17/libs/ewl/src/bin/tests/list
Modified Files:
ewl_list.c
Log Message:
- add mvc range selection rm
- add multiselect capabilities to ewl_list
- add single and multiselect capabilities to ewl_tree2, both row and cell based
- doxy fixes
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/bin/tests/list/ewl_list.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ewl_list.c 17 Oct 2006 05:37:33 -0000 1.2
+++ ewl_list.c 18 Oct 2006 16:28:07 -0000 1.3
@@ -22,11 +22,13 @@
static void *list_test_data_setup(void);
static void list_cb_value_changed(Ewl_Widget *w, void *ev, void *data);
+static void list_cb_multi_value_changed(Ewl_Widget *w, void *ev, void *data);
static void list_test_assign_set(Ewl_Widget *w, void *data);
static void *list_test_data_fetch(void *data, unsigned int row,
unsigned int column);
static int list_test_data_count_get(void *data);
+static void list_cb_select_none(Ewl_Widget *w, void *ev, void *data);
void
test_info(Ewl_Test *test)
@@ -52,7 +54,7 @@
/* create a list using an ecore_list of strings of labels */
o = ewl_border_new();
- ewl_border_text_set(EWL_BORDER(o), "Label List");
+ ewl_border_text_set(EWL_BORDER(o), "Label List (single select)");
ewl_container_child_append(EWL_CONTAINER(box), o);
ewl_widget_show(o);
@@ -75,6 +77,22 @@
list_cb_value_changed, NULL);
ewl_widget_show(list);
+ /* create a list using an ecore_list of strings of labels */
+ o = ewl_border_new();
+ ewl_border_text_set(EWL_BORDER(o), "Label List (multi select)");
+ ewl_container_child_append(EWL_CONTAINER(box), o);
+ ewl_widget_show(o);
+
+ list = ewl_list_new();
+ ewl_container_child_append(EWL_CONTAINER(o), list);
+ ewl_box_orientation_set(EWL_BOX(list), EWL_ORIENTATION_HORIZONTAL);
+ ewl_mvc_model_set(EWL_MVC(list), model);
+ ewl_mvc_view_set(EWL_MVC(list), view);
+ ewl_mvc_data_set(EWL_MVC(list), str_data);
+ ewl_mvc_selection_mode_set(EWL_MVC(list), EWL_SELECTION_MODE_MULTI);
+ ewl_callback_append(list, EWL_CALLBACK_VALUE_CHANGED,
+ list_cb_multi_value_changed, NULL);
+ ewl_widget_show(list);
/* Create a list from a custom array with a custom assign on the
* view */
@@ -98,6 +116,9 @@
ewl_mvc_model_set(EWL_MVC(list), model);
ewl_mvc_view_set(EWL_MVC(list), view);
ewl_mvc_data_set(EWL_MVC(list), data);
+ ewl_mvc_selection_mode_set(EWL_MVC(list), EWL_SELECTION_MODE_NONE);
+ ewl_callback_append(list, EWL_CALLBACK_VALUE_CHANGED,
+ list_cb_select_none, NULL);
ewl_widget_show(list);
@@ -110,6 +131,9 @@
list = ewl_list_new();
ewl_container_child_append(EWL_CONTAINER(o), list);
+ ewl_mvc_selection_mode_set(EWL_MVC(list), EWL_SELECTION_MODE_NONE);
+ ewl_callback_append(list, EWL_CALLBACK_VALUE_CHANGED,
+ list_cb_select_none, NULL);
ewl_widget_show(list);
for (i = 0; strs[i]; i++)
@@ -202,6 +226,51 @@
ecore_list_goto_index(el, idx->row);
printf("Selected (%s)\n", (char *)ecore_list_current(el));
+}
+
+static void
+list_cb_multi_value_changed(Ewl_Widget *w, void *ev, void *data)
+{
+ Ecore_List *selected, *el;
+ Ewl_Selection *sel;
+
+ printf("Selected:\n");
+
+ el = ewl_mvc_data_get(EWL_MVC(w));
+ selected = ewl_mvc_selected_list_get(EWL_MVC(w));
+
+ ecore_list_goto_first(selected);
+ while ((sel = ecore_list_next(selected)))
+ {
+ if (sel->type == EWL_SELECTION_TYPE_INDEX)
+ {
+ Ewl_Selection_Idx *idx;
+
+ idx = EWL_SELECTION_IDX(sel);
+ ecore_list_goto_index(el, idx->row);
+ printf(" %d (%s)\n", idx->row,
+ (char *)ecore_list_current(el));
+ }
+ else
+ {
+ Ewl_Selection_Range *idx;
+ int i;
+
+ idx = EWL_SELECTION_RANGE(sel);
+ for (i = idx->start.row; i <= idx->end.row; i++)
+ {
+ ecore_list_goto_index(el, i);
+ printf(" %d (%s)\n", i,
+ (char *)ecore_list_current(el));
+ }
+ }
+ }
+}
+
+static void
+list_cb_select_none(Ewl_Widget *w, void *ev, void *data)
+{
+ printf("ERROR, shouldn't get selection changed callbacks.\n");
}
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs