Enlightenment CVS committal Author : pfritz Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: ewl_paned.c ewl_paned.h ewl_tree.c ewl_tree.h Log Message: arrange columns correct if the header is not visible (bug 452) =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_paned.c,v retrieving revision 1.68 retrieving revision 1.69 diff -u -3 -r1.68 -r1.69 --- ewl_paned.c 21 Apr 2008 21:51:23 -0000 1.68 +++ ewl_paned.c 21 Apr 2008 22:41:38 -0000 1.69 @@ -515,18 +515,20 @@ } /** - * @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 @@ 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) @@ -584,6 +586,27 @@ p->last_size = used_size; p->last_pos = main_pos; + + DLEAVE_FUNCTION(DLEVEL_STABLE); +} + +/** + * @internal + * @param w: The widget to work with + * @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); } =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_paned.h,v retrieving revision 1.35 retrieving revision 1.36 diff -u -3 -r1.35 -r1.36 --- ewl_paned.h 21 Apr 2008 21:51:23 -0000 1.35 +++ ewl_paned.h 21 Apr 2008 22:41:38 -0000 1.36 @@ -95,6 +95,7 @@ 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. =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_tree.c,v retrieving revision 1.66 retrieving revision 1.67 diff -u -3 -r1.66 -r1.67 --- ewl_tree.c 20 Apr 2008 15:06:32 -0000 1.66 +++ ewl_tree.c 21 Apr 2008 22:41:38 -0000 1.67 @@ -145,7 +145,6 @@ DRETURN(DLEVEL_STABLE); tree->headers_visible = !!visible; - tree->headers_dirty = TRUE; if (!tree->headers_visible) ewl_widget_hide(tree->header); @@ -218,6 +217,8 @@ 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 @@ 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 @@ 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); @@ -746,29 +765,6 @@ DCHECK_TYPE(tree, EWL_TREE_TYPE); 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++) =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_tree.h,v retrieving revision 1.35 retrieving revision 1.36 diff -u -3 -r1.35 -r1.36 --- ewl_tree.h 20 Apr 2008 15:06:32 -0000 1.35 +++ ewl_tree.h 21 Apr 2008 22:41:38 -0000 1.36 @@ -118,7 +118,6 @@ 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 @@ 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); ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs