From 7a70a2d6d697b43058e2277f24c2bf64fbd5eab9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Thu, 12 May 2005 16:32:03 +0000 Subject: [PATCH] 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 --- src/kits/interface/TextControl.cpp | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/kits/interface/TextControl.cpp b/src/kits/interface/TextControl.cpp index 92f43e9fb1..cb1cdfef53 100644 --- a/src/kits/interface/TextControl.cpp +++ b/src/kits/interface/TextControl.cpp @@ -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);