parameters: (self, dc, wnd, page, in_rect, close_button_state, paint_control=False)
return_statement: return out_tab_rect, out_button_rect, x_extent
docstring: Draws a single tab.
  
          :param `dc`: a :class:`DC` device context;
          :param `wnd`: a :class:`Window` instance object;
          :param `page`: the tab control page associated with the tab;
          :param Rect `in_rect`: rectangle the tab should be confined to;
          :param integer `close_button_state`: the state of the close button on the tab;
          :param bool `paint_control`: whether to draw the control inside a tab (if any) on a :class:`MemoryDC`.
docstring_summary: Draws a single tab.
docstring_tokens: Draws a single tab .
function: def DrawTab(self, dc, wnd, page, in_rect, close_button_state, paint_control=False):
          """
          Draws a single tab.
  
          :param `dc`: a :class:`DC` device context;
          :param `wnd`: a :class:`Window` instance object;
          :param `page`: the tab control page associated with the tab;
          :param Rect `in_rect`: rectangle the tab should be confined to;
          :param integer `close_button_state`: the state of the close button on the tab;
          :param bool `paint_control`: whether to draw the control inside a tab (if any) on a :class:`MemoryDC`.
          """
          
          # Visual Studio 8 style
  
          control = page.control
  
          # figure out the size of the tab
          tab_size, x_extent = self.GetTabSize(dc, wnd, page.caption, page.bitmap,
                                               page.active, close_button_state, control)
  
          tab_height = self._tab_ctrl_height - 1
          tab_width = tab_size[0]
          tab_x = in_rect.x
          tab_y = in_rect.y + in_rect.height - tab_height
  
          clip_width = tab_width + 3
          if tab_x + clip_width > in_rect.x + in_rect.width - 4:
              clip_width = (in_rect.x + in_rect.width) - tab_x - 4
          
          tabPoints = [wx.Point() for i in xrange(8)]
  
          # If we draw the first tab or the active tab, 
          # we draw a full tab, else we draw a truncated tab
          #
          #             X(2)                  X(3)
          #        X(1)                            X(4)
          #                                          
          #                                           X(5)
          #                                           
          # X(0),(7)                                  X(6)
          #
          #
  
          adjust = 0
          if not page.active:
              adjust = 1
  
          agwFlags = self.GetAGWFlags()
          tabPoints[0].x = (agwFlags & AUI_NB_BOTTOM and [tab_x] or [tab_x + adjust])[0]
          tabPoints[0].y = (agwFlags & AUI_NB_BOTTOM and [2] or [tab_height - 3])[0]
  
          tabPoints[1].x = tabPoints[0].x + tab_height - vertical_border_padding - 3 - adjust
          tabPoints[1].y = (agwFlags & AUI_NB_BOTTOM and [tab_height - (vertical_border_padding+2)] or \
                            [(vertical_border_padding+2)])[0]
  
          tabPoints[2].x = tabPoints[1].x + 4
          tabPoints[2].y = (agwFlags & AUI_NB_BOTTOM and [tab_height - vertical_border_padding] or \
                            [vertical_border_padding])[0]
  
          tabPoints[3].x = tabPoints[2].x + tab_width - tab_height + vertical_border_padding
          tabPoints[3].y = (agwFlags & AUI_NB_BOTTOM and [tab_height - vertical_border_padding] or \
                            [vertical_border_padding])[0]
  
          tabPoints[4].x = tabPoints[3].x + 1
          tabPoints[4].y = (agwFlags & AUI_NB_BOTTOM and [tabPoints[3].y - 1] or [tabPoints[3].y + 1])[0]
  
          tabPoints[5].x = tabPoints[4].x + 1
          tabPoints[5].y = (agwFlags & AUI_NB_BOTTOM and [(tabPoints[4].y - 1)] or [tabPoints[4].y + 1])[0]
  
          tabPoints[6].x = tabPoints[2].x + tab_width - tab_height + 2 + vertical_border_padding
          tabPoints[6].y = tabPoints[0].y
  
          tabPoints[7].x = tabPoints[0].x
          tabPoints[7].y = tabPoints[0].y
  
          self.FillVC8GradientColour(dc, tabPoints, page.active)        
  
          dc.SetBrush(wx.TRANSPARENT_BRUSH)
  
          dc.SetPen(wx.Pen(wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNSHADOW)))
          dc.DrawPolygon(tabPoints)
  
          if page.active:
              # Delete the bottom line (or the upper one, incase we use wxBOTTOM) 
              dc.SetPen(wx.WHITE_PEN)
              dc.DrawLine(tabPoints[0].x, tabPoints[0].y, tabPoints[6].x, tabPoints[6].y)
  
          dc.SetClippingRegion(tab_x, tab_y, clip_width + 2, tab_height - 3)            
  
          drawn_tab_yoff = tabPoints[1].y
          drawn_tab_height = tabPoints[0].y - tabPoints[2].y
  
          text_offset = tab_x + 20
          close_button_width = 0
          if close_button_state != AUI_BUTTON_STATE_HIDDEN:
              close_button_width = self._active_close_bmp.GetWidth()
              if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT:
                  text_offset += close_button_width
  
          if not page.enabled:
              dc.SetTextForeground(wx.SystemSettings.GetColour(wx.SYS_COLOUR_GRAYTEXT))
              pagebitmap = page.dis_bitmap
          else:
              dc.SetTextForeground(page.text_colour)
              pagebitmap = page.bitmap
  
          shift = 0
          if agwFlags & AUI_NB_BOTTOM:
              shift = (page.active and [1] or [2])[0]
          
          bitmap_offset = 0
          if pagebitmap.IsOk():
              bitmap_offset = tab_x + 20
              if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT and close_button_width:
                  bitmap_offset += close_button_width
  
              # draw bitmap
              dc.DrawBitmap(pagebitmap, bitmap_offset,
                            drawn_tab_yoff + (drawn_tab_height/2) - (pagebitmap.GetHeight()/2) + shift,
                            True)
  
              text_offset = bitmap_offset + pagebitmap.GetWidth()
              text_offset += 3 # bitmap padding
          
          else:
              if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT == 0 or not close_button_width:
                  text_offset = tab_x + tab_height
          
          # if the caption is empty, measure some temporary text
          caption = page.caption
          if caption == "":
              caption = "Xj"
  
          if page.active:
              dc.SetFont(self._selected_font)
              textx, texty, dummy = dc.GetMultiLineTextExtent(caption)
          else:
              dc.SetFont(self._normal_font)
              textx, texty, dummy = dc.GetMultiLineTextExtent(caption)
  
          if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT:
              draw_text = ChopText(dc, caption, tab_width - (text_offset-tab_x))
          else:
              draw_text = ChopText(dc, caption, tab_width - (text_offset-tab_x) - close_button_width)
  
          ypos = drawn_tab_yoff + drawn_tab_height/2 - texty/2 - 1 + shift
  
          offset_focus = text_offset
          
          if control is not None:
              try:
                  if control.GetPosition() != wx.Point(text_offset+1, ypos):
                      control.SetPosition(wx.Point(text_offset+1, ypos))
  
                  if not control.IsShown():
                      control.Show()
  
                  if paint_control:
                      bmp = TakeScreenShot(control.GetScreenRect())
                      dc.DrawBitmap(bmp, text_offset+1, ypos, True)
                      
                  controlW, controlH = control.GetSize()
                  text_offset += controlW + 4
                  textx += controlW + 4
              except wx.PyDeadObjectError:
                  pass
  
          # draw tab text
          rectx, recty, dummy = dc.GetMultiLineTextExtent(draw_text)
          dc.DrawLabel(draw_text, wx.Rect(text_offset, ypos, rectx, recty))
          
          # draw focus rectangle
          if (agwFlags & AUI_NB_NO_TAB_FOCUS) == 0:
              self.DrawFocusRectangle(dc, page, wnd, draw_text, offset_focus, bitmap_offset, drawn_tab_yoff+shift,
                                      drawn_tab_height+shift, rectx, recty)
          
          out_button_rect = wx.Rect()
          # draw 'x' on tab (if enabled)
          if close_button_state != AUI_BUTTON_STATE_HIDDEN:
          
              close_button_width = self._active_close_bmp.GetWidth()
              bmp = self._disabled_close_bmp
  
              if close_button_state == AUI_BUTTON_STATE_HOVER:
                  bmp = self._hover_close_bmp
              elif close_button_state == AUI_BUTTON_STATE_PRESSED:
                  bmp = self._pressed_close_bmp
                  
              if page.active:
                  xpos = tab_x + tab_width - close_button_width + 3
              else:
                  xpos = tab_x + tab_width - close_button_width - 5
  
              if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT:
                  rect = wx.Rect(tab_x + 20,
                                 drawn_tab_yoff + (drawn_tab_height / 2) - (bmp.GetHeight() / 2) + shift,
                                 close_button_width, tab_height)
              else:
                  rect = wx.Rect(xpos,
                                 drawn_tab_yoff + (drawn_tab_height / 2) - (bmp.GetHeight() / 2) + shift,
                                 close_button_width, tab_height)
  
              # Indent the button if it is pressed down:
              rect = IndentPressedBitmap(rect, close_button_state)
              dc.DrawBitmap(bmp, rect.x, rect.y, True)
              out_button_rect = rect
          
          out_tab_rect = wx.Rect(tab_x, tab_y, x_extent, tab_height)
          dc.DestroyClippingRegion()
  
          return out_tab_rect, out_button_rect, x_extent
