The text control is now more flexible with its layout items.

* Before, you had to have both, the text view layout item, and the label
  layout item or else nothing would ever be visible.
* Now you can only create the text view item, and it will still work.
* Also, no matter the order you added the layout items, they would always
  put the label on the left, and the control to the right.
* You can place the label and text view layout items anywhere now, although
  you should keep in mind that the view spans over their frame unions; IOW
  they should always adjacent to each other, but not necessarily horizontally
  and left to right.
* No longer uses a fixed label spacing, but utilizes
  BControlLook::DefaultLabelSpacing() instead.
* However, the spacing is always added to the right of the label, no matter
  how you place it in the layout. Maybe one wants to add a SetLabelTextViewGap()
  like method.
This commit is contained in:
Axel Dörfler
2012-11-05 12:50:02 +01:00
parent 6643ead593
commit 09d87d9151
2 changed files with 85 additions and 38 deletions
+5 -4
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2006-2010, Haiku, Inc. All rights reserved.
* Copyright 2006-2012, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _TEXT_CONTROL_H
@@ -9,6 +9,7 @@
#include <Control.h>
#include <TextView.h>
class BLayoutItem;
namespace BPrivate {
class _BTextInput_;
@@ -22,14 +23,14 @@ public:
BMessage* message,
uint32 resizeMode
= B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
BTextControl(const char* name,
const char* label, const char* initialText,
BMessage* message,
uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
BTextControl(const char* label,
const char* initialText,
BMessage* message);
BMessage* message);
virtual ~BTextControl();
BTextControl(BMessage* archive);