parameters: (self, raw_dc, wnd)
docstring: Renders the tab catalog to the specified :class:`DC`.
  
          It is a virtual function and can be overridden to provide custom drawing
          capabilities.
  
          :param `raw_dc`: a :class:`DC` device context;
          :param `wnd`: an instance of :class:`Window`.
docstring_summary: Renders the tab catalog to the specified :class:`DC`.
docstring_tokens: Renders the tab catalog to the specified : class : DC .
function: def Render(self, raw_dc, wnd):
          """
          Renders the tab catalog to the specified :class:`DC`.
  
          It is a virtual function and can be overridden to provide custom drawing
          capabilities.
  
          :param `raw_dc`: a :class:`DC` device context;
          :param `wnd`: an instance of :class:`Window`.
          """
  
          if not raw_dc or not raw_dc.IsOk():
              return
  
          dc = wx.MemoryDC()
  
          # use the same layout direction as the window DC uses to ensure that the
          # text is rendered correctly
          dc.SetLayoutDirection(raw_dc.GetLayoutDirection())
  
          page_count = len(self._pages)
          button_count = len(self._buttons)
  
          # create off-screen bitmap
          bmp = wx.EmptyBitmap(self._rect.GetWidth(), self._rect.GetHeight())
          dc.SelectObject(bmp)
  
          if not dc.IsOk():
              return
  
          # prepare the tab-close-button array
          # make sure tab button entries which aren't used are marked as hidden
          for i in xrange(page_count, len(self._tab_close_buttons)):
              self._tab_close_buttons[i].cur_state = AUI_BUTTON_STATE_HIDDEN
  
          # make sure there are enough tab button entries to accommodate all tabs
          while len(self._tab_close_buttons) < page_count:
              tempbtn = AuiTabContainerButton()
              tempbtn.id = AUI_BUTTON_CLOSE
              tempbtn.location = wx.CENTER
              tempbtn.cur_state = AUI_BUTTON_STATE_HIDDEN
              self._tab_close_buttons.append(tempbtn)
  
          # find out if size of tabs is larger than can be
          # afforded on screen
          total_width = visible_width = 0
          tab_width = [0] * page_count
  
          for i in xrange(page_count):
              page = self._pages[i]
  
              # determine if a close button is on this tab
              close_button = False
              if (self._agwFlags & AUI_NB_CLOSE_ON_ALL_TABS and page.hasCloseButton) or \
                 (self._agwFlags & AUI_NB_CLOSE_ON_ACTIVE_TAB and page.active and page.hasCloseButton):
  
                  close_button = True
  
              control = page.control
              if control:
                  try:
                      control.GetSize()
                  except wx.PyDeadObjectError:
                      page.control = None
  
              size, x_extent = self._art.GetTabSize(dc, wnd, page.caption, page.bitmap, page.active,
                                                    (close_button and [AUI_BUTTON_STATE_NORMAL] or \
                                                     [AUI_BUTTON_STATE_HIDDEN])[0], page.control)
  
              if i+1 < page_count:
                  total_width += x_extent
                  tab_width[i] = x_extent
              else:
                  total_width += size[0]
                  tab_width[i] = size[0]
  
              if i >= self._tab_offset:
                  if i+1 < page_count:
                      visible_width += x_extent
                  else:
                      visible_width += size[0]
  
          # Calculate the width of visible buttons
          buttons_width = 0
  
          for button in self._buttons:
              if not (button.cur_state & AUI_BUTTON_STATE_HIDDEN):
                  buttons_width += button.rect.GetWidth()
  
          total_width += buttons_width
  
          if (total_width > self._rect.GetWidth() and page_count > 1) or self._tab_offset != 0:
  
              # show left/right buttons
              for button in self._buttons:
                  if button.id == AUI_BUTTON_LEFT or \
                     button.id == AUI_BUTTON_RIGHT:
  
                      button.cur_state &= ~AUI_BUTTON_STATE_HIDDEN
  
          else:
  
              # hide left/right buttons
              for button in self._buttons:
                  if button.id == AUI_BUTTON_LEFT or \
                     button.id == AUI_BUTTON_RIGHT:
  
                      button.cur_state |= AUI_BUTTON_STATE_HIDDEN
  
          # Re-calculate the width of visible buttons (may have been hidden/shown)
          buttons_width = 0
          for button in self._buttons:
              if not (button.cur_state & AUI_BUTTON_STATE_HIDDEN):
                  buttons_width += button.rect.GetWidth()
  
          # Shift the tab offset down to make use of available space
          available_width = self._rect.GetWidth() - buttons_width
          while self._tab_offset > 0 and visible_width + tab_width[self._tab_offset - 1] < available_width:
              self._tab_offset -= 1
              visible_width += tab_width[self._tab_offset]
  
          # determine whether left button should be enabled
          for button in self._buttons:
              if button.id == AUI_BUTTON_LEFT:
                  if self._tab_offset == 0:
                      button.cur_state |= AUI_BUTTON_STATE_DISABLED
                  else:
                      button.cur_state &= ~AUI_BUTTON_STATE_DISABLED
  
              if button.id == AUI_BUTTON_RIGHT:
                  if visible_width < self._rect.GetWidth() - buttons_width:
                      button.cur_state |= AUI_BUTTON_STATE_DISABLED
                  else:
                      button.cur_state &= ~AUI_BUTTON_STATE_DISABLED
  
          # draw background
          self._art.DrawBackground(dc, wnd, self._rect)
  
          # draw buttons
          left_buttons_width = 0
          right_buttons_width = 0
  
          # draw the buttons on the right side
          offset = self._rect.x + self._rect.width
  
          for i in xrange(button_count):
              button = self._buttons[button_count - i - 1]
  
              if button.location != wx.RIGHT:
                  continue
              if button.cur_state & AUI_BUTTON_STATE_HIDDEN:
                  continue
  
              button_rect = wx.Rect(*self._rect)
              button_rect.SetY(1)
              button_rect.SetWidth(offset)
  
              button.rect = self._art.DrawButton(dc, wnd, button_rect, button, wx.RIGHT)
  
              offset -= button.rect.GetWidth()
              right_buttons_width += button.rect.GetWidth()
  
          offset = 0
  
          # draw the buttons on the left side
          for i in xrange(button_count):
              button = self._buttons[button_count - i - 1]
  
              if button.location != wx.LEFT:
                  continue
              if button.cur_state & AUI_BUTTON_STATE_HIDDEN:
                  continue
  
              button_rect = wx.Rect(offset, 1, 1000, self._rect.height)
  
              button.rect = self._art.DrawButton(dc, wnd, button_rect, button, wx.LEFT)
  
              offset += button.rect.GetWidth()
              left_buttons_width += button.rect.GetWidth()
  
          if offset == 0:
              offset += self._art.GetIndentSize()
  
          # buttons before the tab offset must be set to hidden
          for i in xrange(self._tab_offset):
              self._tab_close_buttons[i].cur_state = AUI_BUTTON_STATE_HIDDEN
              if self._pages[i].control:
                  if self._pages[i].control.IsShown():
                      self._pages[i].control.Hide()
  
          # draw tab before tab offset
          if self._tab_offset > 0:
              page = self._pages[self._tab_offset - 1]
              tab_button = self._tab_close_buttons[self._tab_offset - 1]
              size, x_extent = self._art.GetTabSize(dc, wnd, page.caption, page.bitmap, page.active, tab_button.cur_state, page.control)
  
              rect = wx.Rect(offset - x_extent, 0, self._rect.width - right_buttons_width - offset - x_extent - 2, self._rect.height)
              clip_rect = wx.Rect(*self._rect)
              clip_rect.x = offset
  
              dc.SetClippingRect(clip_rect)
              self._art.DrawTab(dc, wnd, page, rect, tab_button.cur_state)
              dc.DestroyClippingRegion()
  
          # draw the tabs
          active = 999
          active_offset = 0
  
          rect = wx.Rect(*self._rect)
          rect.y = 0
          rect.height = self._rect.height
  
          for i in xrange(self._tab_offset, page_count):
  
              page = self._pages[i]
              tab_button = self._tab_close_buttons[i]
  
              # determine if a close button is on this tab
              if (self._agwFlags & AUI_NB_CLOSE_ON_ALL_TABS and page.hasCloseButton) or \
                 (self._agwFlags & AUI_NB_CLOSE_ON_ACTIVE_TAB and page.active and page.hasCloseButton):
  
                  if tab_button.cur_state == AUI_BUTTON_STATE_HIDDEN:
  
                      tab_button.id = AUI_BUTTON_CLOSE
                      tab_button.cur_state = AUI_BUTTON_STATE_NORMAL
                      tab_button.location = wx.CENTER
  
              else:
  
                  tab_button.cur_state = AUI_BUTTON_STATE_HIDDEN
  
              rect.x = offset
              rect.width = self._rect.width - right_buttons_width - offset - 2
  
              if rect.width <= 0:
                  break
  
              page.rect, tab_button.rect, x_extent = self._art.DrawTab(dc, wnd, page, rect, tab_button.cur_state)
  
              if page.active:
                  active = i
                  active_offset = offset
                  active_rect = wx.Rect(*rect)
  
              offset += x_extent
  
          lenPages = len(self._pages)
          # make sure to deactivate buttons which are off the screen to the right
          for j in xrange(i+1, len(self._tab_close_buttons)):
              self._tab_close_buttons[j].cur_state = AUI_BUTTON_STATE_HIDDEN
              if j > 0 and j <= lenPages:
                  if self._pages[j-1].control:
                      if self._pages[j-1].control.IsShown():
                          self._pages[j-1].control.Hide()
  
          # draw the active tab again so it stands in the foreground
          if active >= self._tab_offset and active < len(self._pages):
  
              page = self._pages[active]
              tab_button = self._tab_close_buttons[active]
  
              rect.x = active_offset
              dummy = self._art.DrawTab(dc, wnd, page, active_rect, tab_button.cur_state)
  
          raw_dc.Blit(self._rect.x, self._rect.y, self._rect.GetWidth(), self._rect.GetHeight(), dc, 0, 0)
