Enlightenment CVS committal Author : pfritz Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: ewl_paned.c ewl_paned.h Log Message: add ewl_paned_fixed_size_set() =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_paned.c,v retrieving revision 1.62 retrieving revision 1.63 diff -u -3 -r1.62 -r1.63 --- ewl_paned.c 18 Dec 2007 22:24:20 -0000 1.62 +++ ewl_paned.c 26 Dec 2007 16:31:58 -0000 1.63 @@ -223,6 +223,7 @@ info = ewl_paned_size_info_add(p, child); info->initial_size = size; + info->initial_size_has = TRUE; DLEAVE_FUNCTION(DLEVEL_STABLE); } @@ -244,13 +245,57 @@ DCHECK_TYPE_RET(p, EWL_PANED_TYPE, 0); info = ewl_paned_size_info_get(p, child); - if (!info) + if (!info || !info->initial_size_has) DRETURN_INT(0, DLEVEL_STABLE); DRETURN_INT(info->initial_size, DLEVEL_STABLE); } /** + * @param p: The paned to work with + * @param child: The child widget to set the fixed size flag + * @param fixed: the fixed size flag + * @return Returns no value. + * @brief Set the given widget to resize only by the grabber + */ +void +ewl_paned_fixed_size_set(Ewl_Paned *p, Ewl_Widget *child, unsigned int fixed) +{ + Ewl_Paned_Size_Info *info; + + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR(p); + DCHECK_TYPE(p, EWL_PANED_TYPE); + + info = ewl_paned_size_info_add(p, child); + info->fixed = !!fixed; + + DLEAVE_FUNCTION(DLEVEL_STABLE); +} + +/** + * @param p: The paned to work with + * @param child: The child widget to get the fixed size flag + * @return Returns if the pane is set to keep its size while resizing + * @brief Retrieves if the pane is set to keep its size while resizing + */ +unsigned int +ewl_paned_fixed_size_get(Ewl_Paned *p, Ewl_Widget *child) +{ + Ewl_Paned_Size_Info *info; + + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR_RET(p, 0); + DCHECK_TYPE_RET(p, EWL_PANED_TYPE, 0); + + info = ewl_paned_size_info_get(p, child); + if (!info) + DRETURN_INT(FALSE, DLEVEL_STABLE); + + DRETURN_INT(info->fixed, DLEVEL_STABLE); +} + +/** * @internal * @param c: The container to work with * @param w: The widget to work with @@ -353,19 +398,19 @@ if (EWL_ORIENTATION_HORIZONTAL == EWL_PANED(c)->orientation) { - if (!info) - cw += ww; - else + if (info && info->initial_size_has) cw += info->initial_size; + else + cw += ww; if (wh > ch) ch = wh; } else { - if (!info) - ch += wh; - else + if (info && info->initial_size_has) ch += info->initial_size; + else + ch += wh; if (ww > cw) cw = ww; } @@ -401,17 +446,17 @@ if (EWL_ORIENTATION_HORIZONTAL == EWL_PANED(c)->orientation) { - if (!info) - cw -= ww; - else + if (info && info->initial_size_has) cw -= info->initial_size; + else + cw -= ww; } else { - if (!info) - ch -= wh; - else + if (info && info->initial_size_has) ch -= info->initial_size; + else + ch -= wh; } ewl_object_preferred_inner_size_set(EWL_OBJECT(c), cw, ch); @@ -591,16 +636,16 @@ panes->info = ewl_paned_size_info_get(p, child); panes->pane = child; - if (!panes->info) + if (panes->info && panes->info->initial_size_has) { - panes->size = layout->minimum_size(EWL_OBJECT(child)); - (*resizable)++; - panes->fixed = FALSE; + panes->size = panes->info->initial_size; + panes->fixed = TRUE; } else { - panes->size = panes->info->initial_size; - panes->fixed = TRUE; + panes->size = layout->minimum_size(EWL_OBJECT(child)); + (*resizable)++; + panes->fixed = FALSE; } available += panes->size; @@ -643,10 +688,17 @@ { panes[i].pane = child; panes[i].info = ewl_paned_size_info_get(p, child); + if (panes[i].info && panes[i].info->fixed) + panes[i].fixed = TRUE; + else + { + panes[i].fixed = FALSE; + (*resizable)++; + } + continue; } - panes[i].fixed = FALSE; pos = layout->current_position(EWL_OBJECT(child)); panes[i].size = pos - prev_pos; available += panes[i].size; @@ -655,11 +707,8 @@ } /* only the last position is not set because we have no grabber * at the end */ - panes[i].fixed = FALSE; panes[i].size = p->last_size - (prev_pos - p->last_pos); available += panes[i].size; - - *resizable = i + 1; DRETURN_INT(available, DLEVEL_STABLE); } =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_paned.h,v retrieving revision 1.33 retrieving revision 1.34 diff -u -3 -r1.33 -r1.34 --- ewl_paned.h 11 Nov 2007 06:07:46 -0000 1.33 +++ ewl_paned.h 26 Dec 2007 16:31:59 -0000 1.34 @@ -37,6 +37,8 @@ { Ewl_Widget *child; int initial_size; + unsigned char initial_size_has:1; + unsigned char fixed:1; }; /** @@ -89,6 +91,10 @@ void ewl_paned_initial_size_set(Ewl_Paned *p, Ewl_Widget *child, int size); 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); /* * Internal functions. Override at your risk. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs