parameters: (self, cont, dock, uiparts, spacer_only)
return_statement: return uiparts
docstring: Adds a dock into the existing layout.
  
          :param `cont`: a :class:`Sizer` object;
          :param `dock`: the :class:`AuiDockInfo` structure to add to the layout;
          :param `uiparts`: a list of UI parts in the interface;
          :param bool `spacer_only`: whether to add a simple spacer or a real window.
docstring_summary: Adds a dock into the existing layout.
docstring_tokens: Adds a dock into the existing layout .
function: def LayoutAddDock(self, cont, dock, uiparts, spacer_only):
          """
          Adds a dock into the existing layout.
  
          :param `cont`: a :class:`Sizer` object;
          :param `dock`: the :class:`AuiDockInfo` structure to add to the layout;
          :param `uiparts`: a list of UI parts in the interface;
          :param bool `spacer_only`: whether to add a simple spacer or a real window.
          """
  
          sizer_item = wx.SizerItem()
          part = AuiDockUIPart()
  
          sash_size = self._art.GetMetric(AUI_DOCKART_SASH_SIZE)
          orientation = (dock.IsHorizontal() and [wx.HORIZONTAL] or [wx.VERTICAL])[0]
  
          # resizable bottom and right docks have a sash before them
          if not self._has_maximized and not dock.fixed and \
             dock.dock_direction in [AUI_DOCK_BOTTOM, AUI_DOCK_RIGHT]:
  
              sizer_item = cont.Add((sash_size, sash_size), 0, wx.EXPAND)
  
              part.type = AuiDockUIPart.typeDockSizer
              part.orientation = orientation
              part.dock = dock
              part.pane = None
              part.button = None
              part.cont_sizer = cont
              part.sizer_item = sizer_item
              uiparts.append(part)
  
          # create the sizer for the dock
          dock_sizer = wx.BoxSizer(orientation)
  
          # add each pane to the dock
          has_maximized_pane = False
          pane_count = len(dock.panes)
  
          if dock.fixed:
  
              # figure out the real pane positions we will
              # use, without modifying the each pane's pane_pos member
              pane_positions, pane_sizes = self.GetPanePositionsAndSizes(dock)
  
              offset = 0
              for pane_i in xrange(pane_count):
  
                  pane = dock.panes[pane_i]
                  pane_pos = pane_positions[pane_i]
  
                  if pane.IsMaximized():
                      has_maximized_pane = True
  
                  amount = pane_pos - offset
                  if amount > 0:
  
                      if dock.IsVertical():
                          sizer_item = dock_sizer.Add((1, amount), 0, wx.EXPAND)
                      else:
                          sizer_item = dock_sizer.Add((amount, 1), 0, wx.EXPAND)
  
                      part = AuiDockUIPart()
                      part.type = AuiDockUIPart.typeBackground
                      part.dock = dock
                      part.pane = None
                      part.button = None
                      part.orientation = (orientation==wx.HORIZONTAL and \
                                          [wx.VERTICAL] or [wx.HORIZONTAL])[0]
                      part.cont_sizer = dock_sizer
                      part.sizer_item = sizer_item
                      uiparts.append(part)
  
                      offset = offset + amount
  
                  uiparts = self.LayoutAddPane(dock_sizer, dock, pane, uiparts, spacer_only)
  
                  offset = offset + pane_sizes[pane_i]
  
              # at the end add a very small stretchable background area
              sizer_item = dock_sizer.Add((0, 0), 1, wx.EXPAND)
              part = AuiDockUIPart()
              part.type = AuiDockUIPart.typeBackground
              part.dock = dock
              part.pane = None
              part.button = None
              part.orientation = orientation
              part.cont_sizer = dock_sizer
              part.sizer_item = sizer_item
              uiparts.append(part)
  
          else:
  
              for pane_i in xrange(pane_count):
  
                  pane = dock.panes[pane_i]
  
                  if pane.IsMaximized():
                      has_maximized_pane = True
  
                  # if this is not the first pane being added,
                  # we need to add a pane sizer
                  if not self._has_maximized and pane_i > 0:
                      sizer_item = dock_sizer.Add((sash_size, sash_size), 0, wx.EXPAND)
                      part = AuiDockUIPart()
                      part.type = AuiDockUIPart.typePaneSizer
                      part.dock = dock
                      part.pane = dock.panes[pane_i-1]
                      part.button = None
                      part.orientation = (orientation==wx.HORIZONTAL and \
                                          [wx.VERTICAL] or [wx.HORIZONTAL])[0]
                      part.cont_sizer = dock_sizer
                      part.sizer_item = sizer_item
                      uiparts.append(part)
  
                  uiparts = self.LayoutAddPane(dock_sizer, dock, pane, uiparts, spacer_only)
  
          if dock.dock_direction == AUI_DOCK_CENTER or has_maximized_pane:
              sizer_item = cont.Add(dock_sizer, 1, wx.EXPAND)
          else:
              sizer_item = cont.Add(dock_sizer, 0, wx.EXPAND)
  
          part = AuiDockUIPart()
          part.type = AuiDockUIPart.typeDock
          part.dock = dock
          part.pane = None
          part.button = None
          part.orientation = orientation
          part.cont_sizer = cont
          part.sizer_item = sizer_item
          uiparts.append(part)
  
          if dock.IsHorizontal():
              cont.SetItemMinSize(dock_sizer, (0, dock.size))
          else:
              cont.SetItemMinSize(dock_sizer, (dock.size, 0))
  
          #  top and left docks have a sash after them
          if not self._has_maximized and not dock.fixed and \
             dock.dock_direction in [AUI_DOCK_TOP, AUI_DOCK_LEFT]:
  
              sizer_item = cont.Add((sash_size, sash_size), 0, wx.EXPAND)
  
              part = AuiDockUIPart()
              part.type = AuiDockUIPart.typeDockSizer
              part.dock = dock
              part.pane = None
              part.button = None
              part.orientation = orientation
              part.cont_sizer = cont
              part.sizer_item = sizer_item
              uiparts.append(part)
  
          return uiparts
