[Pkg-e-commits] [SCM] Enlightenment DR17 toolkit based (based on the EFL) branch, upstream-vcs, updated. 447de88121d145a078f1754a0cfebb704d363821

pfritz pfritz at alioth.debian.org
Sat Jun 7 18:34:13 UTC 2008


The following commit has been merged in the upstream-vcs branch:
commit 112dbe4cb67560cc909ee3a8cdc639c7335202cd
Author: pfritz <pfritz>
Date:   Mon Apr 21 22:41:38 2008 +0000

    arrange columns correct if the header is not visible (bug 452)

diff --git a/src/lib/ewl_paned.c b/src/lib/ewl_paned.c
index 70ae3d3..78016d8 100644
--- a/src/lib/ewl_paned.c
+++ b/src/lib/ewl_paned.c
@@ -515,18 +515,20 @@ ewl_paned_cb_child_hide(Ewl_Container *c, Ewl_Widget *w)
 }
 
 /**
- * @internal
- * @param w: The widget to work with
- * @param ev: UNUSED
- * @param data: UNUSED
+ * @param w: The paned to work with
  * @return Returns no value
- * @brief The configure callback
+ * @brief The arrange the child widgets
+ *
+ * This function is not to be intended to be used, if the widget is visible. Its
+ * purpose is to calculate the new position of the children even if the widget
+ * is hidden. This is useful if the paned serves as a size giver for a row,
+ * like in it is done in the tree widget. Use this function only if you know
+ * what you are doing.
  */
 void
