commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r8500 - in trunk/gnue-forms/src: . GFObjects uidrivers/gtk2/widge


From: johannes
Subject: [gnue] r8500 - in trunk/gnue-forms/src: . GFObjects uidrivers/gtk2/widgets/form uidrivers/win32/widgets/form uidrivers/wx/widgets/form uidrivers/wx26 uidrivers/wx26/widgets
Date: Tue, 20 Jun 2006 04:42:00 -0500 (CDT)

Author: johannes
Date: 2006-06-20 04:41:58 -0500 (Tue, 20 Jun 2006)
New Revision: 8500

Added:
   trunk/gnue-forms/src/GFObjects/GFHBox.py
   trunk/gnue-forms/src/GFObjects/GFVBox.py
   trunk/gnue-forms/src/uidrivers/wx26/widgets/vbox.py
Modified:
   trunk/gnue-forms/src/GFInstance.py
   trunk/gnue-forms/src/GFObjects/GFLabel.py
   trunk/gnue-forms/src/GFObjects/GFLayout.py
   trunk/gnue-forms/src/GFObjects/GFPage.py
   trunk/gnue-forms/src/GFObjects/__init__.py
   trunk/gnue-forms/src/GFParser.py
   trunk/gnue-forms/src/uidrivers/gtk2/widgets/form/wrappers.py
   trunk/gnue-forms/src/uidrivers/win32/widgets/form/wrappers.py
   trunk/gnue-forms/src/uidrivers/wx/widgets/form/wrappers.py
   trunk/gnue-forms/src/uidrivers/wx26/UIdriver.py
   trunk/gnue-forms/src/uidrivers/wx26/__init__.py
   trunk/gnue-forms/src/uidrivers/wx26/widgets/_base.py
   trunk/gnue-forms/src/uidrivers/wx26/widgets/box.py
   trunk/gnue-forms/src/uidrivers/wx26/widgets/button.py
   trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py
   trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py
   trunk/gnue-forms/src/uidrivers/wx26/widgets/image.py
   trunk/gnue-forms/src/uidrivers/wx26/widgets/label.py
   trunk/gnue-forms/src/uidrivers/wx26/widgets/menu.py
   trunk/gnue-forms/src/uidrivers/wx26/widgets/page.py
   trunk/gnue-forms/src/uidrivers/wx26/widgets/scrollbar.py
Log:
GFBox could be used as container (at least for wx26 UI).
Changed concept of layout to completely using Sizers, so no tricky size 
calculations are needed for widgets anymore.

issue87 in-progress


Modified: trunk/gnue-forms/src/GFInstance.py
===================================================================
--- trunk/gnue-forms/src/GFInstance.py  2006-06-20 09:41:04 UTC (rev 8499)
+++ trunk/gnue-forms/src/GFInstance.py  2006-06-20 09:41:58 UTC (rev 8500)
@@ -328,8 +328,13 @@
     assert gDebug (4, "Initializing form objects")
 
     for formObject in self._formsDictionary.values ():
-      formObject.phaseInit ()
+        if getattr(self._uimodule, '__rearrange_boxes__', False):
+            for page in formObject.findChildrenOfType('GFPage', False, True):
+                page.rearrange_boxes()
 
+        formObject.phaseInit ()
+
+
     assert gDebug (4, "Initializing user interface driver object")
     self._uiinstance.initialize ()
 

Added: trunk/gnue-forms/src/GFObjects/GFHBox.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFHBox.py    2006-06-20 09:41:04 UTC (rev 
8499)
+++ trunk/gnue-forms/src/GFObjects/GFHBox.py    2006-06-20 09:41:58 UTC (rev 
8500)
@@ -0,0 +1,51 @@
+# GNU Enterprise Forms - GF Object Hierarchy - Box
+#
+# Copyright 2001-2006 Free Software Foundation
+#
+# This file is part of GNU Enterprise
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# $Id$
+"""
+Logical box support
+"""
+
+from GFContainer import GFContainer
+
+__all__ = ['GFHBox']
+
+# =============================================================================
+# <hbox>
+# =============================================================================
+
+class GFHBox(GFContainer):
+
+    # -------------------------------------------------------------------------
+    # Attributes
+    # -------------------------------------------------------------------------
+
+    label = None
+
+
+    # -------------------------------------------------------------------------
+    # Constructor
+    # -------------------------------------------------------------------------
+
+    def __init__(self, parent=None):
+        GFContainer.__init__(self, parent, "GFHBox")
+
+


Property changes on: trunk/gnue-forms/src/GFObjects/GFHBox.py
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: trunk/gnue-forms/src/GFObjects/GFLabel.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFLabel.py   2006-06-20 09:41:04 UTC (rev 
8499)
+++ trunk/gnue-forms/src/GFObjects/GFLabel.py   2006-06-20 09:41:58 UTC (rev 
8500)
@@ -59,6 +59,8 @@
 
         if not hasattr(self, 'Char__height'):
             self.Char__height = int(gConfigForms('widgetHeight'))
+        if not hasattr(self, 'Char__width'):
+            self.Char__width  = len(self.text)
 
         self._rows = getattr(self, 'rows', self._rows)
         self._gap  = getattr(self, 'rowSpacer', self._gap)

Modified: trunk/gnue-forms/src/GFObjects/GFLayout.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFLayout.py  2006-06-20 09:41:04 UTC (rev 
8499)
+++ trunk/gnue-forms/src/GFObjects/GFLayout.py  2006-06-20 09:41:58 UTC (rev 
8500)
@@ -19,21 +19,57 @@
 # write to the Free Software Foundation, Inc., 59 Temple Place
 # - Suite 330, Boston, MA 02111-1307, USA.
 #
+# pylint: disable-msg=W0704
+#
 # $Id$
 """
 Handles the <layout> tag.
 """
 
+from gnue.common.definitions import GParser
 from gnue.forms.GFObjects.GFObj import GFObj
 
+__all__ = ['GFLayout', 'LayoutConceptError']
 
 # =============================================================================
+# Exceptions
+# =============================================================================
+
+class LayoutConceptError(GParser.MarkupError):
+    """ Element not allowed in a managed/positioning layout """
+    def __init__(self, item, managed):
+        if managed and item._type == 'GFBox':
+            msg = u_("%(item)s '%(name)s' not allowed in a managed layout")\
+                     % {'item': item._type[2:], 'name': item.name}
+        elif managed:
+            msg = u_("%(item)s '%(name)s' uses positioning information in a "
+                     "managed layout") \
+                     % {'item': item._type[2:], 'name': item.name}
+        else:
+            msg = u_("%(item)s '%(name)s' not allowed in a positioned layout")\
+                     % {'item': item._type[2:], 'name': item.name}
+
+        GParser.MarkupError.__init__(self, msg, item._url, item._lineNumber)
+
+
+# =============================================================================
 # Class implementing the layout tag
 # =============================================================================
 
 class GFLayout(GFObj):
+    """
+    Implementation of the <layout> tag
+    """
 
     # -------------------------------------------------------------------------
+    # Attributes
+    # -------------------------------------------------------------------------
+
+    tabbed = 'none'
+    name   = 'layout'
+
+
+    # -------------------------------------------------------------------------
     # Constructor
     # -------------------------------------------------------------------------
 
@@ -41,9 +77,11 @@
 
         GFObj.__init__(self, parent, "GFLayout")
 
+        self.managed = False
+
         self._pageList = []
-        self.tabbed = 'none'
         self._triggerGlobal = 1
+        self._xmlchildnamespaces = {}
 
 
     # -------------------------------------------------------------------------
@@ -51,52 +89,78 @@
     # -------------------------------------------------------------------------
 
     def _buildObject(self):
+        """
+        Determine wether the layout is managed or not.  If there is a height or
+        width defined (in GNUe:Layout:Char namespace) the layout is treated as
+        a 'positioning' one, otherwise it is 'managed'.  In a managed layout,
+        none of the children must have an x, y, height or width attribute.  For
+        a positioned layout, all childrens x, y, height or width attributes are
+        converted to numbers.
+        """
 
-        # TODO: This is temporary until layout management support works
-        self.walk(self.__addxy)
+        if hasattr(self, 'Char__width') or hasattr(self, 'Char__height'):
+            self.managed = False
+        else:
+            self.managed = True
 
+        self.walk(self.__check_xy)
+
         return GFObj._buildObject(self)
 
 
     # -------------------------------------------------------------------------
 
-    def __addxy(self, object):
+    def __check_xy(self, gf_object):
 
-        for attr in ('x','y','height','width'):
+        for attr in ('x', 'y', 'height', 'width'):
             try:
-                v = int(object.__dict__['Char__%s' % attr])
-                object.__dict__['Char__%s' % attr] = v
-                object.__dict__['_Layout__%s' % attr] = v
+                val = int(gf_object.__dict__['Char__%s' % attr])
 
+                if self.managed:
+                    raise LayoutConceptError(gf_object, self.managed)
+
+                gf_object.__dict__['Char__%s' % attr] = val
+                gf_object.__dict__['_Layout__%s' % attr] = val
+
             except KeyError:
                 pass
 
+        if self.managed and gf_object._type in ['GFBox']:
+            raise LayoutConceptError(gf_object, self.managed)
 
