| 621 | # We draw the text separately in order to draw it directly on the native DC, rather than a memory one, because |
| 622 | # drawing text on a memory DC draws it blurry on HD/Retina screens |
| 623 | def DrawText(self, dc): |
| 624 | height = self.tab_height |
| 625 | dc.SetFont(self.font) |
| 626 | |
| 627 | if self.tab_img: |
| 628 | text_start = self.left_width + self.padding + self.tab_img.GetWidth() / 2 |
| 629 | else: |
| 630 | text_start = self.left_width |
| 631 | |
| 632 | maxsize = self.tab_width \ |
| 633 | - text_start \ |
| 634 | - self.right_width \ |
| 635 | - self.padding * 4 |
| 636 | color = self.selected_color if self.selected else self.inactive_color |
| 637 | |
| 638 | dc.SetTextForeground(color_utils.GetSuitable(color, 1)) |
| 639 | |
| 640 | # draw text (with no ellipses) |
| 641 | text = draw.GetPartialText(dc, self.text, maxsize, "") |
| 642 | tx, ty = dc.GetTextExtent(text) |
| 643 | dc.DrawText(text, round(text_start + self.padding), round(height / 2 - ty / 2)) |
| 644 | |
| 645 | def __repr__(self): |
| 646 | return "_TabRenderer(text={}, disabled={}) at {}".format( |