function_tokens: def DrawTab ( self , dc , wnd , page , in_rect , close_button_state , paint_control = False ) : # Visual Studio 8 style control = page . control # figure out the size of the tab tab_size , x_extent = self . GetTabSize ( dc , wnd , page . caption , page . bitmap , page . active , close_button_state , control ) tab_height = self . _tab_ctrl_height - 1 tab_width = tab_size [ 0 ] tab_x = in_rect . x tab_y = in_rect . y + in_rect . height - tab_height clip_width = tab_width + 3 if tab_x + clip_width > in_rect . x + in_rect . width - 4 : clip_width = ( in_rect . x + in_rect . width ) - tab_x - 4 tabPoints = [ wx . Point ( ) for i in xrange ( 8 ) ] # If we draw the first tab or the active tab,  # we draw a full tab, else we draw a truncated tab # #             X(2)                  X(3) #        X(1)                            X(4) #                                           #                                           X(5) #                                            # X(0),(7)                                  X(6) # # adjust = 0 if not page . active : adjust = 1 agwFlags = self . GetAGWFlags ( ) tabPoints [ 0 ] . x = ( agwFlags & AUI_NB_BOTTOM and [ tab_x ] or [ tab_x + adjust ] ) [ 0 ] tabPoints [ 0 ] . y = ( agwFlags & AUI_NB_BOTTOM and [ 2 ] or [ tab_height - 3 ] ) [ 0 ] tabPoints [ 1 ] . x = tabPoints [ 0 ] . x + tab_height - vertical_border_padding - 3 - adjust tabPoints [ 1 ] . y = ( agwFlags & AUI_NB_BOTTOM and [ tab_height - ( vertical_border_padding + 2 ) ] or [ ( vertical_border_padding + 2 ) ] ) [ 0 ] tabPoints [ 2 ] . x = tabPoints [ 1 ] . x + 4 tabPoints [ 2 ] . y = ( agwFlags & AUI_NB_BOTTOM and [ tab_height - vertical_border_padding ] or [ vertical_border_padding ] ) [ 0 ] tabPoints [ 3 ] . x = tabPoints [ 2 ] . x + tab_width - tab_height + vertical_border_padding tabPoints [ 3 ] . y = ( agwFlags & AUI_NB_BOTTOM and [ tab_height - vertical_border_padding ] or [ vertical_border_padding ] ) [ 0 ] tabPoints [ 4 ] . x = tabPoints [ 3 ] . x + 1 tabPoints [ 4 ] . y = ( agwFlags & AUI_NB_BOTTOM and [ tabPoints [ 3 ] . y - 1 ] or [ tabPoints [ 3 ] . y + 1 ] ) [ 0 ] tabPoints [ 5 ] . x = tabPoints [ 4 ] . x + 1 tabPoints [ 5 ] . y = ( agwFlags & AUI_NB_BOTTOM and [ ( tabPoints [ 4 ] . y - 1 ) ] or [ tabPoints [ 4 ] . y + 1 ] ) [ 0 ] tabPoints [ 6 ] . x = tabPoints [ 2 ] . x + tab_width - tab_height + 2 + vertical_border_padding tabPoints [ 6 ] . y = tabPoints [ 0 ] . y tabPoints [ 7 ] . x = tabPoints [ 0 ] . x tabPoints [ 7 ] . y = tabPoints [ 0 ] . y self . FillVC8GradientColour ( dc , tabPoints , page . active ) dc . SetBrush ( wx . TRANSPARENT_BRUSH ) dc . SetPen ( wx . Pen ( wx . SystemSettings . GetColour ( wx . SYS_COLOUR_BTNSHADOW ) ) ) dc . DrawPolygon ( tabPoints ) if page . active : # Delete the bottom line (or the upper one, incase we use wxBOTTOM)  dc . SetPen ( wx . WHITE_PEN ) dc . DrawLine ( tabPoints [ 0 ] . x , tabPoints [ 0 ] . y , tabPoints [ 6 ] . x , tabPoints [ 6 ] . y ) dc . SetClippingRegion ( tab_x , tab_y , clip_width + 2 , tab_height - 3 ) drawn_tab_yoff = tabPoints [ 1 ] . y drawn_tab_height = tabPoints [ 0 ] . y - tabPoints [ 2 ] . y text_offset = tab_x + 20 close_button_width = 0 if close_button_state != AUI_BUTTON_STATE_HIDDEN : close_button_width = self . _active_close_bmp . GetWidth ( ) if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT : text_offset += close_button_width if not page . enabled : dc . SetTextForeground ( wx . SystemSettings . GetColour ( wx . SYS_COLOUR_GRAYTEXT ) ) pagebitmap = page . dis_bitmap else : dc . SetTextForeground ( page . text_colour ) pagebitmap = page . bitmap shift = 0 if agwFlags & AUI_NB_BOTTOM : shift = ( page . active and [ 1 ] or [ 2 ] ) [ 0 ] bitmap_offset = 0 if pagebitmap . IsOk ( ) : bitmap_offset = tab_x + 20 if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT and close_button_width : bitmap_offset += close_button_width # draw bitmap dc . DrawBitmap ( pagebitmap , bitmap_offset , drawn_tab_yoff + ( drawn_tab_height / 2 ) - ( pagebitmap . GetHeight ( ) / 2 ) + shift , True ) text_offset = bitmap_offset + pagebitmap . GetWidth ( ) text_offset += 3 # bitmap padding else : if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT == 0 or not close_button_width : text_offset = tab_x + tab_height # if the caption is empty, measure some temporary text caption = page . caption if caption == "" : caption = "Xj" if page . active : dc . SetFont ( self . _selected_font ) textx , texty , dummy = dc . GetMultiLineTextExtent ( caption ) else : dc . SetFont ( self . _normal_font ) textx , texty , dummy = dc . GetMultiLineTextExtent ( caption ) if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT : draw_text = ChopText ( dc , caption , tab_width - ( text_offset - tab_x ) ) else : draw_text = ChopText ( dc , caption , tab_width - ( text_offset - tab_x ) - close_button_width ) ypos = drawn_tab_yoff + drawn_tab_height / 2 - texty / 2 - 1 + shift offset_focus = text_offset if control is not None : try : if control . GetPosition ( ) != wx . Point ( text_offset + 1 , ypos ) : control . SetPosition ( wx . Point ( text_offset + 1 , ypos ) ) if not control . IsShown ( ) : control . Show ( ) if paint_control : bmp = TakeScreenShot ( control . GetScreenRect ( ) ) dc . DrawBitmap ( bmp , text_offset + 1 , ypos , True ) controlW , controlH = control . GetSize ( ) text_offset += controlW + 4 textx += controlW + 4 except wx . PyDeadObjectError : pass # draw tab text rectx , recty , dummy = dc . GetMultiLineTextExtent ( draw_text ) dc . DrawLabel ( draw_text , wx . Rect ( text_offset , ypos , rectx , recty ) ) # draw focus rectangle if ( agwFlags & AUI_NB_NO_TAB_FOCUS ) == 0 : self . DrawFocusRectangle ( dc , page , wnd , draw_text , offset_focus , bitmap_offset , drawn_tab_yoff + shift , drawn_tab_height + shift , rectx , recty ) out_button_rect = wx . Rect ( ) # draw 'x' on tab (if enabled) if close_button_state != AUI_BUTTON_STATE_HIDDEN : close_button_width = self . _active_close_bmp . GetWidth ( ) bmp = self . _disabled_close_bmp if close_button_state == AUI_BUTTON_STATE_HOVER : bmp = self . _hover_close_bmp elif close_button_state == AUI_BUTTON_STATE_PRESSED : bmp = self . _pressed_close_bmp if page . active : xpos = tab_x + tab_width - close_button_width + 3 else : xpos = tab_x + tab_width - close_button_width - 5 if agwFlags & AUI_NB_CLOSE_ON_TAB_LEFT : rect = wx . Rect ( tab_x + 20 , drawn_tab_yoff + ( drawn_tab_height / 2 ) - ( bmp . GetHeight ( ) / 2 ) + shift , close_button_width , tab_height ) else : rect = wx . Rect ( xpos , drawn_tab_yoff + ( drawn_tab_height / 2 ) - ( bmp . GetHeight ( ) / 2 ) + shift , close_button_width , tab_height ) # Indent the button if it is pressed down: rect = IndentPressedBitmap ( rect , close_button_state ) dc . DrawBitmap ( bmp , rect . x , rect . y , True ) out_button_rect = rect out_tab_rect = wx . Rect ( tab_x , tab_y , x_extent , tab_height ) dc . DestroyClippingRegion ( ) return out_tab_rect , out_button_rect , x_extent