Derived from: public BView
Declared in: <interface/StringView.h>
A BStringView object draws a static character string. The user can't select the string or edit it; a BStringView doesn't respond to user actions. An instance of this class can be used to draw a label or other text that simply delivers a message of some kind to the user. Use a BTextView object for selectable and editable text.
You can also draw strings by calling BView's DrawString() function. However, assigning a string to a BStringView object locates it in the view hierarchy. The string will be updated automatically, just like other views. And, by setting the resizing mode of the object, you can make sure that it will be positioned properly when the window or the view it's in (the parent of the BStringView) is resized.
BStringView(BRect frame, const char *name, const char *text, ulong resizingMode = B_FOLLOW_LEFT | B_FOLLOW_TOP, ulong flags = B_WILL_DRAW)
Initializes the BStringView by assigning it a text string, the B_OP_OVER drawing mode, and the Erich bitmap font. These last two values are cached and communicated to the Application Server when the BStringView is attached to a window.
The frame, name, resizingMode, and flags arguments are the same as those declared for the BView class. They're passed unchanged to the BView constructor.
The frame rectangle needs to be large enough to display the entire string in the current font. The string is drawn at the bottom of the frame rectangle and, by default, is aligned to the left side. A different horizontal alignment can be set by calling SetAlignment().
See also: SetAlignment()
virtual ~BStringView(void)
Frees the text string.
virtual void Draw(BRect updateRect)
Draws the string along the bottom of the BStringView's frame rectangle in the current high color.
See also: BView::Draw()
void SetAlignment(alignment flag) inline alignment Alignment(void) const
These functions align the string within the BStringView's frame rectangle and return the current alignment. The alignment flag can be:
B_ALIGN_LEFT | The string is aligned at the left side of the frame rectangle. |
The default is B_ALIGN_LEFT.
void SetText(const char *string) inline const char *Text(void) const
These functions set and return the text string that the BStringView draws.
SetText() frees the previous string and copies string to replace it.
Text() returns the null-terminated string.
The Be Book, HTML Edition, for Developer Release 8 of the Be Operating System.
Copyright © 1996 Be, Inc. All rights reserved.
Be, the Be logo, BeBox, BeOS, BeWare, and GeekPort are trademarks of Be, Inc.
Last modified September 6, 1996.