function_tokens: def LayoutAddDock ( self , cont , dock , uiparts , spacer_only ) : sizer_item = wx . SizerItem ( ) part = AuiDockUIPart ( ) sash_size = self . _art . GetMetric ( AUI_DOCKART_SASH_SIZE ) orientation = ( dock . IsHorizontal ( ) and [ wx . HORIZONTAL ] or [ wx . VERTICAL ] ) [ 0 ] # resizable bottom and right docks have a sash before them if not self . _has_maximized and not dock . fixed and dock . dock_direction in [ AUI_DOCK_BOTTOM , AUI_DOCK_RIGHT ] : sizer_item = cont . Add ( ( sash_size , sash_size ) , 0 , wx . EXPAND ) part . type = AuiDockUIPart . typeDockSizer part . orientation = orientation part . dock = dock part . pane = None part . button = None part . cont_sizer = cont part . sizer_item = sizer_item uiparts . append ( part ) # create the sizer for the dock dock_sizer = wx . BoxSizer ( orientation ) # add each pane to the dock has_maximized_pane = False pane_count = len ( dock . panes ) if dock . fixed : # figure out the real pane positions we will # use, without modifying the each pane's pane_pos member pane_positions , pane_sizes = self . GetPanePositionsAndSizes ( dock ) offset = 0 for pane_i in xrange ( pane_count ) : pane = dock . panes [ pane_i ] pane_pos = pane_positions [ pane_i ] if pane . IsMaximized ( ) : has_maximized_pane = True amount = pane_pos - offset if amount > 0 : if dock . IsVertical ( ) : sizer_item = dock_sizer . Add ( ( 1 , amount ) , 0 , wx . EXPAND ) else : sizer_item = dock_sizer . Add ( ( amount , 1 ) , 0 , wx . EXPAND ) part = AuiDockUIPart ( ) part . type = AuiDockUIPart . typeBackground part . dock = dock part . pane = None part . button = None part . orientation = ( orientation == wx . HORIZONTAL and [ wx . VERTICAL ] or [ wx . HORIZONTAL ] ) [ 0 ] part . cont_sizer = dock_sizer part . sizer_item = sizer_item uiparts . append ( part ) offset = offset + amount uiparts = self . LayoutAddPane ( dock_sizer , dock , pane , uiparts , spacer_only ) offset = offset + pane_sizes [ pane_i ] # at the end add a very small stretchable background area sizer_item = dock_sizer . Add ( ( 0 , 0 ) , 1 , wx . EXPAND ) part = AuiDockUIPart ( ) part . type = AuiDockUIPart . typeBackground part . dock = dock part . pane = None part . button = None part . orientation = orientation part . cont_sizer = dock_sizer part . sizer_item = sizer_item uiparts . append ( part ) else : for pane_i in xrange ( pane_count ) : pane = dock . panes [ pane_i ] if pane . IsMaximized ( ) : has_maximized_pane = True # if this is not the first pane being added, # we need to add a pane sizer if not self . _has_maximized and pane_i > 0 : sizer_item = dock_sizer . Add ( ( sash_size , sash_size ) , 0 , wx . EXPAND ) part = AuiDockUIPart ( ) part . type = AuiDockUIPart . typePaneSizer part . dock = dock part . pane = dock . panes [ pane_i - 1 ] part . button = None part . orientation = ( orientation == wx . HORIZONTAL and [ wx . VERTICAL ] or [ wx . HORIZONTAL ] ) [ 0 ] part . cont_sizer = dock_sizer part . sizer_item = sizer_item uiparts . append ( part ) uiparts = self . LayoutAddPane ( dock_sizer , dock , pane , uiparts , spacer_only ) if dock . dock_direction == AUI_DOCK_CENTER or has_maximized_pane : sizer_item = cont . Add ( dock_sizer , 1 , wx . EXPAND ) else : sizer_item = cont . Add ( dock_sizer , 0 , wx . EXPAND ) part = AuiDockUIPart ( ) part . type = AuiDockUIPart . typeDock part . dock = dock part . pane = None part . button = None part . orientation = orientation part . cont_sizer = cont part . sizer_item = sizer_item uiparts . append ( part ) if dock . IsHorizontal ( ) : cont . SetItemMinSize ( dock_sizer , ( 0 , dock . size ) ) else : cont . SetItemMinSize ( dock_sizer , ( dock . size , 0 ) ) #  top and left docks have a sash after them if not self . _has_maximized and not dock . fixed and dock . dock_direction in [ AUI_DOCK_TOP , AUI_DOCK_LEFT ] : sizer_item = cont . Add ( ( sash_size , sash_size ) , 0 , wx . EXPAND ) part = AuiDockUIPart ( ) part . type = AuiDockUIPart . typeDockSizer part . dock = dock part . pane = None part . button = None part . orientation = orientation part . cont_sizer = cont part . sizer_item = sizer_item uiparts . append ( part ) return uiparts