Enlightenment CVS committal Author : lok Project : e17 Module : proto
Dir : e17/proto/etk/src/lib Modified Files: etk_paned.c etk_paned.h Log Message: [Etk_Paned] position_set fixed, now it works also before that the widget is realized. child(1/2)_expand_(set/get) added. =================================================================== RCS file: /cvs/e/e17/proto/etk/src/lib/etk_paned.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- etk_paned.c 24 Aug 2006 18:09:16 -0000 1.11 +++ etk_paned.c 7 Sep 2006 20:25:08 -0000 1.12 @@ -220,6 +220,7 @@ else _etk_vpaned_position_calc(paned); + etk_widget_redraw_queue(ETK_WIDGET(paned)); if (prev_position != paned->position) etk_object_notify(ETK_OBJECT(paned), "position"); } @@ -237,6 +238,58 @@ return paned->position; } +/** + * @brief Sets whether the first child should expands. + * @param paned a paned + * @param expand ETK_TRUE whether the first child should be expandable + */ +void etk_paned_child1_expand_set(Etk_Paned *paned, Etk_Bool expand) +{ + if (!paned) + return; + + paned->expand1 = expand; +} + +/** + * @brief Sets whether the second child should expands. + * @param paned a paned + * @param expand ETK_TRUE whether the second child should be expandable + */ +void etk_paned_child2_expand_set(Etk_Paned *paned, Etk_Bool expand) +{ + if (!paned) + return; + + paned->expand2 = expand; +} + +/** + * @brief Gets whether the first child expands. + * @param paned a paned + * @return Returns ETK_TRUE if the first child is expandable + */ +Etk_Bool etk_paned_child1_expand_get(Etk_Paned *paned) +{ + if (!paned) + return ETK_FALSE; + + return paned->expand1; +} + +/** + * @brief Gets whether the second child expands. + * @param paned a paned + * @return Returns ETK_TRUE if the second child is expandable + */ +Etk_Bool etk_paned_child2_expand_get(Etk_Paned *paned) +{ + if (!paned) + return ETK_FALSE; + + return paned->expand2; +} + /************************** * * Etk specific functions @@ -374,13 +427,21 @@ Etk_Size separator_size; Etk_Geometry child_geometry; + if (paned->child1->geometry.w == -1 + && paned->child2->geometry.w == -1 + && paned->separator->geometry.w == -1 + && paned->position != 0) + return; + prev_size = paned->child1->geometry.w + paned->child2->geometry.w + paned->separator->geometry.w; - if (paned->expand1 == paned->expand2) - etk_paned_position_set(paned, paned->position + (geometry.w - prev_size) / 2); + if (prev_size <= 0 && paned->position != 0) + etk_paned_position_set(paned, paned->position); + else if (paned->expand1 == paned->expand2) + etk_paned_position_set(paned, paned->position + (geometry.w - prev_size) / 2); else if (paned->expand1 && !paned->expand2) - etk_paned_position_set(paned, geometry.w - (prev_size - paned->position)); + etk_paned_position_set(paned, geometry.w - (prev_size - paned->position)); else - etk_paned_position_set(paned, paned->position); + etk_paned_position_set(paned, paned->position); child_geometry.x = geometry.x; child_geometry.y = geometry.y; @@ -423,14 +484,22 @@ int prev_size; Etk_Size separator_size; Etk_Geometry child_geometry; + + if (paned->child1->geometry.h == -1 + && paned->child2->geometry.h == -1 + && paned->separator->geometry.h == -1 + && paned->position != 0) + return; prev_size = paned->child1->geometry.h + paned->child2->geometry.h + paned->separator->geometry.h; - if (paned->expand1 == paned->expand2) - etk_paned_position_set(paned, paned->position + (geometry.h - prev_size) / 2); + if (prev_size <= 0 && paned->position != 0) + etk_paned_position_set(paned, paned->position); + else if (paned->expand1 == paned->expand2) + etk_paned_position_set(paned, paned->position + (geometry.h - prev_size) / 2); else if (paned->expand1 && !paned->expand2) etk_paned_position_set(paned, geometry.h - (prev_size - paned->position)); else - etk_paned_position_set(paned, paned->position); + etk_paned_position_set(paned, paned->position); child_geometry.x = geometry.x; child_geometry.y = geometry.y; @@ -583,6 +652,9 @@ if (!paned) return; + if (paned->child1 && paned->child1->geometry.w == -1) + return; + geometry = ETK_WIDGET(paned)->geometry; if (paned->child1) etk_widget_size_request(paned->child1, &child1_size); @@ -618,6 +690,9 @@ int total_size; if (!paned) + return; + + if (paned->child1 && paned->child1->geometry.h == -1) return; geometry = ETK_WIDGET(paned)->geometry; =================================================================== RCS file: /cvs/e/e17/proto/etk/src/lib/etk_paned.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- etk_paned.h 15 Aug 2006 22:26:55 -0000 1.6 +++ etk_paned.h 7 Sep 2006 20:25:08 -0000 1.7 @@ -5,11 +5,6 @@ #include "etk_container.h" #include "etk_types.h" -/* TODO/FIXME list: - * - etk_paned_position_set() does not work if the paned is not realized - * - add the ability to change the expand setting - */ - /** * @defgroup Etk_Paned Etk_Paned * @brief The Etk_Paned widget is a container that can contain two children separated by a draggable separator @@ -96,6 +91,10 @@ void etk_paned_position_set(Etk_Paned *paned, int position); int etk_paned_position_get(Etk_Paned *paned); +void etk_paned_child1_expand_set(Etk_Paned *paned, Etk_Bool value); +void etk_paned_child2_expand_set(Etk_Paned *paned, Etk_Bool value); +Etk_Bool etk_paned_child1_expand_get(Etk_Paned *paned); +Etk_Bool etk_paned_child2_expand_get(Etk_Paned *paned); /** @} */ #endif ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs