Revision: 1892 http://svn.sourceforge.net/vexi/?rev=1892&view=rev Author: clrg Date: 2007-06-28 11:17:44 -0700 (Thu, 28 Jun 2007)
Log Message: ----------- Work on tidying up menu to work with Vexi3 Modified Paths: -------------- widgets/trunk/org.vexi.widgets/src/org/vexi/lib/img/border.t widgets/trunk/org.vexi.widgets/src/org/vexi/lib/widget/menu.t widgets/trunk/org.vexi.widgets/src/org/vexi/theme/win2k/menu.t Modified: widgets/trunk/org.vexi.widgets/src/org/vexi/lib/img/border.t =================================================================== --- widgets/trunk/org.vexi.widgets/src/org/vexi/lib/img/border.t 2007-06-28 17:52:52 UTC (rev 1891) +++ widgets/trunk/org.vexi.widgets/src/org/vexi/lib/img/border.t 2007-06-28 18:17:44 UTC (rev 1892) @@ -15,32 +15,30 @@ // left column <ui:box orient="vertical" hshrink="true"> - <ui:box id="nw" shrink="true" /> - <ui:box id="ww" hshrink="true" /> - <ui:box id="sw" shrink="true" /> + <ui:box id="nw" shrink="true"><ui:box shrink="true" /></ui:box> + <ui:box id="ww" hshrink="true"><ui:box hshrink="true" /></ui:box> + <ui:box id="sw" shrink="true"><ui:box shrink="true" /></ui:box> </ui:box> // central column <ui:box orient="vertical"> - <ui:box id="nn" vshrink="true" /> + <ui:box id="nn" vshrink="true"><ui:box vshrink="true" /></ui:box> <ui:box id="content" /> - <ui:box id="ss" vshrink="true" /> + <ui:box id="ss" vshrink="true"><ui:box vshrink="true" /></ui:box> </ui:box> // right column <ui:box orient="vertical" hshrink="true"> - <ui:box id="ne" shrink="true" /> - <ui:box id="ee" hshrink="true" /> - <ui:box id="se" shrink="true" /> + <ui:box id="ne" shrink="true"><ui:box shrink="true" /></ui:box> + <ui:box id="ee" hshrink="true"><ui:box hshrink="true" /></ui:box> + <ui:box id="se" shrink="true"><ui:box shrink="true" /></ui:box> </ui:box> vexi..vexi.util.redirect..addRedirect(thisbox, $content, "layout", "orient"); thisbox.border = null; - thisbox.depth = null; + thisbox.depth = 0; - var canSetDepth = true; - /* sets the border according to value v where v is a colour or stream */ border ++= function(v) { @@ -55,25 +53,23 @@ $sw.fill = null; $ss.fill = null; $se.fill = null; - canSetDepth = true; } // border image else if (typeof(v) == "object") { - try { $nw.fill = v.nw; } catch (e) {}; - try { $nn.fill = v.nn; } catch (e) {}; - try { $ne.fill = v.ne; } catch (e) {}; - try { $ww.fill = v.ww; } catch (e) {}; - try { $ee.fill = v.ee; } catch (e) {}; - try { $sw.fill = v.sw; } catch (e) {}; - try { $ss.fill = v.ss; } catch (e) {}; - try { $se.fill = v.se; } catch (e) {}; - canSetDepth = false; - - $nn.minwidth = 0; - $ss.minwidth = 0; - $ww.minheight = 0; - $ee.minheight = 0; + try { $nw[0].fill = v.nw; } catch (e) {}; + try { $nn[0].fill = v.nn; } catch (e) {}; + try { $ne[0].fill = v.ne; } catch (e) {}; + try { $ww[0].fill = v.ww; } catch (e) {}; + try { $ee[0].fill = v.ee; } catch (e) {}; + try { $sw[0].fill = v.sw; } catch (e) {}; + try { $ss[0].fill = v.ss; } catch (e) {}; + try { $se[0].fill = v.se; } catch (e) {}; + + $nn[0].minwidth = 0; + $ss[0].minwidth = 0; + $ww[0].minheight = 0; + $ee[0].minheight = 0; } // border string else @@ -86,7 +82,6 @@ $sw.fill = v; $ss.fill = v; $se.fill = v; - canSetDepth = true; } cascade = v; } @@ -94,26 +89,27 @@ /** set the depth of this border */ depth ++= function(v) { - if (canSetDepth) - { - $nw.minwidth = v; - $nw.minheight = v; - $ne.minwidth = v; - $ne.minheight = v; - $sw.minwidth = v; - $sw.minheight = v; - $se.minwidth = v; - $se.minheight = v; - - $nn.minwidth = 0; - $nn.minheight = v; - $ss.minwidth = 0; - $ss.minheight = v; - $ww.minwidth = v; - $ww.minheight = 0; - $ee.minwidth = v; - $ee.minheight = 0; - } + if (typeof(v) != "number") + throw "Property 'depth' must be a number"; + + $nw.minwidth = v; + $nw.minheight = v; + $ne.minwidth = v; + $ne.minheight = v; + $sw.minwidth = v; + $sw.minheight = v; + $se.minwidth = v; + $se.minheight = v; + + $nn.minwidth = 0; + $nn.minheight = v; + $ss.minwidth = 0; + $ss.minheight = v; + $ww.minwidth = v; + $ww.minheight = 0; + $ee.minwidth = v; + $ee.minheight = 0; + cascade = v; } Modified: widgets/trunk/org.vexi.widgets/src/org/vexi/lib/widget/menu.t =================================================================== --- widgets/trunk/org.vexi.widgets/src/org/vexi/lib/widget/menu.t 2007-06-28 17:52:52 UTC (rev 1891) +++ widgets/trunk/org.vexi.widgets/src/org/vexi/lib/widget/menu.t 2007-06-28 18:17:44 UTC (rev 1892) @@ -13,14 +13,27 @@ thisbox.th_content; thisbox.th_list; + var lockChildren = false; + /** th_content write trap */ th_content ++= function(v) { - v.ChildAdded ++= function(c) + v.Children ++= function(c) { + // if locked, spoof put from th_list is in action + if (lockChildren) return; + // otherwise redirect child put to th_list + lockChildren = true; th_list[th_list.numchildren] = c; - cascade = c; + lockChildren = false; + // never complete the put + return; } + + v.Children ++= function() + { + return th_list[arguments.index]; + } } /** popdown menu when a menu item is fired */ @@ -29,13 +42,21 @@ /** th_list write trap */ th_list ++= function(v) { - v.ChildAdded ++= function(c) + v.Children ++= function(c) { + cascade = c; + if (c == null) return; if (itemgroup) c.group = itemgroup; else itemgroup = c.group; c.action ++= childActionFunc; - cascade = c; + // if locked, put has been redirected here from th_content + if (lockChildren) return; + // otherwise spoof the put back to th_content + lockChildren = true; + th_content[arguments.index] = c; + lockChildren = false; } + cascade = v; } Modified: widgets/trunk/org.vexi.widgets/src/org/vexi/theme/win2k/menu.t =================================================================== --- widgets/trunk/org.vexi.widgets/src/org/vexi/theme/win2k/menu.t 2007-06-28 17:52:52 UTC (rev 1891) +++ widgets/trunk/org.vexi.widgets/src/org/vexi/theme/win2k/menu.t 2007-06-28 18:17:44 UTC (rev 1892) @@ -7,9 +7,9 @@ <lib:menu /> <ui:box padding="4 6"> - <bevel id="bevel" packed="false" /> + <bevel id="bevel" depth="1" /> <bevel id="popbox" form="above" shrink="true"> - <ui:box id="content" cols="1" fill="#d4d0c8" /> + <ui:box id="content" orient="vertical" fill="#d4d0c8" /> </bevel> thisbox.th_bevel = $bevel; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Vexi-svn mailing list Vexi-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vexi-svn