Enlightenment CVS committal

Author  : moom
Project : e17
Module  : libs/etk

Dir     : e17/libs/etk/src/lib


Modified Files:
        etk_tree2.c 


Log Message:
* [Tree2] Clip the expanders against the first visible column


===================================================================
RCS file: /cvs/e/e17/libs/etk/src/lib/etk_tree2.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- etk_tree2.c 5 Jan 2007 20:25:25 -0000       1.11
+++ etk_tree2.c 5 Jan 2007 22:11:59 -0000       1.12
@@ -134,6 +134,7 @@
 static Etk_Tree2_Row *_etk_tree2_row_next_to_render_get(Etk_Tree2_Row *row, 
int *depth);
 static Etk_Tree2_Row_Object *_etk_tree2_row_object_create(Etk_Tree2 *tree);
 static void _etk_tree2_row_object_destroy(Etk_Tree2 *tree, 
Etk_Tree2_Row_Object *row_object);
+static void _etk_tree2_expanders_clip(Etk_Tree2 *tree);
 
 static void _etk_tree2_row_select(Etk_Tree2 *tree, Etk_Tree2_Row *row, 
Etk_Modifiers modifiers);
 
@@ -738,6 +739,7 @@
    
    if (col->tree)
    {
+      _etk_tree2_expanders_clip(col->tree);
       etk_signal_emit_by_name("scroll_size_changed", 
ETK_OBJECT(col->tree->scroll_content), NULL);
       etk_widget_redraw_queue(ETK_WIDGET(col->tree));
    }
@@ -793,6 +795,8 @@
    }
    col->position = position;
    etk_object_notify(ETK_OBJECT(col), "place");
+   
+   _etk_tree2_expanders_clip(col->tree);
    etk_widget_redraw_queue(ETK_WIDGET(col->tree));
 }
 
@@ -3040,7 +3044,7 @@
 static Etk_Tree2_Row_Object *_etk_tree2_row_object_create(Etk_Tree2 *tree)
 {
    Etk_Tree2_Row_Object *row_object;
-   Etk_Tree2_Col *col;
+   Etk_Tree2_Col *col, *first_visible_col;
    Evas *evas;
    int i, j, k;
    
@@ -3066,8 +3070,21 @@
    {
       row_object->expander = edje_object_add(evas);
       etk_theme_edje_object_set_from_parent(row_object->expander, "expander", 
ETK_WIDGET(tree));
-      /* TODO: the expander should be clipped to the clip of the first visible 
col */
-      evas_object_clip_set(row_object->expander, tree->grid_clip);
+      
+      /* Clip it to the first visible row */
+      first_visible_col = NULL;
+      for (i = 0; i < tree->num_cols; i++)
+      {
+         col = tree->columns[i];
+         if (col->visible)
+         {
+            if (!first_visible_col || first_visible_col->position > 
col->position)
+               first_visible_col = col;
+         }
+      }
+      if (first_visible_col)
+         evas_object_clip_set(row_object->expander, first_visible_col->clip);
+      
       etk_widget_member_object_add(tree->grid, row_object->expander);
       evas_object_event_callback_add(row_object->expander, 
EVAS_CALLBACK_MOUSE_UP,
          _etk_tree2_row_expander_mouse_up_cb, row_object);
@@ -3123,6 +3140,40 @@
    evas_object_del(row_object->expander);
    evas_object_del(row_object->background);
    free(row_object);
+}
+
+/* Clips all the expanders against the clip object of the first visible column 
*/
+static void _etk_tree2_expanders_clip(Etk_Tree2 *tree)
+{
+   Etk_Tree2_Row_Object *row_object;
+   Etk_Tree2_Col *col, *first_visible_col;
+   Evas_List *l;
+   int i;
+   
+   if (!tree || tree->mode != ETK_TREE2_MODE_TREE || !tree->built)
+      return;
+   
+   /* Clip it to the first visible row */
+   first_visible_col = NULL;
+   for (i = 0; i < tree->num_cols; i++)
+   {
+      col = tree->columns[i];
+      if (col->visible)
+      {
+         if (!first_visible_col || first_visible_col->position > col->position)
+            first_visible_col = col;
+      }
+   }
+   
+   if (!first_visible_col)
+      return;
+   
+   for (l = tree->row_objects; l; l = l->next)
+   {
+      row_object = l->data;
+      if (row_object->expander)
+         evas_object_clip_set(row_object->expander, first_visible_col->clip);
+   }
 }
 
 /* Selects/Unselects the corresponding rows according to the modifiers */



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to