This fixes the child text view re-layout, I didn't test on R5, but my changes make sense to me and are much simpler than what was there before. The BTextControl works now on Haiku, with some problems in the redraw code, that I'm pretty sure are related to our app_server.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12648 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
55354b0f60
commit
7a70a2d6d6
@ -39,20 +39,12 @@ BTextControl::BTextControl(BRect frame, const char *name, const char *label,
|
||||
{
|
||||
InitData(label, text);
|
||||
|
||||
BRect bounds(Bounds());
|
||||
|
||||
font_height fh;
|
||||
GetFontHeight(&fh);
|
||||
|
||||
float height = (float)ceil(fh.ascent + fh.descent + fh.leading);
|
||||
float lineHeight = fText->LineHeight(0);
|
||||
|
||||
ResizeTo(bounds.Width(), height + 8);
|
||||
ResizeTo(Bounds().Width(), lineHeight + 8);
|
||||
|
||||
BRect textBounds(fText->Bounds());
|
||||
|
||||
fText->ResizeTo(textBounds.Width(), lineHeight + 4);
|
||||
fText->MoveBy(0, (bounds.Height() - height) / 2.0f);
|
||||
fText->ResizeTo(fText->Bounds().Width(), lineHeight + 4);
|
||||
fText->MoveTo(fText->Frame().left, 2.0f);
|
||||
}
|
||||
|
||||
|
||||
@ -618,13 +610,14 @@ BTextControl::InitData(const char *label, const char *initial_text,
|
||||
if (data)
|
||||
fText = static_cast<_BTextInput_ *>(FindView("_input_"));
|
||||
else {
|
||||
BRect frame(fDivider, bounds.top + 2.0f, bounds.right - 2.0f,
|
||||
bounds.bottom - 2.0f);
|
||||
BRect frame(fDivider, bounds.top + 2.0f,
|
||||
bounds.right - 2.0f, bounds.bottom - 2.0f);
|
||||
BRect textRect(frame.OffsetToCopy(0.0f, 0.0f));
|
||||
textRect.InsetBy(2.0, 2.0);
|
||||
|
||||
fText = new _BTextInput_(frame, textRect,
|
||||
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP, B_WILL_DRAW | B_FRAME_EVENTS |
|
||||
B_NAVIGABLE);
|
||||
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP,
|
||||
B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE);
|
||||
|
||||
AddChild(fText);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user