Constrain the clipping region before drawing the label. This fixes bug 232
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16579 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
8b41c21369
commit
7a25fcafda
@ -281,6 +281,8 @@ BTextControl::Draw(BRect updateRect)
|
|||||||
region.Exclude(fText->Frame());
|
region.Exclude(fText->Frame());
|
||||||
FillRegion(®ion);
|
FillRegion(®ion);
|
||||||
|
|
||||||
|
// label
|
||||||
|
|
||||||
if (Label()) {
|
if (Label()) {
|
||||||
font_height fontHeight;
|
font_height fontHeight;
|
||||||
GetFontHeight(&fontHeight);
|
GetFontHeight(&fontHeight);
|
||||||
@ -288,13 +290,14 @@ BTextControl::Draw(BRect updateRect)
|
|||||||
float y = fontHeight.ascent + fText->Frame().top + 1;
|
float y = fontHeight.ascent + fText->Frame().top + 1;
|
||||||
float x;
|
float x;
|
||||||
|
|
||||||
|
float labelWidth = StringWidth(Label());
|
||||||
switch (fLabelAlign) {
|
switch (fLabelAlign) {
|
||||||
case B_ALIGN_RIGHT:
|
case B_ALIGN_RIGHT:
|
||||||
x = fDivider - StringWidth(Label()) - 3.0f;
|
x = fDivider - labelWidth - 3.0f;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case B_ALIGN_CENTER:
|
case B_ALIGN_CENTER:
|
||||||
x = fDivider - StringWidth(Label()) / 2.0f;
|
x = fDivider - labelWidth / 2.0f;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -302,10 +305,18 @@ BTextControl::Draw(BRect updateRect)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BRect labelArea(x, fText->Frame().top, x + labelWidth,
|
||||||
|
ceilf(fontHeight.ascent + fontHeight.descent) + 1);
|
||||||
|
if (x < fDivider && updateRect.Intersects(labelArea)) {
|
||||||
|
labelArea.right = fDivider;
|
||||||
|
|
||||||
|
BRegion clipRegion(labelArea);
|
||||||
|
ConstrainClippingRegion(&clipRegion);
|
||||||
SetHighColor(IsEnabled() ? ui_color(B_CONTROL_TEXT_COLOR)
|
SetHighColor(IsEnabled() ? ui_color(B_CONTROL_TEXT_COLOR)
|
||||||
: tint_color(noTint, B_DISABLED_LABEL_TINT));
|
: tint_color(noTint, B_DISABLED_LABEL_TINT));
|
||||||
DrawString(Label(), BPoint(x, y));
|
DrawString(Label(), BPoint(x, y));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user