diff options
author | André Nusser <andre.nusser@googlemail.com> | 2017-04-20 22:22:36 +0200 |
---|---|---|
committer | André Nusser <andre.nusser@googlemail.com> | 2017-04-20 22:23:07 +0200 |
commit | 25ac09f7ee1c7c6c9b1360c1d92eb3fb2ee4a3b0 (patch) | |
tree | 5167ba04261ec0f793d38a3c0244d15f2c6e0a43 /plugingui/tabbutton.cc | |
parent | 2d430a085e8ac1781638cac4261389947859532b (diff) |
Set text in tabs correctly and fix magic values in button classes.
Diffstat (limited to 'plugingui/tabbutton.cc')
-rw-r--r-- | plugingui/tabbutton.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/plugingui/tabbutton.cc b/plugingui/tabbutton.cc index 27588da..56552c0 100644 --- a/plugingui/tabbutton.cc +++ b/plugingui/tabbutton.cc @@ -85,6 +85,7 @@ void TabButton::repaintEvent(RepaintEvent* e) int padTop = 3; int padLeft = 0; + int padTextTop = 3; int w = width(); int h = height(); @@ -102,11 +103,9 @@ void TabButton::repaintEvent(RepaintEvent* e) p.drawImage(padLeft, padTop, tab_active); } - p.setColour(Colour(0.1)); - // FIXME: fix all the magic values here - auto x = (width() / 2) - (3 * text.length()) + (padLeft / 2); - auto y = (height() / 2) + 5 + 1 + (padTop / 2); - p.drawText(x, y + 4, font, text, true); + auto x = padLeft + (width() - font.textWidth(text)) / 2; + auto y = padTop + padTextTop + font.textHeight(text); + p.drawText(x, y, font, text, true); } void TabButton::clickHandler() |