Home | Trees | Indices | Help |
|
---|
|
1 # Copyright (C) 2012 Vaadin Ltd. 2 # Copyright (C) 2012 Richard Lincoln 3 # 4 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # you may not use this file except in compliance with the License. 6 # You may obtain a copy of the License at 7 # 8 # http://www.apache.org/licenses/LICENSE-2.0 9 # 10 # Unless required by applicable law or agreed to in writing, software 11 # distributed under the License is distributed on an "AS IS" BASIS, 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 16 """Defines a layout that will give one of it's components as much space as 17 possible, while still showing the other components in the layout.""" 18 19 from warnings import warn 20 21 from muntjac.ui.ordered_layout import OrderedLayout 22 2325 """A layout that will give one of it's components as much space as 26 possible, while still showing the other components in the layout. The 27 other components will in effect be given a fixed sized space, while the 28 space given to the expanded component will grow/shrink to fill the rest 29 of the space available - for instance when re-sizing the window. 30 31 Note that this layout is 100% in both directions by default 32 (L{setSizeFull}). Remember to set the units if you want to 33 specify a fixed size. If the layout fails to show up, check that the 34 parent layout is actually giving some space. 35 36 @deprecated: Deprecated in favor of the new OrderedLayout 37 """ 389540 warn('use OrderedLayout', DeprecationWarning) 41 42 self._expanded = None 43 44 if orientation is None: 45 self.ORIENTATION_VERTICAL 46 47 super(ExpandLayout, self).__init__(orientation) 48 self.setSizeFull()49 5052 """@param c: Component which container will be maximized 53 """ 54 if self._expanded is not None: 55 try: 56 self.setExpandRatio(self._expanded, 0.0) 57 except ValueError: 58 pass # Ignore error if component has been removed 59 60 self._expanded = c 61 if self._expanded is not None: 62 self.setExpandRatio(self._expanded, 1.0) 63 64 self.requestRepaint()65 6668 if index is None: 69 super(ExpandLayout, self).addComponent(c) 70 else: 71 super(ExpandLayout, self).addComponent(c, index) 72 if self._expanded is None: 73 self.expand(c)74 75 80 8183 super(ExpandLayout, self).removeComponent(c) 84 if c == self._expanded: 85 try: 86 self.expand(self.getComponentIterator().next()) 87 except StopIteration: 88 self.expand(None)89 9092 super(ExpandLayout, self).replaceComponent(oldComponent, newComponent) 93 if oldComponent == self._expanded: 94 self.expand(newComponent)
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sat Apr 20 16:01:46 2013 | http://epydoc.sourceforge.net |