+        elif not self.managed and gf_object._type in ['GFVBox', 'GFHBox']:
+            raise LayoutConceptError(gf_object, self.managed)
+
+
+
     # -------------------------------------------------------------------------
     # Implementation of virtual methods
     # -------------------------------------------------------------------------
 
     def _phase_1_init_(self):
+        """
+        Build a dictionary of all XML namespaces used by the layouts children
+        """
 
         GFObj._phase_1_init_(self)
-        self._xmlchildnamespaces = self.__findNamespaces(self)
+        self._xmlchildnamespaces = self.__find_namespaces(self)
 
 
     # -------------------------------------------------------------------------
     # Find the XML namespace in use by any child objects
     # -------------------------------------------------------------------------
 
-    def __findNamespaces(self, object):
+    def __find_namespaces(self, gf_object):
 
-        ns = {}
-        for child in object._children:
+        result = {}
+        for child in gf_object._children:
             try:
                 if child._xmlnamespaces:
-                    ns.update(list(child._xmlnamespaces))
+                    result.update(child._xmlnamespaces)
                 else:
-                    ns.update(self._findNamespace(child))
+                    result.update(self.__find_namespaces(child))
 
             except AttributeError:
                 pass
 
-        return ns
+        return result

Modified: trunk/gnue-forms/src/GFObjects/GFPage.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFPage.py    2006-06-20 09:41:04 UTC (rev 
8499)
+++ trunk/gnue-forms/src/GFObjects/GFPage.py    2006-06-20 09:41:58 UTC (rev 
8500)
@@ -26,13 +26,29 @@
 
 from gnue.forms.GFObjects.GFContainer import GFContainer
 
+__all__ = ['GFPage']
+
+
 # =============================================================================
 # Implementation of a logical page object
 # =============================================================================
 
 class GFPage(GFContainer):
+    """
+    Implementation of the <page> tag
+    """
 
     # -------------------------------------------------------------------------
+    # Attributes
+    # -------------------------------------------------------------------------
+
+    name = None
+    transparent = False
+    style = 'normal'
+    caption = None
+
+
+    # -------------------------------------------------------------------------
     # Constructor
     # -------------------------------------------------------------------------
 
@@ -47,6 +63,7 @@
             'POST-FOCUSIN' : 'Post-FocusIn',
         }
 
+        self._layout = None
         self._entryList = []
 
 
@@ -62,5 +79,47 @@
 
         GFContainer._phase_1_init_(self)
 
+        self._layout = self.findParentOfType('GFLayout')
+        self._layout._pageList.append(self)
+
+
+    # -------------------------------------------------------------------------
+    # Rearrange boxes
+    # -------------------------------------------------------------------------
+    
+    def rearrange_boxes(self):
+        """
+        Calculate the bounding boxes of all GFBox items per page and reparent
+        all children which fit into such a GFBox.  As a result all reparented
+        children will have their coordinates reset relative to their owning
+        box (starting with 0/0 as the top-left position).
+        """
+
         layout = self.findParentOfType('GFLayout')
-        layout._pageList.append(self)
+        boxes = []
+
+        if hasattr(layout, 'Char__width') or hasattr(layout, 'Char__height'):
+            for box in self.findChildrenOfType('GFBox', False, True):
+                (left, top, width, height) = (box.Char__x, box.Char__y,
+                                             box.Char__width, box.Char__height)
+                boxes.append((left, top, left+width-1, top+height-1, box))
+
+            boxes.sort()
+
+            for item in self._children[:]:
+                if not hasattr(item, 'Char__x'):
+                    continue
+
+                left, top = item.Char__x, item.Char__y
+                parent = self
+
+                for (bleft, btop, bright, bbottom, box) in boxes:
+                    if left > bleft and left < bright and \
+                            top > btop and top < bbottom:
+                        item.Char__x = left - bleft - 1
+                        item.Char__y = top - btop - 1
+
+                        parent._children.remove(item)
+                        box.addChild(item)
+                        item.setParent(box)
+                        parent = box

Added: trunk/gnue-forms/src/GFObjects/GFVBox.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFVBox.py    2006-06-20 09:41:04 UTC (rev 
8499)
+++ trunk/gnue-forms/src/GFObjects/GFVBox.py    2006-06-20 09:41:58 UTC (rev 
8500)
@@ -0,0 +1,50 @@
+# GNU Enterprise Forms - GF Object Hierarchy - Box
+#
+# Copyright 2001-2006 Free Software Foundation
+#
+# This file is part of GNU Enterprise
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# $Id$
+"""
+Logical box support
+"""
+
+from GFContainer import GFContainer
+
+__all__ = ['GFVBox']
+
+# =============================================================================
+# <vbox>
+# =============================================================================
+
+class GFVBox(GFContainer):
+
+    # -------------------------------------------------------------------------
+    # Attributes
+    # -------------------------------------------------------------------------
+
+    label = None
+
+
+    # -------------------------------------------------------------------------
+    # Constructor
+    # -------------------------------------------------------------------------
+
+    def __init__(self, parent=None):
+        GFContainer.__init__(self, parent, "GFVBox")
+        print "BUILT a VBOX!"


Property changes on: trunk/gnue-forms/src/GFObjects/GFVBox.py
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: trunk/gnue-forms/src/GFObjects/__init__.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/__init__.py  2006-06-20 09:41:04 UTC (rev 
8499)
+++ trunk/gnue-forms/src/GFObjects/__init__.py  2006-06-20 09:41:58 UTC (rev 
8500)
@@ -28,6 +28,8 @@
         "GFOption",
         "GFScrollBar",
         "GFBox",
+        "GFVBox",
+        "GFHBox",
         "GFOptions",
         "GFValue",
         "GFButton",

Modified: trunk/gnue-forms/src/GFParser.py
===================================================================
--- trunk/gnue-forms/src/GFParser.py    2006-06-20 09:41:04 UTC (rev 8499)
+++ trunk/gnue-forms/src/GFParser.py    2006-06-20 09:41:58 UTC (rev 8500)
@@ -337,7 +337,7 @@
                'Description': 'Overriders the rowSpace setting defined at the '
                               'block level.' } },
          'Positionable': True,
-         'ParentTags': ('page',),
+         'ParentTags': ('page','box','hbox','vbox'),
          'Description': 'Displays static text' },
 
       'field': {
@@ -594,7 +594,7 @@
                'Description': 'Defines how the field data will be formatted '
                               'for display.' } },
          'Positionable': True,
-         'ParentTags': ('page',),
+         'ParentTags': ('page','hbox','vbox','box'),
          'Description': 'An {entry} is the visual counterpart to a {field}, '
                         'it defines how the data in a field will be displayed '
                         'and how it can be edited.'},
@@ -616,10 +616,54 @@
                'References': 'block.name',
                'Description': 'The {block} to which this scrollbar scrolls.' } 
},
          'Positionable': True,
-         'ParentTags': ('page',),
+         'ParentTags': ('page','vbox','hbox','box'),
          'Description': 'A scrollbar is a visual element that lets the user '
                         'move vertically layout elements linked to it.' },
 
+      'vbox': {
+         'BaseClass': GFObjects.GFVBox,
+         'Attributes': {
+            'name': {
+               'Unique': True,
+               'Typecast': GTypecast.name,
+               'Description': 'The unique name of the box.' },
+            'label': {
+               'Typecast': GTypecast.text,
+               'Description': 'An optional text label that will be displayed '
+                              'on the border.' },
+            'block': {
+               'Required': True,
+               'Typecast': GTypecast.name,
+               'References': 'block.name',
+               'Description': 'The {block} to which this scrollbar scrolls.' },
+            },
+         'Positionable': True,
+         'ParentTags': ('page','vbox','hbox','box'),
+         'Description': 'A box is a visual element that draws a box around '
+                        'other visual elements, thus providing logical '
+                        'separation for them.' },
+      'hbox': {
+         'BaseClass': GFObjects.GFHBox,
+         'Attributes': {
+            'name': {
+               'Unique': True,
+               'Typecast': GTypecast.name,
+               'Description': 'The unique name of the box.' },
+            'label': {
+               'Typecast': GTypecast.text,
+               'Description': 'An optional text label that will be displayed '
+                              'on the border.' },
+            'block': {
+               'Required': True,
+               'Typecast': GTypecast.name,
+               'References': 'block.name',
+               'Description': 'The {block} to which this scrollbar scrolls.' },
+            },
+         'Positionable': True,
+         'ParentTags': ('page','vbox','hbox','box'),
+         'Description': 'A box is a visual element that draws a box around '
+                        'other visual elements, thus providing logical '
+                        'separation for them.' },
       'box': {
          'BaseClass': GFObjects.GFBox,
          'Attributes': {
@@ -636,7 +680,7 @@
                'Description': 'Defines what order the focus moves through '
                               'entries.' } },
          'Positionable': True,
-         'ParentTags': ('page',),
+         'ParentTags': ('page','box'),
          'Description': 'A box is a visual element that draws a box around '
                         'other visual elements, thus providing logical '
                         'separation for them.' },
@@ -696,7 +740,7 @@
                'Description': 'Defines what order the focus moves through '
                               'entries.'  } },
          'Positionable': True,
-         'ParentTags': ('page',),
+         'ParentTags': ('page','vbox','hbox','box'),
          'Description': 'Displays an image.' },
 
       'component': {
@@ -733,7 +777,7 @@
                'Description': 'Defines what order the focus moves through '
                               'entries.'  } },
          'Positionable': True,
