| 346 | |
| 347 | class _TabRenderer: |
| 348 | def __init__(self, size=(36, 24), text=wx.EmptyString, img: wx.Image=None, |
| 349 | closeable=True): |
| 350 | |
| 351 | # tab left/right zones inclination |
| 352 | self.ctab_left = BitmapLoader.getImage("ctableft", "gui") |
| 353 | self.ctab_middle = BitmapLoader.getImage("ctabmiddle", "gui") |
| 354 | self.ctab_right = BitmapLoader.getImage("ctabright", "gui") |
| 355 | self.ctab_close = BitmapLoader.getImage("ctabclose", "gui") |
| 356 | |
| 357 | self.left_width = self.ctab_left.GetWidth() |
| 358 | self.right_width = self.ctab_right.GetWidth() |
| 359 | self.middle_width = self.ctab_middle.GetWidth() |
| 360 | self.close_btn_width = self.ctab_close.GetWidth() |
| 361 | |
| 362 | width, height = size |
| 363 | |
| 364 | self.min_width = self.left_width + self.right_width + self.middle_width |
| 365 | self.min_height = self.ctab_middle.GetHeight() |
| 366 | |
| 367 | # set minimum width and height to what is allotted to images |
| 368 | width = max(width, self.min_width) |
| 369 | height = max(height, self.min_height) |
| 370 | |
| 371 | self._disabled = False |
| 372 | self.baseText = text |
| 373 | self.extraText = '' |
| 374 | self.tab_size = (width, height) |
| 375 | self.closeable = closeable |
| 376 | self.selected = False |
| 377 | self.close_btn_hovering = False |
| 378 | self.tab_bitmap = None |
| 379 | self.tab_back_bitmap = None |
| 380 | self.padding = 4 |
| 381 | self.font = wx.Font(fonts.NORMAL, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False) |
| 382 | |
| 383 | self.tab_img = img |
| 384 | self.position = (0, 0) # Not used internally for rendering - helper for tab container |
| 385 | self.InitTab() |
| 386 | |
| 387 | @property |
| 388 | def disabled(self): |