1 /* ************************************************************************
3 qooxdoo - the new era of web development
8 2004-2007 1&1 Internet AG, Germany, http://www.1and1.org
11 LGPL: http://www.gnu.org/licenses/lgpl.html
12 EPL: http://www.eclipse.org/org/documents/epl-v10.php
13 See the LICENSE file in the project's top-level directory for details.
16 * Sebastian Werner (wpbasti)
17 * Andreas Ecker (ecker)
19 ************************************************************************ */
21 /* ************************************************************************
25 ************************************************************************ */
27 qx.OO.defineClass("qx.renderer.layout.MenuButtonLayoutImpl", qx.renderer.layout.HorizontalBoxLayoutImpl,
30 qx.renderer.layout.HorizontalBoxLayoutImpl.call(this, vWidget);
32 // We don't need flex support, should make things a bit faster,
33 // as this omits some additional loops in qx.renderer.layout.HorizontalBoxLayoutImpl.
34 this.setEnableFlexSupport(false);
40 [01] COMPUTE BOX DIMENSIONS FOR AN INDIVIDUAL CHILD
41 [02] COMPUTE NEEDED DIMENSIONS FOR AN INDIVIDUAL CHILD
42 [03] COMPUTE NEEDED DIMENSIONS FOR ALL CHILDREN
43 [04] UPDATE LAYOUT WHEN A CHILD CHANGES ITS OUTER DIMENSIONS
44 [05] UPDATE CHILD ON INNER DIMENSION CHANGES OF LAYOUT
45 [06] UPDATE LAYOUT ON JOB QUEUE FLUSH
46 [07] UPDATE CHILDREN ON JOB QUEUE FLUSH
47 [08] CHILDREN ADD/REMOVE/MOVE HANDLING
48 [09] FLUSH LAYOUT QUEUES OF CHILDREN
53 Inherits from qx.renderer.layout.HorizontalBoxLayoutImpl:
54 [01] COMPUTE BOX DIMENSIONS FOR AN INDIVIDUAL CHILD
55 [02] COMPUTE NEEDED DIMENSIONS FOR AN INDIVIDUAL CHILD
56 [05] UPDATE CHILD ON INNER DIMENSION CHANGES OF LAYOUT
57 [06] UPDATE LAYOUT ON JOB QUEUE FLUSH
58 [07] UPDATE CHILDREN ON JOB QUEUE FLUSH
59 [08] CHILDREN ADD/REMOVE/MOVE HANDLING
60 [09] FLUSH LAYOUT QUEUES OF CHILDREN
69 ---------------------------------------------------------------------------
70 [03] COMPUTE NEEDED DIMENSIONS FOR ALL CHILDREN
71 ---------------------------------------------------------------------------
75 Compute and return the width needed by all children of this widget
77 qx.Proto.computeChildrenNeededWidth = function()
79 // Caching the widget reference
80 var vWidget = this.getWidget();
82 // Ignore the verticalBoxLayout inside qx.ui.menu.Menu
83 var vMenu = vWidget.getParent().getParent();
85 // Let the menu do the real hard things
86 return vMenu.getMenuButtonNeededWidth();
96 ---------------------------------------------------------------------------
97 [04] UPDATE LAYOUT WHEN A CHILD CHANGES ITS OUTER DIMENSIONS
98 ---------------------------------------------------------------------------
102 Things to do and layout when any of the childs changes its outer width.
103 Needed by layouts where the children depends on each-other, like flow- or box-layouts.
105 qx.Proto.updateSelfOnChildOuterWidthChange = function(vChild)
107 // Caching the widget reference
108 var vWidget = this.getWidget();
110 // Ignore the verticalBoxLayout inside qx.ui.menu.Menu
111 var vMenu = vWidget.getParent().getParent();
113 // Send out invalidate signals
116 case vWidget._iconObject:
117 vMenu._invalidateMaxIconWidth();
120 case vWidget._labelObject:
121 vMenu._invalidateMaxLabelWidth();
124 case vWidget._shortcutObject:
125 vMenu._invalidateMaxShortcutWidth();
128 case vWidget._arrowObject:
129 vMenu._invalidateMaxArrowWidth();
133 // Call superclass implementation
134 return qx.renderer.layout.HorizontalBoxLayoutImpl.prototype.updateSelfOnChildOuterWidthChange.call(this, vChild);
144 ---------------------------------------------------------------------------
146 ---------------------------------------------------------------------------
149 qx.Proto.layoutChild_locationX = function(vChild, vJobs)
151 // Caching the widget reference
152 var vWidget = this.getWidget();
154 // Ignore the verticalBoxLayout inside qx.ui.menu.Menu
155 var vMenu = vWidget.getParent().getParent();
157 // Left position of the child
160 // Ask the menu instance for the correct location
163 case vWidget._iconObject:
164 vPos = vMenu.getIconPosition();
167 case vWidget._labelObject:
168 vPos = vMenu.getLabelPosition();
171 case vWidget._shortcutObject:
172 vPos = vMenu.getShortcutPosition();
175 case vWidget._arrowObject:
176 vPos = vMenu.getArrowPosition();
182 vPos += vWidget.getPaddingLeft();
183 vChild._applyRuntimeLeft(vPos);