Wt::WLabel Class Reference

A label for a form field. More...

#include <Wt/WLabel>

Inheritance diagram for Wt::WLabel:

Inheritance graph
[legend]

List of all members.

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.
WFormWidgetbuddy () 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 WStringtext () const
 Get the label text.
void setImage (WImage *image)
 Set the image.
WImageimage () const
 Get the image.
void setWordWrap (bool on)
 Configure word wrapping.
bool wordWrap () const
 Returns whether word wrapping is on.


Detailed Description

A label for a form field.

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.


Member Function Documentation

WFormWidget* Wt::WLabel::buddy (  )  const [inline]

Return the buddy of this label.

See also:
setBuddy(WFormWidget *)

void Wt::WLabel::setBuddy ( WFormWidget buddy  ) 

Set the buddy of this label.

Sets the buddy FormWidget for which this label acts as a proxy.

See also:
WFormWidget::label(), setBuddy(Ext::FormField *), buddy()

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.

See also:
Ext::FormField::label(), setBuddy(WFormWidget *)

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.

See also:
wordWrap()

bool Wt::WLabel::wordWrap (  )  const

Returns whether word wrapping is on.

See also:
setWordWrap()


Generated on Mon Mar 9 08:27:51 2009 for Wt by doxygen 1.5.6