-         'ParentTags': ('page',),
+         'ParentTags': ('page','vbox','hbox','box'),
          'Description': 'TODO' },
 
       'button': {
@@ -777,7 +821,7 @@
                'Typecast': GTypecast.name,
                'Description': 'Action to be executed when the button is 
fired'}},
          'Positionable': True,
-         'ParentTags': ('page',),
+         'ParentTags': ('page','vbox','hbox','box'),
          'Description': 'A visual element with text placed on it, that '
                         'the user can push or click, and that event can run '
                         'a bound trigger.' },

Modified: trunk/gnue-forms/src/uidrivers/gtk2/widgets/form/wrappers.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/gtk2/widgets/form/wrappers.py        
2006-06-20 09:41:04 UTC (rev 8499)
+++ trunk/gnue-forms/src/uidrivers/gtk2/widgets/form/wrappers.py        
2006-06-20 09:41:58 UTC (rev 8500)
@@ -183,10 +183,7 @@
 
     swin.set_policy (gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
     swin.add_with_viewport (newWidget)
-    if hasattr (gfObject, 'caption'):
-      text = "%s" % gfObject.caption
-    else:
-      text = "%s" % gfObject.name
+    text = "%s" % (gfObject.caption or gfObject.name)
     self.append_page (swin, gtk.Label (text.encode ('utf-8')))
 
     self._pageList.append (newWidget)

Modified: trunk/gnue-forms/src/uidrivers/win32/widgets/form/wrappers.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/win32/widgets/form/wrappers.py       
2006-06-20 09:41:04 UTC (rev 8499)
+++ trunk/gnue-forms/src/uidrivers/win32/widgets/form/wrappers.py       
2006-06-20 09:41:58 UTC (rev 8500)
@@ -98,7 +98,7 @@
     self.pane.Show()
 
   def createPage(self, object): 
-    pszText = hasattr(object,'caption') and object.caption or object.name
+    pszText = "%s" % (object.caption or object.name)
     buff = array.array('c', textEncode(pszText) + "\0")
     addrText = buff.buffer_info()[0]
     tab=struct.pack("iilliii", commctrl.TCIF_TEXT | commctrl.TCIF_STATE, 0, 0, 
addrText, 0, 0, -1)

Modified: trunk/gnue-forms/src/uidrivers/wx/widgets/form/wrappers.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx/widgets/form/wrappers.py  2006-06-20 
09:41:04 UTC (rev 8499)
+++ trunk/gnue-forms/src/uidrivers/wx/widgets/form/wrappers.py  2006-06-20 
09:41:58 UTC (rev 8500)
@@ -156,7 +156,7 @@
     newWidget.SetSizer(sizer)
 
     self._pageList.append(newWidget)
-    tabtitle = hasattr(object,'caption') and object.caption or object.name
+    tabtitle = "%s" % (object.caption or object.name)
     self.pane.AddPage(newWidget, wxEncode(tabtitle))
     self.pane.SetClientSize(self.layoutSize)
     self.fit()

Modified: trunk/gnue-forms/src/uidrivers/wx26/UIdriver.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/UIdriver.py     2006-06-20 09:41:04 UTC 
(rev 8499)
+++ trunk/gnue-forms/src/uidrivers/wx26/UIdriver.py     2006-06-20 09:41:58 UTC 
(rev 8500)
@@ -150,17 +150,17 @@
 
     for child in self._children:
       if child._form.name == formName:
-        window = child.mainWindow
+        window = child.main_window
         if isinstance (window, wx.Dialog) and window.IsModal ():
           window.EndModal (-1)
         else:
           window.Hide ()
 
-      exitApp = exitApp and not child.mainWindow.IsShown ()
+      exitApp = exitApp and not child.main_window.IsShown ()
 
     if exitApp:
       for child in self._children:
-        child.mainWindow.Close (True)
+        child.main_window.Close (True)
 
       wx.GetApp ().ExitMainLoop ()
 

Modified: trunk/gnue-forms/src/uidrivers/wx26/__init__.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/__init__.py     2006-06-20 09:41:04 UTC 
(rev 8499)
+++ trunk/gnue-forms/src/uidrivers/wx26/__init__.py     2006-06-20 09:41:58 UTC 
(rev 8500)
@@ -23,3 +23,5 @@
 
 from UIdriver import GFUserInterface
 from UILoginHandler import *
+
+__rearrange_boxes__ = True

Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/_base.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/_base.py        2006-06-20 
09:41:04 UTC (rev 8499)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/_base.py        2006-06-20 
09:41:58 UTC (rev 8500)
@@ -24,295 +24,361 @@
 import wx
 import os
 
+from gnue.common.definitions import GParser
 from gnue.forms.GFForm import *
 from gnue.forms.uidrivers._base.widgets._base import UIWidget
 
 
 # =============================================================================
+# Exceptions
+# =============================================================================
+
+class InvalidBoundingBoxError(GParser.MarkupError):
+    """ Element A overlaps Element B """
+    def __init__(self, current, item):
+        cur_type = current._type[2:]
+        cmp_type = item._type[2:]
+        msg = u_("Widget %(cur_type)s '%(cur_name)s' overlaps %(cmp_type)s "
+                 "'%(cmp_name)s'") \
+              % {'cur_type': cur_type, 'cur_name': current.name,
+                 'cmp_type': cmp_type, 'cmp_name': item.name}
+        GParser.MarkupError.__init__(self, msg, current._url,
+                current._lineNumber)
+
+
+# =============================================================================
 # This class implements the common behaviour of wx 2.6 widgets
 # =============================================================================
 
 class UIHelper (UIWidget):
-  """
-  Implements the common behaviour of wx 2.6 widgets
-  """
-
-  # ---------------------------------------------------------------------------
-  # Create a new wx widget
-  # ---------------------------------------------------------------------------
-
-  def createWidget (self, event, spacer):
     """
-    This function creates a new wx widget and adds it to the cross reference
-    table.
+    Implements the common behaviour of wx 2.6 widgets
     """
 
-    self._eventHandler = event.eventHandler
+    # -------------------------------------------------------------------------
+    # Create a new wx widget
+    # -------------------------------------------------------------------------
 
-    if hasattr (self._gfObject, 'Char__y'):
-      posY = self._gfObject.Char__y
-      gap  = self._gfObject._gap + 1
-      self.itemY = (posY + spacer * gap) * self._uiDriver.cellHeight
+    def createWidget (self, event, spacer):
+        """
+        This function creates a new wx widget and adds it to the cross 
reference
+        table.
+        """
 
-    if hasattr (self._gfObject, 'Char__height'):
-      self.itemHeight = self._gfObject.Char__height * event.textHeight
+        self._eventHandler = event.eventHandler
+        self.bounding_boxes = []
 
-    newWidget = self._createWidget (event, spacer)
-    if event.initialize:
-      self._addToCrossRef (newWidget, self._gfObject, self)
+        self.prepare_for_layout(event, spacer)
 
-    return newWidget
+        newWidget = self._createWidget (event, spacer)
+        if event.initialize:
+            self._addToCrossRef (newWidget, self._gfObject, self)
 
+        return newWidget
 
-  # ---------------------------------------------------------------------------
-  # Add a widget to the cross reference tables
-  # ---------------------------------------------------------------------------
 
-  def _addToCrossRef (self, widget, gfobject, uiobject):
+    # -------------------------------------------------------------------------
+    # 
+    # -------------------------------------------------------------------------
 
-    self._uiDriver._WidgetToGFObj [widget] = gfobject
-    self._uiDriver._WidgetToUIObj [widget] = uiobject
+    def prepare_for_layout(self, event, spacer):
 
+        if not self._gfObject._form._layout.managed:
+            if isinstance(self._gfObject, (GFBox, GFTabStop, GFLabel,
+                GFScrollBar)):
+                gap  = self._gfObject._gap + 1
 
-  # ---------------------------------------------------------------------------
-  # Remove a widget from the cross reference tables
-  # ---------------------------------------------------------------------------
+                self.chr_y = self._gfObject.Char__y + spacer * gap
+                self.chr_x = self._gfObject.Char__x
+                self.chr_w = self._gfObject.Char__width
+                self.chr_h = getattr(self._gfObject, 'Char__height', 1)
 
-  def _deleteFromCrossRef (self, widget, object):
+                self.chr_pos  = (self.chr_y, self.chr_x)
+                self.chr_span = (self.chr_h, self.chr_w)
 
-    try:
-      del self._uiDriver._WidgetToGFObj [widget]
-      del self._uiDriver._WidgetToUIObj [widget]
+                # Check the bounding box of the parent
+                (left, top, right, bottom) = self.get_bounding_box()
 
-    except:
-      pass
+                owner = self.getParent()
+                if isinstance(owner._gfObject, GFBox):
+                    (oleft, otop, oright, obottom) = owner.get_bounding_box()
 
+                    if right >= oright or bottom >= obottom or left < 0 \
+                            or top < 0:
+                        raise InvalidBoundingBoxError(self._gfObject,
+                               owner._gfObject)
 
-  # ---------------------------------------------------------------------------
-  # Show all ui-widgets managed by this object
-  # ---------------------------------------------------------------------------
+                for (cleft, ctop, cright, cbot, citem) in owner.bounding_boxes:
+                    if (right < cleft) or (left > cright) or \
+                            (bottom < ctop) or (top > cbot):
+                        continue
 
-  def show (self):
-    """
-    Call Show () on all wx-widgets managed by this instance. This is needed if
-    a row-count greater than 0 is given.
-    """
+                    raise InvalidBoundingBoxError(self._gfObject, citem)
 
-    for widget in self.widgets:
-      widget.Show ()
+                bounds = (left, top, right, bottom, self._gfObject)
+                owner.bounding_boxes.append(bounds)
 
 
-  # ---------------------------------------------------------------------------
-  # Hide all ui-widgets managed by this object
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Get the bounding box of an UIWidget
+    # -------------------------------------------------------------------------
 
-  def hide (self):
-    """
-    Call Hide () on all wx-widgets managed by this instance. This is needed if
-    a row-count greater than 0 is given.
-    """
+    def get_bounding_box(self):
 
-    for widget in self.widgets:
-      widget.Hide ()
+        if self._gfObject._form._layout.managed:
+            return None
+        else:
+            left, top = self.chr_x, self.chr_y
+            right, bottom = self.chr_x+self.chr_w-1, self.chr_y+self.chr_h-1
+            return (left, top, right, bottom)
 
 
-  # ---------------------------------------------------------------------------
-  # Show widgets in a modal way
-  # ---------------------------------------------------------------------------
 
-  def showModal (self):
+    # -------------------------------------------------------------------------
+    # Add a widget to the cross reference tables
+    # -------------------------------------------------------------------------
 
-    for widget in self.widgets:
-      widget.ShowModal ()
+    def _addToCrossRef (self, widget, gfobject, uiobject):
 
-  # ---------------------------------------------------------------------------
-  # Destroy all widgets associated with an instance
-  # ---------------------------------------------------------------------------
+        self._uiDriver._WidgetToGFObj [widget] = gfobject
+        self._uiDriver._WidgetToUIObj [widget] = uiobject
 
-  def destroy (self):
 
-    for widget in self.widgets:
-      widget.Destroy ()
+    # -------------------------------------------------------------------------
+    # Remove a widget from the cross reference tables
+    # -------------------------------------------------------------------------
 
+    def _deleteFromCrossRef (self, widget, object):
 
-  # ---------------------------------------------------------------------------
-  # Set the focus to a given widget
-  # ---------------------------------------------------------------------------
+        try:
+            del self._uiDriver._WidgetToGFObj [widget]
+            del self._uiDriver._WidgetToUIObj [widget]
 
-  def indexedFocus (self, index):
-    """
-    This function set's the focus to the gtk-widget specified by index. If the
-    widget has a focusHandler it will be blocked and unblocked to prevent a
-    recursion. The focused widget will have a highlight color if it is set
-    in gnue.conf.
-    """
+        except:
+            pass
 
-    widget  = self.widgets [index]
-    current = widget.FindFocus ()
 
-    if isinstance (widget, wx.ComboBox) and 'wxMac' in wx.PlatformInfo:
-      item = widget._entry
-    else:
-      item = widget
+    # -------------------------------------------------------------------------
+    # Show all ui-widgets managed by this object
+    # -------------------------------------------------------------------------
 
-    # Only change the focus if necessary
-    if current != item:
-      item.SetFocus ()
+    def show (self):
+        """
+        Call Show () on all wx-widgets managed by this instance. This is needed
+        if a row-count greater than 0 is given.
+        """
 
+        for widget in self.widgets:
+            widget.Show ()
 
-  # ---------------------------------------------------------------------------
-  # On lose of the focus we un-select ComboBox-Entries
-  # ---------------------------------------------------------------------------
 
-  def loseFocus (self):
+    # -------------------------------------------------------------------------
+    # Hide all ui-widgets managed by this object
+    # -------------------------------------------------------------------------
 
-    pass
+    def hide (self):
+        """
+        Call Hide () on all wx-widgets managed by this instance. This is needed
+        if a row-count greater than 0 is given.
+        """
 
+        for widget in self.widgets:
+            widget.Hide ()
 
-  # ---------------------------------------------------------------------------
-  # Set the value of a widget
-  # ---------------------------------------------------------------------------
 
-  def setValue (self, value, index = 0, enabled = True):
-    """
-    This function sets the value of a widget and optionally enables or disables
-    the widget.
-    """
+    # -------------------------------------------------------------------------
+    # Show widgets in a modal way
+    # -------------------------------------------------------------------------
 
-    widget = self.widgets [index]
-    widget.SetEvtHandlerEnabled (False)
+    def showModal (self):
 
-    try:
-      if self._gfObject.style in ['dropdown', 'listbox']:
-        if self._gfObject._field._allowedValues != widget._origAllowedValues:
-          self._updateChoices (widget)
+        for widget in self.widgets:
+            widget.ShowModal ()
 
-      if isinstance (widget, wx.StaticText):
-        widget.SetLabel (value)
+    # -------------------------------------------------------------------------
+    # Destroy all widgets associated with an instance
+    # -------------------------------------------------------------------------
 
-      elif isinstance (widget, wx.ListBox):
-        if value:
-          widget.SetStringSelection (value, True)
+    def destroy (self):
 
-      else:
-        if isinstance (widget, wx.ComboBox):
-          # We use SetStringSelection to keep the selected index in sync with
-          # the string value (e.g. in Choice-Controls on OS X)
-          if not widget.SetStringSelection (value):
-            widget.SetValue (value)
+        for widget in self.widgets:
+            widget.Destroy ()
+
+
+    # -------------------------------------------------------------------------
+    # Set the focus to a given widget
+    # -------------------------------------------------------------------------
+
+    def indexedFocus (self, index):
+        """
+        This function set's the focus to the widget specified by index.
+        """
+
+        widget  = self.widgets [index]
+        current = widget.FindFocus ()
+
+        if isinstance (widget, wx.ComboBox) and 'wxMac' in wx.PlatformInfo:
+            item = widget._entry
         else:
-          widget.SetValue (value)
+            item = widget
 
-      widget.Enable (enabled)
+        # Only change the focus if necessary
+        if current != item:
+            item.SetFocus ()
 
-    finally:
-      widget.SetEvtHandlerEnabled (True)
-      widget.Refresh ()
 
+    # -------------------------------------------------------------------------
+    # On lose of the focus we un-select ComboBox-Entries
+    # -------------------------------------------------------------------------
 
-  # --------------------------------------------------------------------------
-  # Set the cursor's location in a widget
-  # --------------------------------------------------------------------------
+    def loseFocus (self):
+        pass
 
-  def setCursorPosition (self, position, index = 0):
-    """
-    Set the cursor position to the given location inside a capable widget.
 
-    @param position: new position of the insertion point
-    @param index: index of the widget to be changed (if rows > 0)
-    """
+    # -------------------------------------------------------------------------
+    # Set the value of a widget
+    # -------------------------------------------------------------------------
 
-    widget = self.widgets [index]
+    def setValue (self, value, index = 0, enabled = True):
+        """
+        This function sets the value of a widget and optionally enables or
+        disables the widget.
+        """
 
-    if isinstance (widget, wx.ComboBox):
-      if 'wxMac' in wx.PlatformInfo:
-        widget._entry.SetInsertionPoint (position)
-      else:
-        widget.SetMark (position, position)
+        widget = self.widgets [index]
+        widget.SetEvtHandlerEnabled (False)
 
-    elif hasattr (widget, 'SetInsertionPoint'):
-      widget.SetInsertionPoint (self._positionToWx (widget, position))
+        try:
+            if self._gfObject.style in ['dropdown', 'listbox']:
+                if self._gfObject._field._allowedValues != 
widget._origAllowedValues:
+                    self._updateChoices (widget)
 
+            if isinstance (widget, wx.StaticText):
+                widget.SetLabel (value)
 
-  # --------------------------------------------------------------------------
-  # Set the selection inside a widget
-  # --------------------------------------------------------------------------
+            elif isinstance (widget, wx.ListBox):
+                if value:
+                    widget.SetStringSelection (value, True)
 
-  def setSelectedArea (self, selection1, selection2, index=0):
-    """
-    Sets the selection start/end inside a capable widget.
+            else:
+                if isinstance (widget, wx.ComboBox):
+                    # We use SetStringSelection to keep the selected index in
+                    # sync with the string value (e.g. in Choice-Controls on OS
+                    # X)
+                    if not widget.SetStringSelection (value):
+                        widget.SetValue (value)
+                else:
+                    widget.SetValue (value)
 
-    @param selection1: start position of the selection
-    @param selection2: end position of the selection
-    @param index: index of the widget to be changed
-    """
+            widget.Enable (enabled)
+
+        finally:
+            widget.SetEvtHandlerEnabled (True)
+            widget.Refresh ()
+
+
+    # ------------------------------------------------------------------------
+    # Set the cursor's location in a widget
+    # ------------------------------------------------------------------------
+
+    def setCursorPosition (self, position, index = 0):
+      """
+      Set the cursor position to the given location inside a capable widget.
+
+      @param position: new position of the insertion point
+      @param index: index of the widget to be changed (if rows > 0)
+      """
+
+      widget = self.widgets [index]
+
+      if isinstance (widget, wx.ComboBox):
+          if 'wxMac' in wx.PlatformInfo:
+              widget._entry.SetInsertionPoint (position)
+          else:
+              widget.SetMark (position, position)
+
+      elif hasattr (widget, 'SetInsertionPoint'):
+          widget.SetInsertionPoint (self._positionToWx (widget, position))
+
+
+    # ------------------------------------------------------------------------
+    # Set the selection inside a widget
+    # ------------------------------------------------------------------------
+
+    def setSelectedArea (self, selection1, selection2, index=0):
+        """
+        Sets the selection start/end inside a capable widget.
+
+        @param selection1: start position of the selection
+        @param selection2: end position of the selection
+        @param index: index of the widget to be changed
+        """
     
-    widget = self.widgets [index]
+        widget = self.widgets [index]
 
-    if isinstance (widget, wx.ComboBox):
-      if 'wxMac' in wx.PlatformInfo:
-        widget._entry.SetSelection (selection1, selection2)
-      else:
-        widget.SetMark (selection1, selection2)
+        if isinstance (widget, wx.ComboBox):
+            if 'wxMac' in wx.PlatformInfo:
+                widget._entry.SetSelection (selection1, selection2)
+            else:
+                widget.SetMark (selection1, selection2)
 
-    elif hasattr (widget, 'SetSelection'):
-      if isinstance (widget, wx.TextCtrl) and widget.IsMultiLine ():
-        selection1 = self._positionToWx (widget, selection1)
-        selection2 = self._positionToWx (widget, selection2)
+        elif hasattr (widget, 'SetSelection'):
+            if isinstance (widget, wx.TextCtrl) and widget.IsMultiLine ():
+                selection1 = self._positionToWx (widget, selection1)
+                selection2 = self._positionToWx (widget, selection2)
 
-      widget.SetSelection (selection1, selection2)
+            widget.SetSelection (selection1, selection2)
 
 
-  # ---------------------------------------------------------------------------
-  # Update the choices of a ComboBox or a Listbox
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Update the choices of a ComboBox or a Listbox
+    # -------------------------------------------------------------------------
 
-  def _updateChoices (self, widget):
+    def _updateChoices (self, widget):
 
-    widget.Freeze ()
+        widget.Freeze ()
 
-    try:
-      choices = self._gfObject._field._allowedValuesReverse.keys ()
-      choices.sort ()
+        try:
+            choices = self._gfObject._field._allowedValuesReverse.keys ()
+            choices.sort ()
 
-      widget.Clear ()
-      for dsc in choices:
-        widget.Append (dsc, self._gfObject._field._allowedValuesReverse [dsc])
+            widget.Clear ()
+            for dsc in choices:
+                widget.Append (dsc, 
self._gfObject._field._allowedValuesReverse [dsc])
 
-      widget._origAllowedValues = self._gfObject._field._allowedValues
+            widget._origAllowedValues = self._gfObject._field._allowedValues
 
-    finally:
-      widget.Thaw ()
+        finally:
+            widget.Thaw ()
 
 
-  # ---------------------------------------------------------------------------
-  # Convert a GF-position to a wx position within a multiline edit
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Convert a GF-position to a wx position within a multiline edit
+    # -------------------------------------------------------------------------
 
-  def _positionToWx (self, widget, position):
+    def _positionToWx (self, widget, position):
 
-    if len (os.linesep) < 2 or not position:
-      return position
+        if len (os.linesep) < 2 or not position:
+            return position
 
-    text = widget.GetValue () [:position]
-    num  = text.count ('\n')
-    result = position + num
+        text = widget.GetValue () [:position]
+        num  = text.count ('\n')
+        result = position + num
 
-    return result
+        return result
 
 
-  # ---------------------------------------------------------------------------
-  # Convert a wx position to a GF position within a multiline edit
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Convert a wx position to a GF position within a multiline edit
+    # -------------------------------------------------------------------------
 
-  def _wxToPosition (self, widget, position):
+    def _wxToPosition (self, widget, position):
 
-    if len (os.linesep) < 2 or not position:
-      return position
+        if len (os.linesep) < 2 or not position:
+            return position
 
-    text   = widget.GetValue ().replace ('\n', os.linesep) [:position]
-    num    = text.count (os.linesep)
-    result = max (0, position - num)
+        text   = widget.GetValue ().replace ('\n', os.linesep) [:position]
+        num    = text.count (os.linesep)
+        result = max (0, position - num)
 
-    return result
-
+        return result

Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/box.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/box.py  2006-06-20 09:41:04 UTC 
(rev 8499)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/box.py  2006-06-20 09:41:58 UTC 
(rev 8500)
@@ -23,10 +23,28 @@
 
 import wx
 
+from gnue.common.definitions import GParser
 from gnue.forms.uidrivers.wx26.widgets import _base
 
 
 # =============================================================================
+# Exceptions
+# =============================================================================
+
+class InvalidBoundingBoxError(GParser.MarkupError):
+    """ Element A overlaps Element B """
+    def __init__(self, current, item):
+        cur_type = current._type[2:]
+        cmp_type = item._type[2:]
+        msg = u_("Widget %(cur_type)s '%(cur_name)s' overlaps %(cmp_type)s "
+                 "'%(cmp_name)s'") \
+              % {'cur_type': cur_type, 'cur_name': current.name,
+                 'cmp_type': cmp_type, 'cmp_name': item.name}
+        GParser.MarkupError.__init__(self, msg, current._url,
+                current._lineNumber)
+
+
+# =============================================================================
 # Interface implementation for a box widget
 # =============================================================================
 
@@ -38,14 +56,39 @@
 
   def _createWidget (self, event, spacer):
 
-    offs = 2
-    pos  = (self.itemX + offs, self.itemY + offs)
-    size = (self.itemWidth - offs * 2, self.itemHeight - offs * 2)
+    top, left = self.chr_pos
+    height, width = self.chr_span
 
-    return wx.StaticBox (event.container, -1, self._gfObject.label, pos, size)
+    parent = event.container
 
+    owner = self.getParent()
+    if isinstance(owner, UIBox):
+        if owner.chr_x + owner.chr_w <= left + width or \
+           owner.chr_y + owner.chr_h <= top + height:
+            raise InvalidBoundingBoxError(self, owner)
 
+    sizer = owner.container_sizer
+    outer = wx.BoxSizer(wx.VERTICAL)
+    
+    stb = wx.StaticBox (parent, -1, self._gfObject.label)
+    stb_sizer = wx.StaticBoxSizer(stb, wx.VERTICAL)
 
+    inner = wx.BoxSizer(wx.VERTICAL)
+
+    self.container_sizer = wx.GridBagSizer()
+    inner.Add(self.container_sizer, 1, wx.EXPAND | wx.ALL, 2)
+
+    stb_sizer.Add(inner, 1, wx.EXPAND)
+    outer.Add(stb_sizer, 1, wx.EXPAND | wx.ALL, 4)
+
+    sizer.Add(outer, self.chr_pos, self.chr_span, wx.EXPAND)
+    self._containerToolkitWidget = parent
+
+    return stb
+
+
+
+
 # =============================================================================
 # Configuration data
 # =============================================================================

Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/button.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/button.py       2006-06-20 
09:41:04 UTC (rev 8499)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/button.py       2006-06-20 
09:41:58 UTC (rev 8500)
@@ -45,17 +45,14 @@
         Creates a new Button widget.
         """
 
-        offs = (self._uiDriver.cellHeight - \
-                self._uiDriver.controlHeight.get('button', 0)) / 2
-        pos  = (self.itemX, self.itemY + offs)
-        size = (self.itemWidth, -1)
-
-        newWidget = wx.Button(event.container, -1, self._gfObject.label, pos,
-              size)
+        newWidget = wx.Button(event.container, -1, self._gfObject.label)
         newWidget.Bind(wx.EVT_BUTTON   , self.__on_button)
         newWidget.Bind(wx.EVT_SET_FOCUS, self.__on_set_focus)
         newWidget.Bind(wx.EVT_CHAR     , self.__on_char)
 
+        sizer = self.getParent().container_sizer
+        sizer.Add(newWidget, self.chr_pos, self.chr_span, wx.EXPAND)
+
         return newWidget
 
 

Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py        2006-06-20 
09:41:04 UTC (rev 8499)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/entry.py        2006-06-20 
09:41:58 UTC (rev 8500)
@@ -50,8 +50,27 @@
 
     self.__calculateSizes ()
     func = getattr (self, "_build%s" % self._gfObject.style.title ())
+    
     widget = func (event.container)
 
+    parent = event.container
+    sizer = self.getParent().container_sizer
+
+    xFlag  = 0
+    border = 2
+
+    if 'wxMac' in wx.PlatformInfo:
+        xFlag = wx.ALL
+    elif 'wxMSW' in wx.PlatformInfo:
+        xFlag = wx.TOP | wx.BOTTOM
+        border = 1
+
+    ver = wx.BoxSizer (wx.VERTICAL)
+    ver.AddSpacer((0,0), 1)
+    ver.Add (widget, 0, wx.EXPAND | xFlag, border)
+    ver.AddSpacer((0,0), 1)
+    sizer.Add(ver, self.chr_pos, self.chr_span, wx.EXPAND)
+
     return widget
 
 
@@ -61,20 +80,9 @@
 
   def __calculateSizes (self):
 
-    cellH = self._uiDriver.cellHeight
-    ctrlH = self._uiDriver.controlHeight.get (self._gfObject.style, cellH)
-    offset = (cellH - ctrlH) / 2
+      self.__lines = getattr (self._gfObject, 'Char__height', 1)
 
-    self.__lines = getattr (self._gfObject, 'Char__height', 1)
-    self.__size  = (self.itemWidth, self.__lines == 1 and -1 or 
self.itemHeight)
-    self.__pos   = (self.itemX, self.itemY + offset)
-    self.__cellH = cellH
 
-    if self._gfObject.style == 'default' and self.__lines > 1:
-      self.__size = (self.itemWidth,
-                     (self.__lines * cellH) - (cellH - offset * 2))
-
-
   # ---------------------------------------------------------------------------
   # Widget construction methods
   # ---------------------------------------------------------------------------
@@ -91,7 +99,11 @@
     if self.__lines > 1:
       xFlags |= wx.TE_MULTILINE
 
-    result = wx.TextCtrl (parent, -1, '', self.__pos, self.__size, xFlags)
+    if not self._gfObject._form._layout.managed:
+        size = (self._uiDriver.cellWidth * self.chr_w, -1)
+    else:
+        size = (-1, -1)
+    result = wx.TextCtrl (parent, -1, size = size, style = xFlags)
 
     result.Bind (wx.EVT_CHAR, self.__keypress)
     result.Bind (wx.EVT_SET_FOCUS, self.__on_set_focus)
@@ -117,7 +129,7 @@
     """
     """
 
-    return wx.StaticText (parent, -1, "", self.__pos, self.__size)
+    return wx.StaticText (parent, -1, "")
 
 
   # ---------------------------------------------------------------------------
@@ -126,7 +138,7 @@
     """
     """
 
-    result = wx.CheckBox (parent, -1, self._gfObject.label, self.__pos)
+    result = wx.CheckBox (parent, -1, self._gfObject.label)
     result.Bind (wx.EVT_CHECKBOX, self.__toggleCheckbox)
     result.Bind (wx.EVT_CHAR, self.__keypress)
     result.Bind (wx.EVT_SET_FOCUS, self.__on_set_focus)
@@ -140,9 +152,12 @@
     """
     """
 
-    result = wx.ComboBox (parent, -1, "", self.__pos, self.__size, [],
-        wx.CB_DROPDOWN)
+    csize = (-1, -1)
+    if not self._form._layout.managed:
+        csize = (self._uiDriver.cellWidth * self.chr_w, -1)
 
+    result = wx.ComboBox (parent, -1, size=csize, style=wx.CB_DROPDOWN)
+
     self._updateChoices (result)
 
     # On wxMac a Combobox is a container holding a TextCtrl and a Choice. So we
@@ -179,7 +194,11 @@
     """
     """
 
-    result = wx.ListBox (parent, -1, self.__pos, self.__size, [], wx.LB_SINGLE)
+    csize = (-1, -1)
+    if not self._gfObject._form._layout.managed:
+        csize = (self._uiDriver.cellWidth * self.chr_w, -1)
+
+    result = wx.ListBox (parent, -1, size=csize, style=wx.LB_SINGLE)
     self._updateChoices (result)
 
     result.Bind (wx.EVT_LISTBOX, self.__itemSelected)

Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py 2006-06-20 09:41:04 UTC 
(rev 8499)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py 2006-06-20 09:41:58 UTC 
(rev 8500)
@@ -29,206 +29,218 @@
 from gnue.forms.uidrivers.wx26.ToolBar import ToolBar
 from gnue.forms.uidrivers.wx26.widgets._base import UIHelper
 
+__all__ = ['UIForm']
 
 # =============================================================================
 # Interface implementation of a form widget
 # =============================================================================
 
 class UIForm (UIHelper):
-  """
-  Interface implementation of form widgets (forms and dialogs)
-  """
+    """
+    Interface implementation of form widgets (forms and dialogs)
+    """
 
-  # ---------------------------------------------------------------------------
-  # Create a new form widget
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Constructor
+    # -------------------------------------------------------------------------
 
-  def __init__ (self, event):
+    def __init__(self, event):
 
-    self.statusBar   = None
+        self.statusBar = None
 
-    UIHelper.__init__ (self, event)
-    self._inits.extend ([self._updateSizers, self.__firstPage])
+        UIHelper.__init__(self, event)
+        self._inits.extend([self._updateSizers, self.__firstPage])
 
 
-  # ---------------------------------------------------------------------------
-  # Make sure to have the first page visible
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Make sure to have the first page visible
+    # -------------------------------------------------------------------------
 
-  def __firstPage (self):
+    def __firstPage (self):
 
-    current = self._form._currentPage
-    pgList  = self._form._layout._pageList
-    if pgList and current in pgList:
-      index = pgList.index (current)
-    else:
-      index = 0
+        current = self._form._currentPage
+        pgList  = self._form._layout._pageList
+        if pgList and current in pgList:
+            index = pgList.index(current)
+        else:
+            index = 0
 
-    self._containerToolkitWidget.showPage (index)
+        self._containerToolkitWidget.showPage(index)
 
 
-  # ---------------------------------------------------------------------------
-  # Create a new wx frame widget
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Create a new wx frame widget
+    # -------------------------------------------------------------------------
 
-  def _createWidget (self, event, spacer):
+    def _createWidget (self, event, spacer):
 
-    if self._form.style != 'dialog':
-      self.mainWindow = self._uiDriver._parentContainer
-      if not self.mainWindow:
-        self.mainWindow = wx.Frame (None, -1)
-    else:
-      self.mainWindow = wx.Dialog (None, -1)
+        if self._form.style != 'dialog':
+            self.main_window = self._uiDriver._parentContainer
+            if not self.main_window:
+                self.main_window = wx.Frame (None, -1)
+        else:
+            self.main_window = wx.Dialog (None, -1)
 
-    self.mainWindow.SetTitle (self._form.title)
-    self.mainWindow.SetIcons (self.__loadIcons ())
-    self.mainWindow.Bind (wx.EVT_CLOSE, self.__closeTrap, self.mainWindow)
+        # Do we have boxes
+        if self._form.findChildOfType ('GFVBox', True, True):
+            self.boxed = True
+        else:
+            self.boxed = False
 
-    self.__basePanel = wx.Panel (self.mainWindow, -1)
-    self.__baseSizer = wx.BoxSizer (wx.VERTICAL)
+        self.main_window.SetTitle (self._form.title)
+        self.main_window.SetIcons (self.__loadIcons ())
+        self.main_window.Bind (wx.EVT_CLOSE, self.__closeTrap, 
self.main_window)
 
-    # Add Statusbar, Toolbar and Menubar as requested and/or allowed
-    if self._form.style != 'dialog':
-      if not self._form._features ['GUI:STATUSBAR:SUPPRESS']:
-        self.statusBar = self.mainWindow.CreateStatusBar ()
-        self.statusBar.SetFieldsCount (5)
-        self.statusBar.SetStatusWidths ([-1, 50, 50, 75, 75])
+        self.master_sizer = wx.BoxSizer(wx.VERTICAL)
 
-      if not self._form._features.get ('GUI:MENUBAR:SUPPRESS'):
-        mb = MenuBar (self._uiDriver, self.mainWindow, self._form)
-        self.menuBar = mb.menubar
+        # The base panel is needed on wxMSW to get a uniform background of the
+        # frame.
+        self.base_panel = wx.Panel(self.main_window, -1)
+        self.base_sizer = wx.BoxSizer(wx.VERTICAL)
+        self.base_panel.SetSizer(self.base_sizer)
 
-      if not self._form._features.get ('GUI:TOOLBAR:SUPPRESS'):
-        tlb = ToolBar (self._uiDriver, self.__basePanel, self._form)
-        self.__baseSizer.Add (tlb.toolbar, 0, wx.EXPAND)
+        # Add Statusbar, Toolbar and Menubar as requested and/or allowed
+        if self._form.style != 'dialog':
+            if not self._form._features ['GUI:STATUSBAR:SUPPRESS']:
+                self.statusBar = self.main_window.CreateStatusBar ()
+                self.statusBar.SetFieldsCount (5)
+                self.statusBar.SetStatusWidths ([-1, 50, 50, 75, 75])
 
-    if self._form._layout.tabbed != 'none':
-      wrapper = TabbedWrapper (self, self.__basePanel, self.__baseSizer)
-    else:
-      wrapper = BaseWrapper (self, self.__basePanel, self.__baseSizer)
+            if not self._form._features.get ('GUI:MENUBAR:SUPPRESS'):
+                mb = MenuBar (self._uiDriver, self.main_window, self._form)
+                self.menuBar = mb.menubar
 
-    self._containerToolkitWidget = wrapper
+            if not self._form._features.get ('GUI:TOOLBAR:SUPPRESS'):
+                tlb = ToolBar (self._uiDriver, self.base_panel, self._form)
+                self.base_sizer.Add (tlb.toolbar, 0, wx.EXPAND)
 
-    return wrapper
+        if self._form._layout.tabbed != 'none':
+            wrapper = TabbedWrapper (self, self.base_panel, self.base_sizer)
+        else:
+            wrapper = BaseWrapper (self, self.base_panel, self.base_sizer)
 
+        self._containerToolkitWidget = wrapper
 
-  # ---------------------------------------------------------------------------
-  # Load an icon bundle for this form
-  # ---------------------------------------------------------------------------
+        self.master_sizer.Add(self.base_panel, 1, wx.EXPAND)
+        self.main_window.SetSizer(self.master_sizer)
 
-  def __loadIcons (self):
+        return wrapper
 
-    idir = GConfig.getInstalledBase ('forms_images', 'common_images')
-    iconBundle = wx.IconBundle ()
 
-    for sz in [16, 32, 64]:
-      fn = os.path.join (idir, 'forms', 'default', 'gnue-%sx%s.png' % (sz, sz))
-      if os.path.exists (fn):
-        # On wxMSW loading an icon directly from a file doesn't work, so we
-        # need to copy the icons from a bitmap on the fly
-        icon = wx.Icon (fn, wx.BITMAP_TYPE_PNG)
-        icon.CopyFromBitmap (wx.Image (fn).ConvertToBitmap ())
+    # -------------------------------------------------------------------------
+    # Load an icon bundle for this form
+    # -------------------------------------------------------------------------
 
-        iconBundle.AddIcon (icon)
+    def __loadIcons (self):
 
-    return iconBundle
+      idir = GConfig.getInstalledBase ('forms_images', 'common_images')
+      iconBundle = wx.IconBundle ()
 
+      for sz in [16, 32, 64]:
+          fn = os.path.join(idir, 'forms', 'default',
+                  'gnue-%sx%s.png' % (sz, sz))
+          if os.path.exists (fn):
+              # On wxMSW loading an icon directly from a file doesn't work, so
+              # we need to copy the icons from a bitmap on the fly
+              icon = wx.Icon (fn, wx.BITMAP_TYPE_PNG)
+              icon.CopyFromBitmap (wx.Image (fn).ConvertToBitmap ())
 
-  # ---------------------------------------------------------------------------
-  # Set sizers, specify the size hints and fit all child controls
-  # ---------------------------------------------------------------------------
+              iconBundle.AddIcon (icon)
 
-  def _updateSizers (self):
+      return iconBundle
 
-    self._containerToolkitWidget.fitAllSizers ()
 
-    self.__baseSizer.Fit (self.__basePanel)
-    self.__basePanel.SetSizer (self.__baseSizer)
+    # -------------------------------------------------------------------------
+    # Set sizers, specify the size hints and fit all child controls
+    # -------------------------------------------------------------------------
 
-    self.mainWindow.Fit ()
-    self.mainWindow.CenterOnScreen ()
+    def _updateSizers (self):
 
+        self.main_window.Fit ()
+        self._containerToolkitWidget.set_scrollrate ()
 
+        self.main_window.CenterOnScreen ()
 
-  # ---------------------------------------------------------------------------
-  # Show the form/dialog
-  # ---------------------------------------------------------------------------
 
-  def show (self):
+    # -------------------------------------------------------------------------
+    # Show the form/dialog
+    # -------------------------------------------------------------------------
 
-    self.mainWindow.Raise ()
-    self.mainWindow.Show ()
+    def show (self):
 
+        self.main_window.Raise ()
+        self.main_window.Show ()
 
-  # ---------------------------------------------------------------------------
-  # Show the form/dialog modal
-  # ---------------------------------------------------------------------------
 
-  def showModal (self):
+    # -------------------------------------------------------------------------
+    # Show the form/dialog modal
+    # -------------------------------------------------------------------------
 
-    self.mainWindow.Raise ()
+    def showModal(self):
 
-    # FIXME: this is a really dirty workaround. Although the focus is set
-    # properly in the GFForm, it is misplaced in the wx.Dialog after calling
-    # ShowModal (). If we would use Show () here everything's find. I was not
-    # able to create a standalone wx-app reproducing the situation. The bug
-    # does not appear on wxMSW or wxMac.
-    if 'wxGTK' in wx.PlatformInfo:
-      wx.CallAfter (self._request, 'FOCUS', data = self._form._currentEntry)
+        self.main_window.Raise()
 
-    self.mainWindow.ShowModal ()
+        # FIXME: this is a really dirty workaround.  Although the focus is set
+        # properly in the GFForm, it is misplaced in the wx.Dialog after
+        # calling ShowModal().  If we would use Show() here everything's fine.
+        # I was not able to create a standalone wx-app reproducing the
+        # situation.  The bug does not appear on wxMSW or wxMac.
+        if 'wxGTK' in wx.PlatformInfo:
+            wx.CallAfter(self._request, 'FOCUS', data=self._form._currentEntry)
 
+        self.main_window.ShowModal()
 
-  # ---------------------------------------------------------------------------
 
-  def _setStatusBar (self, tip, statusValue, insertValue, currentRecord,
-      maxRecord, currentPage, maxPage, procMsg = True):
+    # -------------------------------------------------------------------------
 
-    if not self.statusBar:
-      return
+    def _setStatusBar (self, tip, statusValue, insertValue, currentRecord,
+        maxRecord, currentPage, maxPage, procMsg=True):
 
-    if tip is not None:
-      self.statusBar.SetStatusText (tip, 0)
+        if not self.statusBar:
+            return
 
-    if statusValue is not None:
-      self.statusBar.SetStatusText (statusValue, 1)
+        if tip is not None:
+            self.statusBar.SetStatusText (tip, 0)
 
-    if insertValue is not None:
-      self.statusBar.SetStatusText (insertValue, 2)
+        if statusValue is not None:
+            self.statusBar.SetStatusText (statusValue, 1)
 
-    if currentRecord and maxRecord:
-      self.statusBar.SetStatusText ( \
-          ("%s/%s" % (currentRecord, maxRecord)).strip (), 3)
+        if insertValue is not None:
+            self.statusBar.SetStatusText (insertValue, 2)
 
-    if currentPage and maxPage:
-      self.statusBar.SetStatusText ( \
-          ("%s/%s" % (currentPage, maxPage)).strip (), 4)
+        if currentRecord and maxRecord:
+            self.statusBar.SetStatusText ( \
+                ("%s/%s" % (currentRecord, maxRecord)).strip (), 3)
 
+        if currentPage and maxPage:
+            self.statusBar.SetStatusText ( \
+                ("%s/%s" % (currentPage, maxPage)).strip (), 4)
 
-  # ---------------------------------------------------------------------------
-  # Close the form
-  # ---------------------------------------------------------------------------
 
-  def __closeTrap (self, event):
+    # -------------------------------------------------------------------------
+    # Close the form
+    # -------------------------------------------------------------------------
 
-    if event.CanVeto ():
-      self._request ('EXIT')
-      event.Veto ()
+    def __closeTrap (self, event):
 
-    else:
-      event.GetEventObject ().Destroy ()
+        if event.CanVeto ():
+            self._request ('EXIT')
+            event.Veto ()
 
+        else:
+            event.GetEventObject ().Destroy ()
 
-  # ---------------------------------------------------------------------------
-  # Change to the requested page
-  # ---------------------------------------------------------------------------
 
-  def gotoPage (self, page):
+    # -------------------------------------------------------------------------
+    # Change to the requested page
+    # -------------------------------------------------------------------------
 
-    self._containerToolkitWidget.showPage (page._pageIndex)
+    def gotoPage (self, page):
 
+        self._containerToolkitWidget.showPage (page._pageIndex)
 
 
+
 # =============================================================================
 # Simple scrolled window containing multiple page panels
 # =============================================================================
@@ -247,34 +259,34 @@
     self._pages    = []
 
     wx.ScrolledWindow.__init__ (self, parent, -1)
-    sizer.Add (self, 1, wx.EXPAND)
+    sizer.Add (self, 1, wx.EXPAND | wx.ALL, 8)
 
-    self.pageSizer     = wx.BoxSizer (wx.VERTICAL)
-    self.pageContainer = self._createPageContainer ()
+    self.sw_sizer = wx.BoxSizer(wx.VERTICAL)
+    self.SetSizer(self.sw_sizer)
 
-    self.pageSizer.Add (self.pageContainer, 1, wx.EXPAND | wx.ALL, 6)
+    self.page_container = self._createPageContainer()
+    self.page_sizer     = wx.BoxSizer(wx.VERTICAL)
+    self.page_container.SetSizer(self.page_sizer)
 
+    self.sw_sizer.Add(self.page_container, 1, wx.EXPAND)
 
 
   # ---------------------------------------------------------------------------
-  # Make sure to set all sizers and layout them
+  # Make sure to set the scrollrate for the scrolled window
   # ---------------------------------------------------------------------------
 
-  def fitAllSizers (self):
+  def set_scrollrate (self):
 
-    self.pageSizer.Fit (self)
+      self.SetScrollRate(self._uiDriver.cellWidth, self._uiDriver.cellHeight)
 
-    self.SetScrollRate (self._uiDriver.cellWidth, self._uiDriver.cellHeight)
-    self.SetSizer (self.pageSizer)
 
-
   # ---------------------------------------------------------------------------
   # Create the container widget for all the wrapped pages
   # ---------------------------------------------------------------------------
 
   def _createPageContainer (self):
 
-    return wx.Panel (self, -1)
+      return wx.Panel(self, -1)
 
 
   # ---------------------------------------------------------------------------
@@ -282,35 +294,32 @@
   # ---------------------------------------------------------------------------
 
   def createPage (self, gfPage):
-    """
-    Create a new page for the given GFPage instance and add it to the page
-    container.
+      """
+      Create a new page for the given GFPage instance and add it to the page
+      container.
 
-    @param gfPage: GFPage instance to create a page widget for
-    """
+      @param gfPage: GFPage instance to create a page widget for
+      """
 
-    fw = self._uiDriver._form._layout.Char__width  * self._uiDriver.cellWidth
-    fh = self._uiDriver._form._layout.Char__height * self._uiDriver.cellHeight
+      pg_sizer = wx.GridBagSizer()
+      pg_panel = wx.Panel(self.page_container, -1)
+      pg_panel.SetSizer(pg_sizer)
 
-    basePanel = wx.Panel (self.pageContainer, -1, size = (fw, fh))
+      if not self.pageCount():
+          self.page_sizer.Add(pg_panel, 1, wx.EXPAND)
 
-    # Since all pages will have the same size, it doesn't matter which page
-    # will be added to the sizer. But only add one page to the sizer !
-    if not self.pageCount:
-      self.pageSizer.Add (basePanel, 1, wx.EXPAND)
+      self._addToContainer (gfPage, pg_panel)
 
-    self._addToContainer (gfPage, basePanel)
+      return pg_panel
 
-    return basePanel
 
-
   # ---------------------------------------------------------------------------
   # Add a given page widget to the page container
   # ---------------------------------------------------------------------------
 
   def _addToContainer (self, gfPage, pageWidget):
 
-    self._pages.append (pageWidget)
+      self._pages.append(pageWidget)
 
 
   # ---------------------------------------------------------------------------
@@ -362,7 +371,7 @@
 
   def showPage (self, page):
 
-    self.pageContainer.SetSelection (page)
+    self.page_container.SetSelection (page)
     self.Refresh ()
 
 
@@ -385,15 +394,14 @@
 
   def _addToContainer (self, gfPage, pageWidget):
 
-    title = hasattr (gfPage, 'caption') and gfPage.caption or gfPage.name
-
-    self.pageContainer.SetEvtHandlerEnabled (False)
+    title = "%s" % (gfPage.caption or gfPage.name)
+    self.page_container.SetEvtHandlerEnabled (False)
     try:
-      self.pageContainer.AddPage (pageWidget, title, False)
+      self.page_container.AddPage (pageWidget, title, False)
       self._pages.append (pageWidget)
 
     finally:
-      self.pageContainer.SetEvtHandlerEnabled (True)
+      self.page_container.SetEvtHandlerEnabled (True)
 
 
   # ---------------------------------------------------------------------------
@@ -411,7 +419,7 @@
 # =============================================================================
 
 configuration = {
-  'baseClass': UIForm,
-  'provides' : 'GFForm',
-  'container': 1,
+    'baseClass': UIForm,
+    'provides' : 'GFForm',
+    'container': 1,
 }

Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/image.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/image.py        2006-06-20 
09:41:04 UTC (rev 8499)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/image.py        2006-06-20 
09:41:58 UTC (rev 8500)
@@ -49,13 +49,17 @@
     Creates a new StaticBitmap widget.
     """
 
-    pos  = (self.itemX, self.itemY)
-    size = (self.itemWidth, self.itemHeight)
+    parent = event.container
+    sizer  = self.getParent().container_sizer
 
-    self.imagePanel = wx.ScrolledWindow (event.container, wx.ID_ANY, pos, size)
+    csize = (-1, -1)
+    if not self._gfObject._form._layout.managed:
+        csize = (self._uiDriver.cellWidth * self.chr_w, -1)
+
+    self.imagePanel = wx.ScrolledWindow (parent, -1, size=csize)
     
-    newWidget = wx.StaticBitmap (self.imagePanel, wx.ID_ANY, wx.NullBitmap,
-        wx.DefaultPosition, wx.DefaultSize)
+    newWidget = wx.StaticBitmap (self.imagePanel, -1, wx.NullBitmap)
+    sizer.Add(self.imagePanel, self.chr_pos, self.chr_span, wx.EXPAND)
 
     return newWidget
 

Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/label.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/label.py        2006-06-20 
09:41:04 UTC (rev 8499)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/label.py        2006-06-20 
09:41:58 UTC (rev 8500)
@@ -42,23 +42,16 @@
 
   def _createWidget (self, event, spacer):
 
-    offs = (self._uiDriver.cellHeight - \
-            self._uiDriver.controlHeight.get ('label')) / 2
-    pos  = (self.itemX, self.itemY + offs)
     flags = self._ALIGNMENT [self._gfObject.alignment] | wx.ST_NO_AUTORESIZE
 
-    if self._gfObject.Char__height == 1:
-      if self._gfObject.alignment != 'left':
-        size = (self.itemWidth, -1)
-      else:
-        size  = (-1, -1)
-        flags = 0
-    else:
-      size = (self.itemWidth, self.itemHeight)
+    parent = event.container
+    sizer  = self.getParent().container_sizer
 
-    newWidget = wx.StaticText (event.container, wx.ID_ANY,
-          self._gfObject.text, pos, size, flags)
+    newWidget = wx.StaticText (parent, -1, self._gfObject.text, style=flags)
 
+    sizer.Add(newWidget, self.chr_pos, self.chr_span,
+          self._ALIGNMENT[self._gfObject.alignment] | wx.ALIGN_CENTER_VERTICAL)
+
     return newWidget
 
 

Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/menu.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/menu.py 2006-06-20 09:41:04 UTC 
(rev 8499)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/menu.py 2006-06-20 09:41:58 UTC 
(rev 8500)
@@ -47,7 +47,7 @@
         if self._gfObject.name == '__main__':
             # Menu bar of the form
             widget = wx.MenuBar()
-            self._uiForm.mainWindow.SetMenuBar(widget)
+            self._uiForm.main_window.SetMenuBar(widget)
         else:
             # Submenu or popup menu
             widget = wx.Menu()

Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/page.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/page.py 2006-06-20 09:41:04 UTC 
(rev 8499)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/page.py 2006-06-20 09:41:58 UTC 
(rev 8500)
@@ -38,6 +38,7 @@
 
     self._pageIndex = event.container.pageCount ()
     self._containerToolkitWidget = event.container.createPage (self._gfObject)
+    self.container_sizer = self._containerToolkitWidget.GetSizer()
     return self._containerToolkitWidget
 
 

Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/scrollbar.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/scrollbar.py    2006-06-20 
09:41:04 UTC (rev 8499)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/scrollbar.py    2006-06-20 
09:41:58 UTC (rev 8500)
@@ -37,16 +37,19 @@
 
   def _createWidget (self, event, spacer):
 
-    newWidget = self.widget = wx.ScrollBar (event.container, wx.ID_ANY,
-        (self.itemX, self.itemY), (-1, self.itemHeight), wx.SB_VERTICAL)
+      parent = event.container
+      sizer = self.getParent().container_sizer
 
-    (crec, recs, self.pageSize) = self._gfObject.get_record_and_page_count()
-    wx.EVT_COMMAND_SCROLL (newWidget, newWidget.GetId (), self.__scrollEvent)
-    self.do_adjust_scrollbar (crec, recs)
+      newWidget = self.widget = wx.ScrollBar (parent, -1, style=wx.SB_VERTICAL)
+      sizer.Add(newWidget, self.chr_pos, self.chr_span, wx.EXPAND)
 
-    return newWidget
+      (crec, recs, self.pageSize) = self._gfObject.get_record_and_page_count()
+      wx.EVT_COMMAND_SCROLL (newWidget, newWidget.GetId (), self.__scrollEvent)
+      self.do_adjust_scrollbar (crec, recs)
 
+      return newWidget
 
+
   # ---------------------------------------------------------------------------
   # adjust the scrollbar to a new position
   # ---------------------------------------------------------------------------

Added: trunk/gnue-forms/src/uidrivers/wx26/widgets/vbox.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/vbox.py 2006-06-20 09:41:04 UTC 
(rev 8499)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/vbox.py 2006-06-20 09:41:58 UTC 
(rev 8500)
@@ -0,0 +1,63 @@
+# GNU Enterprise Forms - wx 2.6 UI Driver - Box widget
+#
+# Copyright 2001-2006 Free Software Foundation
+#
+# This file is part of GNU Enterprise
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# $Id$
+
+import wx
+
+from gnue.forms.uidrivers.wx26.widgets import _base
+
+
+# =============================================================================
+# Interface implementation for a box widget
+# =============================================================================
+
+class UIVBox (_base.UIHelper):
+
+  # ---------------------------------------------------------------------------
+  # Create a wx box widget
+  # ---------------------------------------------------------------------------
+
+  def _createWidget (self, event, spacer):
+
+      parent = self.getParent()
+      if parent._type == 'UIPage':
+          pSizer = parent.pageSizer
+      else:
+          pSizer = parent.sizer
+      
+      self.sizer = wx.BoxSizer (wx.VERTICAL)
+      self._containerToolkitWidget = event.container
+      pSizer.Add(self.sizer, 1, wx.EXPAND)
+
+      return self.sizer
+
+
+
+# =============================================================================
+# Configuration data
+# =============================================================================
+
+configuration = {
+  'baseClass': UIVBox,
+  'provides' : 'GFVBox',
+  'container': 0
+}


Property changes on: trunk/gnue-forms/src/uidrivers/wx26/widgets/vbox.py
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Id





reply via email to

[Prev in Thread] Current Thread [Next in Thread]