Enlightenment CVS committal

Author  : dj2
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_tree.c ewl_tree.h 


Log Message:
- make the label align horizontally
- add a call to set the visiblity of the header in the tree

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_tree.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- ewl_tree.c  28 Mar 2005 07:04:29 -0000      1.5
+++ ewl_tree.c  22 Jun 2005 19:40:31 -0000      1.6
@@ -78,7 +78,8 @@
                                EWL_FLAG_FILL_HSHRINK |
                                EWL_FLAG_FILL_HFILL);
                ewl_container_child_append(EWL_CONTAINER(row), button);
-               ewl_widget_show(button);
+
+               ewl_widget_show(button);
        }
 
        tree->header = row;
@@ -94,6 +95,8 @@
        ewl_container_redirect_set(EWL_CONTAINER(tree),
                                   EWL_CONTAINER(tree->scrollarea));
 
+       ewl_tree_headers_visible_set(tree, 1);
+
        DRETURN_INT(TRUE, DLEVEL_STABLE);
 }
 
@@ -123,6 +126,44 @@
        button = ecore_list_next(EWL_CONTAINER(row)->children);
        for (i = 0; i < tree->ncols && button; i++) {
                ewl_button_label_set(EWL_BUTTON(button), headers[i]);
+
+               if (!tree->headers_visible && VISIBLE(button))
+                       ewl_widget_hide(button);
+               else if (tree->headers_visible && HIDDEN(button))
+                       ewl_widget_show(button);
+
+               button = ecore_list_next(EWL_CONTAINER(row)->children);
+       }
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param tree: The tree to set the header visibleity
+ * @param visible: The visiblity to set
+ * @return Returns no value.
+ * @brief Sets the visiblity of the headers in the tree
+ */
+void
+ewl_tree_headers_visible_set(Ewl_Tree *tree, unsigned int visible)
+{
+       unsigned short i;
+       Ewl_Widget *button;
+       Ewl_Widget *row;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("tree", tree);
+
+       tree->headers_visible = visible;
+
+       row = ecore_list_goto_first(EWL_CONTAINER(tree)->children);
+       ecore_list_goto_first(EWL_CONTAINER(row)->children);
+
+       button = ecore_list_next(EWL_CONTAINER(row)->children);
+       for (i = 0; i < tree->ncols && button; i++) {
+               if ((visible) && (HIDDEN(button))) ewl_widget_show(button);
+               else if ((!visible) && (VISIBLE(button))) 
ewl_widget_hide(button);
+
                button = ecore_list_next(EWL_CONTAINER(row)->children);
        }
 
@@ -130,6 +171,20 @@
 }
 
 /**
+ * @param tree: The tree the get the header visiblity
+ * @return Returns the header visibliity of the tree
+ * @brief Gets the header visibility of the tree
+ */
+unsigned int
+ewl_tree_headers_visible_get(Ewl_Tree *tree)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR_RET("tree", tree, 0);
+
+       DRETURN_INT(tree->headers_visible, DLEVEL_STABLE);
+}
+
+/**
  * @param tree: the tree to hold the widgets
  * @param prow: the parent row of the new row for the added widgets
  * @param children: a NULL terminated array of widgets to add to the tree
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_tree.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- ewl_tree.h  28 Mar 2005 07:04:29 -0000      1.4
+++ ewl_tree.h  22 Jun 2005 19:40:31 -0000      1.5
@@ -46,6 +46,7 @@
        Ewl_Widget    *scrollarea; /**< Scrollable area of rows */
        Ecore_List    *selected;   /**< The currently selected rows */
        Ewl_Tree_Mode  mode;       /**< Mode for selecting rows */
+       unsigned int   headers_visible; /**< Are the headers visible */
 };
 
 typedef struct _ewl_tree_node Ewl_Tree_Node;
@@ -90,6 +91,10 @@
 void            ewl_tree_headers_set(Ewl_Tree *tree, char **headers);
 void            ewl_tree_columns_set(Ewl_Tree *tree, unsigned short columns);
 
+void           ewl_tree_headers_visible_set(Ewl_Tree *tree, unsigned int 
visible);
+unsigned int   ewl_tree_headers_visible_get(Ewl_Tree *tree);
+
+
 Ecore_List     *ewl_tree_selected_get(Ewl_Tree *tree);
 void            ewl_tree_selected_clear(Ewl_Tree *tree);
 




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

Reply via email to