Enlightenment CVS committal

Author  : dj2
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_tree2.c 


Log Message:
- display a sorting arrow in the header of the tree.
  - these seems to cause a slight sizing issue with the rows in the tree as
    they get shifted left the width of the sort arrow.

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_tree2.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- ewl_tree2.c 20 Aug 2006 21:09:05 -0000      1.26
+++ ewl_tree2.c 20 Aug 2006 23:32:34 -0000      1.27
@@ -530,9 +530,7 @@
 ewl_tree2_cb_column_sort(Ewl_Widget *w, void *ev __UNUSED__, void *data)
 {
        Ewl_Tree2_Column *c, *col;
-       Ewl_Widget *child;
-       char *theme_str;
-       int index = 0, count = 0;
+       int index = 0;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("data", data);
@@ -546,29 +544,17 @@
                DRETURN(DLEVEL_STABLE);
        }
 
-       /* need to loop over the headers and reset the state */
-       theme_str = "default";
-       ewl_container_child_iterate_begin(EWL_CONTAINER(c->parent->header));
-       while ((child = 
ewl_container_child_next(EWL_CONTAINER(c->parent->header))))
-       {
-               /* don't bother signaling the clicked header as we'll do
-                * that later anyway */
-               if (child == w) 
-               {
-                       index = count;
-                       continue;
-               }
-
-               ewl_widget_state_set(child, theme_str, EWL_STATE_TRANSIENT);
-               count ++;
-       }
-
        /* loop over the columns and reset the sort settings */
        ecore_list_goto_first(c->parent->columns);
        while ((col = ecore_list_next(c->parent->columns)))
        {
                /* skip the current column */
-               if (col == c) continue;
+               if (col == c)
+               {
+                       /* we're the index before the one we're now on */
+                       index = ecore_list_index(c->parent->columns) - 1;
+                       continue;
+               }
 
                col->sort = EWL_SORT_DIRECTION_NONE;
        }
@@ -578,15 +564,6 @@
        c->sort = ((c->sort + 1) % EWL_SORT_DIRECTION_MAX);
        if (!c->sort) c->sort ++;
 
-       /* pick the theme setting for the sort direction and set on the
-        * header */
-       if (c->sort == EWL_SORT_DIRECTION_ASCENDING)
-               theme_str = "ascending";
-       else if (c->sort == EWL_SORT_DIRECTION_DESCENDING)
-               theme_str = "descending";
-
-       ewl_widget_state_set(w, theme_str, EWL_STATE_TRANSIENT);
-
        c->model->sort(c->parent->data, index, c->sort);
 
        /* force the tree to redraw */
@@ -612,20 +589,47 @@
        while ((col = ecore_list_next(tree->columns)))
        {
                int r;
-               Ewl_Widget *h;
+               char *theme_str;
+               Ewl_Widget *h, *c;
 
-               h = col->view->header_fetch(tree->data, column);
-               ewl_object_fill_policy_set(EWL_OBJECT(h), 
-                               EWL_FLAG_FILL_HSHRINK | EWL_FLAG_FILL_HFILL);
+               h = ewl_hbox_new();
                ewl_container_child_append(EWL_CONTAINER(tree->header), h);
+               ewl_widget_appearance_set(h, "header");
+               ewl_widget_show(h);
 
                if (col->model->sort)
                        ewl_callback_append(h, EWL_CALLBACK_CLICKED, 
                                                ewl_tree2_cb_column_sort, col);
-               column ++;
+
+               c = col->view->header_fetch(tree->data, column);
+               ewl_object_fill_policy_set(EWL_OBJECT(c), 
+                               EWL_FLAG_FILL_HSHRINK | EWL_FLAG_FILL_HFILL);
+               ewl_container_child_append(EWL_CONTAINER(h), c);
+
+               /* display the sort arrow if needed */
+               if (col->model->sort)
+               {
+                       c = ewl_button_new();
+                       ewl_container_child_append(EWL_CONTAINER(h), c);
+
+                       if (col->sort == EWL_SORT_DIRECTION_ASCENDING)
+                               theme_str = "ascending";
+                       else if (col->sort == EWL_SORT_DIRECTION_DESCENDING)
+                               theme_str = "descending";
+                       else
+                               theme_str = "blank";
+
+                       ewl_widget_appearance_set(c, theme_str);
+                       ewl_widget_internal_set(c, TRUE);
+                       ewl_object_fill_policy_set(EWL_OBJECT(c), 
EWL_FLAG_FILL_SHRINK);
+                       ewl_object_alignment_set(EWL_OBJECT(c), 
EWL_FLAG_ALIGN_RIGHT);
+                       ewl_widget_show(c);
+               }
 
                r = col->model->count(tree->data);
                if (r > rows) rows = r;
+
+               column ++;
        }
 
        ewl_container_reset(EWL_CONTAINER(tree->rows));



-------------------------------------------------------------------------
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
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to