Enlightenment CVS committal

Author  : moom
Project : e17
Module  : libs/etk

Dir     : e17/libs/etk/src/lib


Modified Files:
        etk_tree.c etk_tree.h 


Log Message:
* [Tree] Implement etk_tree_row_get_at_xy()


===================================================================
RCS file: /cvs/e/e17/libs/etk/src/lib/etk_tree.c,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -3 -r1.96 -r1.97
--- etk_tree.c  10 Apr 2007 22:42:32 -0000      1.96
+++ etk_tree.c  11 Apr 2007 09:47:28 -0000      1.97
@@ -1681,6 +1681,34 @@
 }
 
 /**
+ * @brief Gets the row that is at the absolute position ( @a x, @a y )
+ * @param tree a tree
+ * @param x the x component of the position, relative to the canvas' top-left 
corner
+ * @param y the y component of the position, relative to the canvas' top-left 
corner
+ * @return Returns the row of the tree that is at the given position, or NULL 
if there is no row here
+ */
+Etk_Tree_Row  *etk_tree_row_get_at_xy(Etk_Tree *tree, int x, int y)
+{
+   Etk_Tree_Row *row;
+   int gx, gy, gw, gh;
+   int row_num, i;
+   
+   if (!tree)
+      return NULL;
+   
+   etk_widget_inner_geometry_get(tree->grid, &gx, &gy, &gw, &gh);
+   if (!ETK_INSIDE(x, y, gx, gy, gw, gh))
+      return NULL;
+   
+   y = y - gy + tree->scroll_y;
+   row_num = y / tree->rows_height;
+   for (i = 0, row = etk_tree_first_row_get(tree); i < row_num && row; i++)
+      row = etk_tree_row_walk_next(row, ETK_FALSE);
+   
+   return row;
+}
+
+/**
  * @brief Gets the scrolled view of the tree.
  * It can be used to change the scrollbars' policy, or to get the scroll-value
  * @param tree a tree
===================================================================
RCS file: /cvs/e/e17/libs/etk/src/lib/etk_tree.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -3 -r1.34 -r1.35
--- etk_tree.h  10 Apr 2007 22:42:32 -0000      1.34
+++ etk_tree.h  11 Apr 2007 09:47:28 -0000      1.35
@@ -241,6 +241,8 @@
 Etk_Tree_Row  *etk_tree_row_walk_next(Etk_Tree_Row *row, Etk_Bool 
include_folded);
 Etk_Tree      *etk_tree_row_tree_get(Etk_Tree_Row *row);
 
+Etk_Tree_Row  *etk_tree_row_get_at_xy(Etk_Tree *tree, int x, int y);
+
 Etk_Scrolled_View *etk_tree_scrolled_view_get(Etk_Tree *tree);
 void           etk_tree_row_scroll_to(Etk_Tree_Row *row, Etk_Bool center);
 



-------------------------------------------------------------------------
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