#include <Wt/WLabel>
Public Member Functions | |
WLabel (WContainerWidget *parent=0) | |
Construct a WLabel with empty text and optional parent. | |
WLabel (const WString &text, WContainerWidget *parent=0) | |
Construct a WLabel with a given text. | |
WLabel (WImage *image, WContainerWidget *parent=0) | |
Construct a WLabel with an image. | |
WFormWidget * | buddy () const |
Return the buddy of this label. | |
void | setBuddy (WFormWidget *buddy) |
Set the buddy of this label. | |
void | setBuddy (Ext::FormField *buddy) |
Set the buddy of this label. | |
void | setText (const WString &text) |
Set the label text. | |
const WString & | text () const |
Get the label text. | |
void | setImage (WImage *image) |
Set the image. | |
WImage * | image () const |
Get the image. | |
void | setWordWrap (bool on) |
Configure word wrapping. | |
bool | wordWrap () const |
Returns whether word wrapping is on. |
The label may contain an image and/or text. It acts like a proxy for giving focus to a WFormWidget. When both an image and text are specified, the image is put at the left of the text.
Usage example:
Wt::WContainerWidget *w = new Wt::WContainerWidget(); Wt::WLabel *label = new Wt::WLabel("Favourite Actress: ", w); Wt::WLineEdit *edit = new Wt::WLineEdit("Renée Zellweger", w); label->setBuddy(edit);
The widget corresponds to the HTML <label>
tag.
WLabel is an inline widget.
WFormWidget* Wt::WLabel::buddy | ( | ) | const [inline] |
void Wt::WLabel::setBuddy | ( | WFormWidget * | buddy | ) |
Set the buddy of this label.
Sets the buddy FormWidget for which this label acts as a proxy.
void Wt::WLabel::setBuddy | ( | Ext::FormField * | buddy | ) |
Set the buddy of this label.
Sets the buddy Ext::FormField for which this label acts as a proxy. When using this method, the result of buddy() is not defined.
void Wt::WLabel::setWordWrap | ( | bool | on | ) |
Configure word wrapping.
When on is true, the widget may break lines, creating a multi-line text. When on is false, the text will displayed on a single line, unless the text contains end-of-lines (for Wt::PlainText) or <br /> tags or other block-level tags (for Wt::XHTMLText).
The default value is false.
bool Wt::WLabel::wordWrap | ( | ) | const |