-ewl_paned_cb_configure(Ewl_Widget *w, void *ev __UNUSED__,
-					void *data __UNUSED__)
+ewl_paned_arrange(Ewl_Paned *p)
 {
-	Ewl_Paned *p;
+	Ewl_Widget *w;
 	Ewl_Container *c;
 	Ewl_Paned_Pane_Info *panes;
 	int available, pane_num;
@@ -535,10 +537,10 @@ ewl_paned_cb_configure(Ewl_Widget *w, void *ev __UNUSED__,
 	int used_size;
 
 	DENTER_FUNCTION(DLEVEL_STABLE);
-	DCHECK_PARAM_PTR(w);
-	DCHECK_TYPE(w, EWL_PANED_TYPE);
+	DCHECK_PARAM_PTR(p);
+	DCHECK_TYPE(p, EWL_PANED_TYPE);
 
-	p = EWL_PANED(w);
+	w = EWL_WIDGET(p);
 	c = EWL_CONTAINER(p);
 
 	if (ewl_paned_orientation_get(p) == EWL_ORIENTATION_HORIZONTAL)
@@ -594,6 +596,27 @@ ewl_paned_cb_configure(Ewl_Widget *w, void *ev __UNUSED__,
  * @param ev: UNUSED
  * @param data: UNUSED
  * @return Returns no value
+ * @brief The configure callback
+ */
+void
+ewl_paned_cb_configure(Ewl_Widget *w, void *ev __UNUSED__,
+					void *data __UNUSED__)
+{
+	DENTER_FUNCTION(DLEVEL_STABLE);
+	DCHECK_PARAM_PTR(w);
+	DCHECK_TYPE(w, EWL_PANED_TYPE);
+
+	ewl_paned_arrange(EWL_PANED(w));
+
+	DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @internal
+ * @param w: The widget to work with
+ * @param ev: UNUSED
+ * @param data: UNUSED
+ * @return Returns no value
  * @brief The destroy callback
  */
 void
diff --git a/src/lib/ewl_paned.h b/src/lib/ewl_paned.h
index 11b2442..4641cef 100644
--- a/src/lib/ewl_paned.h
+++ b/src/lib/ewl_paned.h
@@ -95,6 +95,7 @@ int		 ewl_paned_initial_size_get(Ewl_Paned *p, Ewl_Widget *child);
 void		 ewl_paned_fixed_size_set(Ewl_Paned *p, Ewl_Widget *child,
 						unsigned int fixed);
 unsigned int	 ewl_paned_fixed_size_get(Ewl_Paned *p, Ewl_Widget *child);
+void		 ewl_paned_arrange(Ewl_Paned *p);
 
 /*
  * Internal functions. Override at your risk.
diff --git a/src/lib/ewl_tree.c b/src/lib/ewl_tree.c
index 82c77c4..e69a915 100644
--- a/src/lib/ewl_tree.c
+++ b/src/lib/ewl_tree.c
@@ -145,7 +145,6 @@ ewl_tree_headers_visible_set(Ewl_Tree *tree, unsigned char visible)
 		DRETURN(DLEVEL_STABLE);
 
 	tree->headers_visible = !!visible;
-	tree->headers_dirty = TRUE;
 
 	if (!tree->headers_visible)
 		ewl_widget_hide(tree->header);
@@ -218,6 +217,8 @@ ewl_tree_alternate_row_colors_get(Ewl_Tree *tree)
 void
 ewl_tree_column_count_set(Ewl_Tree *tree, unsigned int count)
 {
+	int i;
+
 	DENTER_FUNCTION(DLEVEL_STABLE);
 	DCHECK_PARAM_PTR(tree);
 	DCHECK_TYPE(tree, EWL_TREE_TYPE);
@@ -226,7 +227,16 @@ ewl_tree_column_count_set(Ewl_Tree *tree, unsigned int count)
 		DRETURN(DLEVEL_STABLE);
 	
 	tree->columns = count;
-	tree->headers_dirty = TRUE;
+	ewl_container_reset(EWL_CONTAINER(tree->header));
+
+	for (i = 0; i < tree->columns; i++) {
+		Ewl_Widget *h;
+
+		h = ewl_hbox_new();
+		ewl_container_child_append(EWL_CONTAINER(tree->header), h);
+		ewl_widget_appearance_set(h, "header");
+		ewl_widget_show(h);
+	}
 
 	DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -553,6 +563,15 @@ ewl_tree_cb_configure(Ewl_Widget *w, void *ev __UNUSED__,
 
 	tree = EWL_TREE(w);
 
+	if (!tree->headers_visible)
+	{
+		/* Since the header is invisible we need to tell it its
+		 * position and its size to arrange correctly */
+		ewl_object_x_request(EWL_OBJECT(tree->header), CURRENT_X(w));
+		ewl_object_w_request(EWL_OBJECT(tree->header), CURRENT_W(w));
+		ewl_paned_arrange(EWL_PANED(tree->header));
+	}
+
 	/* if the tree isn't dirty we're done */
 	if (!ewl_mvc_dirty_get(EWL_MVC(tree)))
 		DRETURN(DLEVEL_STABLE);
@@ -747,29 +766,6 @@ ewl_tree_headers_build(Ewl_Tree *tree, const Ewl_Model *model, void *mvc_data)
 
 	header = EWL_CONTAINER(tree->header);
 
-	/* if the header is not visible, reset it */
-	if (!tree->headers_visible)
-	{
-		ewl_container_reset(header);
-		DRETURN(DLEVEL_STABLE);
-	}
-
-	/* first check if the count of the columns has changed */
-	if (tree->headers_dirty)
-	{
-		ewl_container_reset(header);
-
-		for (i = 0; i < tree->columns; i++) {
-			Ewl_Widget *h;
-
-			h = ewl_hbox_new();
-			ewl_container_child_append(header, h);
-			ewl_widget_appearance_set(h, "header");
-			ewl_widget_show(h);
-		}
-		tree->headers_dirty = FALSE;
-	}
-
 	ewl_container_child_iterate_begin(header);
 	for (i = 0; i < tree->columns; i++)
 	{
diff --git a/src/lib/ewl_tree.h b/src/lib/ewl_tree.h
index a1696fe..c16a98b 100644
--- a/src/lib/ewl_tree.h
+++ b/src/lib/ewl_tree.h
@@ -118,7 +118,6 @@ struct Ewl_Tree
 	unsigned int columns;	/**< Number of columns in the tree */
 	unsigned char fixed:1;    /**< Rows are fixed height */
 	unsigned char headers_visible:1; /**< Are the headers visible? */
-	unsigned char headers_dirty:1; /**< Was the column count changed?*/
 	unsigned char row_color_alternate:1; /**< Are the rows alternating? */
 };
 
@@ -131,6 +130,14 @@ int 		 ewl_tree_init(Ewl_Tree *tree);
 void		 ewl_tree_column_count_set(Ewl_Tree *tree,
 						unsigned int count);
 unsigned int	 ewl_tree_column_count_get(Ewl_Tree *tree);
+void		 ewl_tree_column_fixed_size_set(Ewl_Tree *tree, 
+					unsigned int col, unsigned int fixed);
+unsigned int	 ewl_tree_column_fixed_size_get(Ewl_Tree *tree, 
+					unsigned int col);
+void		 ewl_tree_column_initial_size_set(Ewl_Tree *tree, 
+					unsigned int col, int size);
+int		 ewl_tree_column_initial_size_get(Ewl_Tree *tree, 
+					unsigned int col);
 
 void		 ewl_tree_headers_visible_set(Ewl_Tree *tree,
 					       unsigned char visible);

-- 
Enlightenment DR17 toolkit based (based on the EFL)



More information about the Pkg-e-commits mailing list