Ticket #337 (closed bug: fixed)
TabView labels not centered. (easy)
| Reported by: | tomas.wilhelmsson@… | Owned by: | stippi |
|---|---|---|---|
| Priority: | low | Milestone: | R1 |
| Component: | - General | Version: | |
| Cc: | diver | Blocked By: | |
| Platform: | All | Blocking: |
Description (last modified by stippi) (diff)
The tabview labels is not centered, the current impementation looks great with deafult tab size but if you resize the tabs it becomes a totaly new story.
Im using haikus tabview for one of my current projects and did this insted:
void BTab::DrawLabel(BView *owner, BRect frame) {
const char *label = Label(); if (label == NULL)
return;
owner->SetHighColor(0, 0, 0); float width = owner->StringWidth(label); // TODO: remove offset
font_height height; owner->GetFontHeight(&height);
float offset = frame.Height() / 2.0;
owner->DrawString(label, BPoint((frame.left + frame.right - width +
offset) / 2.0, frame.bottom - offset - (height.descent - height.ascent) / 2)); }
Atleast it fixes the centering of the text, tried it with everything from 14 to 44 in size and its always centered :>