function_tokens: def Render ( self , raw_dc , wnd ) : if not raw_dc or not raw_dc . IsOk ( ) : return dc = wx . MemoryDC ( ) # use the same layout direction as the window DC uses to ensure that the # text is rendered correctly dc . SetLayoutDirection ( raw_dc . GetLayoutDirection ( ) ) page_count = len ( self . _pages ) button_count = len ( self . _buttons ) # create off-screen bitmap bmp = wx . EmptyBitmap ( self . _rect . GetWidth ( ) , self . _rect . GetHeight ( ) ) dc . SelectObject ( bmp ) if not dc . IsOk ( ) : return # prepare the tab-close-button array # make sure tab button entries which aren't used are marked as hidden for i in xrange ( page_count , len ( self . _tab_close_buttons ) ) : self . _tab_close_buttons [ i ] . cur_state = AUI_BUTTON_STATE_HIDDEN # make sure there are enough tab button entries to accommodate all tabs while len ( self . _tab_close_buttons ) < page_count : tempbtn = AuiTabContainerButton ( ) tempbtn . id = AUI_BUTTON_CLOSE tempbtn . location = wx . CENTER tempbtn . cur_state = AUI_BUTTON_STATE_HIDDEN self . _tab_close_buttons . append ( tempbtn ) # find out if size of tabs is larger than can be # afforded on screen total_width = visible_width = 0 tab_width = [ 0 ] * page_count for i in xrange ( page_count ) : page = self . _pages [ i ] # determine if a close button is on this tab close_button = False if ( self . _agwFlags & AUI_NB_CLOSE_ON_ALL_TABS and page . hasCloseButton ) or ( self . _agwFlags & AUI_NB_CLOSE_ON_ACTIVE_TAB and page . active and page . hasCloseButton ) : close_button = True control = page . control if control : try : control . GetSize ( ) except wx . PyDeadObjectError : page . control = None size , x_extent = self . _art . GetTabSize ( dc , wnd , page . caption , page . bitmap , page . active , ( close_button and [ AUI_BUTTON_STATE_NORMAL ] or [ AUI_BUTTON_STATE_HIDDEN ] ) [ 0 ] , page . control ) if i + 1 < page_count : total_width += x_extent tab_width [ i ] = x_extent else : total_width += size [ 0 ] tab_width [ i ] = size [ 0 ] if i >= self . _tab_offset : if i + 1 < page_count : visible_width += x_extent else : visible_width += size [ 0 ] # Calculate the width of visible buttons buttons_width = 0 for button in self . _buttons : if not ( button . cur_state & AUI_BUTTON_STATE_HIDDEN ) : buttons_width += button . rect . GetWidth ( ) total_width += buttons_width if ( total_width > self . _rect . GetWidth ( ) and page_count > 1 ) or self . _tab_offset != 0 : # show left/right buttons for button in self . _buttons : if button . id == AUI_BUTTON_LEFT or button . id == AUI_BUTTON_RIGHT : button . cur_state &= ~ AUI_BUTTON_STATE_HIDDEN else : # hide left/right buttons for button in self . _buttons : if button . id == AUI_BUTTON_LEFT or button . id == AUI_BUTTON_RIGHT : button . cur_state |= AUI_BUTTON_STATE_HIDDEN # Re-calculate the width of visible buttons (may have been hidden/shown) buttons_width = 0 for button in self . _buttons : if not ( button . cur_state & AUI_BUTTON_STATE_HIDDEN ) : buttons_width += button . rect . GetWidth ( ) # Shift the tab offset down to make use of available space available_width = self . _rect . GetWidth ( ) - buttons_width while self . _tab_offset > 0 and visible_width + tab_width [ self . _tab_offset - 1 ] < available_width : self . _tab_offset -= 1 visible_width += tab_width [ self . _tab_offset ] # determine whether left button should be enabled for button in self . _buttons : if button . id == AUI_BUTTON_LEFT : if self . _tab_offset == 0 : button . cur_state |= AUI_BUTTON_STATE_DISABLED else : button . cur_state &= ~ AUI_BUTTON_STATE_DISABLED if button . id == AUI_BUTTON_RIGHT : if visible_width < self . _rect . GetWidth ( ) - buttons_width : button . cur_state |= AUI_BUTTON_STATE_DISABLED else : button . cur_state &= ~ AUI_BUTTON_STATE_DISABLED # draw background self . _art . DrawBackground ( dc , wnd , self . _rect ) # draw buttons left_buttons_width = 0 right_buttons_width = 0 # draw the buttons on the right side offset = self . _rect . x + self . _rect . width for i in xrange ( button_count ) : button = self . _buttons [ button_count - i - 1 ] if button . location != wx . RIGHT : continue if button . cur_state & AUI_BUTTON_STATE_HIDDEN : continue button_rect = wx . Rect ( * self . _rect ) button_rect . SetY ( 1 ) button_rect . SetWidth ( offset ) button . rect = self . _art . DrawButton ( dc , wnd , button_rect , button , wx . RIGHT ) offset -= button . rect . GetWidth ( ) right_buttons_width += button . rect . GetWidth ( ) offset = 0 # draw the buttons on the left side for i in xrange ( button_count ) : button = self . _buttons [ button_count - i - 1 ] if button . location != wx . LEFT : continue if button . cur_state & AUI_BUTTON_STATE_HIDDEN : continue button_rect = wx . Rect ( offset , 1 , 1000 , self . _rect . height ) button . rect = self . _art . DrawButton ( dc , wnd , button_rect , button , wx . LEFT ) offset += button . rect . GetWidth ( ) left_buttons_width += button . rect . GetWidth ( ) if offset == 0 : offset += self . _art . GetIndentSize ( ) # buttons before the tab offset must be set to hidden for i in xrange ( self . _tab_offset ) : self . _tab_close_buttons [ i ] . cur_state = AUI_BUTTON_STATE_HIDDEN if self . _pages [ i ] . control : if self . _pages [ i ] . control . IsShown ( ) : self . _pages [ i ] . control . Hide ( ) # draw tab before tab offset if self . _tab_offset > 0 : page = self . _pages [ self . _tab_offset - 1 ] tab_button = self . _tab_close_buttons [ self . _tab_offset - 1 ] size , x_extent = self . _art . GetTabSize ( dc , wnd , page . caption , page . bitmap , page . active , tab_button . cur_state , page . control ) rect = wx . Rect ( offset - x_extent , 0 , self . _rect . width - right_buttons_width - offset - x_extent - 2 , self . _rect . height ) clip_rect = wx . Rect ( * self . _rect ) clip_rect . x = offset dc . SetClippingRect ( clip_rect ) self . _art . DrawTab ( dc , wnd , page , rect , tab_button . cur_state ) dc . DestroyClippingRegion ( ) # draw the tabs active = 999 active_offset = 0 rect = wx . Rect ( * self . _rect ) rect . y = 0 rect . height = self . _rect . height for i in xrange ( self . _tab_offset , page_count ) : page = self . _pages [ i ] tab_button = self . _tab_close_buttons [ i ] # determine if a close button is on this tab if ( self . _agwFlags & AUI_NB_CLOSE_ON_ALL_TABS and page . hasCloseButton ) or ( self . _agwFlags & AUI_NB_CLOSE_ON_ACTIVE_TAB and page . active and page . hasCloseButton ) : if tab_button . cur_state == AUI_BUTTON_STATE_HIDDEN : tab_button . id = AUI_BUTTON_CLOSE tab_button . cur_state = AUI_BUTTON_STATE_NORMAL tab_button . location = wx . CENTER else : tab_button . cur_state = AUI_BUTTON_STATE_HIDDEN rect . x = offset rect . width = self . _rect . width - right_buttons_width - offset - 2 if rect . width <= 0 : break page . rect , tab_button . rect , x_extent = self . _art . DrawTab ( dc , wnd , page , rect , tab_button . cur_state ) if page . active : active = i active_offset = offset active_rect = wx . Rect ( * rect ) offset += x_extent lenPages = len ( self . _pages ) # make sure to deactivate buttons which are off the screen to the right for j in xrange ( i + 1 , len ( self . _tab_close_buttons ) ) : self . _tab_close_buttons [ j ] . cur_state = AUI_BUTTON_STATE_HIDDEN if j > 0 and j <= lenPages : if self . _pages [ j - 1 ] . control : if self . _pages [ j - 1 ] . control . IsShown ( ) : self . _pages [ j - 1 ] . control . Hide ( ) # draw the active tab again so it stands in the foreground if active >= self . _tab_offset and active < len ( self . _pages ) : page = self . _pages [ active ] tab_button = self . _tab_close_buttons [ active ] rect . x = active_offset dummy = self . _art . DrawTab ( dc , wnd , page , active_rect , tab_button . cur_state ) raw_dc . Blit ( self . _rect . x , self . _rect . y , self . _rect . GetWidth ( ) , self . _rect . GetHeight ( ) , dc , 0 , 0 )