+ # Fancy tabs - like with VC71 but with the following differences:
+ # - The Selected tab is colored with gradient color
+ borderPen = wx.Pen(wx.SystemSettings_GetColour(wx.SYS_COLOUR_BTNSHADOW))
+ pc = pageContainer
+
+ pen = (tabIdx == pc.GetSelection() and [wx.Pen(pc._pParent.GetBorderColour())] or [wx.Pen(wx.SystemSettings_GetColour(wx.SYS_COLOUR_3DFACE))])[0]
+
+ if tabIdx == pc.GetSelection():
+
+ posy = (pc.HasFlag(FNB_BOTTOM) and [2] or [VERTICAL_BORDER_PADDING])[0]
+ th = (pc.HasFlag(FNB_BOTTOM) and [tabHeight - 2] or [tabHeight - 5])[0]
+
+ rect = wx.Rect(posx, posy, tabWidth, th)
+
+ col2 = (pc.HasFlag(FNB_BOTTOM) and [pc._pParent.GetGradientColourTo()] or [pc._pParent.GetGradientColourFrom()])[0]
+ col1 = (pc.HasFlag(FNB_BOTTOM) and [pc._pParent.GetGradientColourFrom()] or [pc._pParent.GetGradientColourTo()])[0]
+
+ PaintStraightGradientBox(dc, rect, col1, col2)
+ dc.SetBrush(wx.TRANSPARENT_BRUSH)
+ dc.SetPen(pen)
+ dc.DrawRectangleRect(rect)
+
+ # erase the bottom/top line of the rectangle
+ dc.SetPen(wx.Pen(pc._pParent.GetGradientColourFrom()))
+ if pc.HasFlag(FNB_BOTTOM):
+ dc.DrawLine(rect.x, 2, rect.x + rect.width, 2)
+ else:
+ dc.DrawLine(rect.x, rect.y + rect.height - 1, rect.x + rect.width, rect.y + rect.height - 1)
+
+ else:
+
+ # We dont draw a rectangle for non selected tabs, but only
+ # vertical line on the left
+ dc.SetPen(borderPen)
+ dc.DrawLine(posx + tabWidth, VERTICAL_BORDER_PADDING + 3, posx + tabWidth, tabHeight - 4)
+
+
+ # -----------------------------------
+ # Text and image drawing
+ # -----------------------------------
+
+ # Text drawing offset from the left border of the
+ # rectangle
+
+ # The width of the images are 16 pixels
+ padding = pc.GetParent().GetPadding()
+ hasImage = pc._pagesInfoVec[tabIdx].GetImageIndex() != -1
+ imageYCoord = (pc.HasFlag(FNB_BOTTOM) and [6] or [8])[0]
+
+ if hasImage:
+ textOffset = 2*pc._pParent._nPadding + 16
+ else:
+ textOffset = pc._pParent._nPadding
+
+ textOffset += 2
+
+ if tabIdx != pc.GetSelection():
+
+ # Set the text background to be like the vertical lines
+ dc.SetTextForeground(pc._pParent.GetNonActiveTabTextColour())
+
+ if hasImage:
+
+ imageXOffset = textOffset - 16 - padding
+ pc._ImageList.Draw(pc._pagesInfoVec[tabIdx].GetImageIndex(), dc,
+ posx + imageXOffset, imageYCoord,
+ wx.IMAGELIST_DRAW_TRANSPARENT, True)
+
+ dc.DrawText(pc.GetPageText(tabIdx), posx + textOffset, imageYCoord)
+
+ # draw 'x' on tab (if enabled)
+ if pc.HasFlag(FNB_X_ON_TAB) and tabIdx == pc.GetSelection():
+
+ textWidth, textHeight = dc.GetTextExtent(pc.GetPageText(tabIdx))
+ tabCloseButtonXCoord = posx + textOffset + textWidth + 1
+
+ # take a bitmap from the position of the 'x' button (the x on tab button)
+ # this bitmap will be used later to delete old buttons
+ tabCloseButtonYCoord = imageYCoord
+ x_rect = wx.Rect(tabCloseButtonXCoord, tabCloseButtonYCoord, 16, 16)
+ self._tabXBgBmp = self._GetBitmap(dc, x_rect, self._tabXBgBmp)
+
+ # Draw the tab
+ self.DrawTabX(pc, dc, x_rect, tabIdx, btnStatus)
+
+
+#------------------------------------------------------------------
+# Visual studio 2005 (VS8)
+#------------------------------------------------------------------
+class FNBRendererVC8(FNBRenderer):
+ """
+ This class handles the drawing of tabs using the I{VC8} renderer.
+ """
+
+ def __init__(self):
+ """ Default class constructor. """
+
+ FNBRenderer.__init__(self)
+ self._first = True
+ self._factor = 1
+
+
+ def DrawTabs(self, pageContainer, dc):
+ """ Draws all the tabs using VC8 style. Overloads The DrawTabs method in parent class. """