Vaca::Label Class Reference

#include <Label.h>

Inheritance diagram for Vaca::Label:

Vaca::Widget Vaca::Component Vaca::Referenceable Vaca::NonCopyable Vaca::CustomLabel Vaca::LinkLabel

List of all members.


Detailed Description

A static label of text.

It's just an informative label. Remember to pass the LabelStyle to Label's constructor if you derived this class.

Warning:
For people that want to mix up Win32 SS_ styles with the ones in LabelStyles, you should be aware to use them because some can overlap the SS_CENTER or SS_RIGHT, so you should override getTextAlign and getTextAlign methods (like CustomLabel does).

Public Member Functions

 Label (const String &text, Widget *parent, Style style=LabelStyle)
 Creates a new Label widget.
virtual ~Label ()
virtual TextAlign getTextAlign ()
 Returns the current text alignment.
virtual void setTextAlign (TextAlign align)
 Sets the text alignment.

Protected Member Functions

bool useWordWrap ()
int getFlagsForDrawString ()
virtual void onPreferredSize (Size &sz)
 Returns the preferred size of the label using Graphics::measureString.
virtual void onResize (const Size &sz)
 If the label is resized, we must to redraw it.

Constructor & Destructor Documentation

Label::Label ( const String text,
Widget parent,
Style  style = LabelStyle 
)

Creates a new Label widget.

Warning:
Remember that a character with a preceding ampersand (&) will be underlined. So if you want to show a string with the '&', you have to use "&&".

Label::~Label (  )  [virtual]


Member Function Documentation

TextAlign Label::getTextAlign (  )  [virtual]

Returns the current text alignment.

Returns:
TextAlign::Center, TextAlign::RightAlign, TextAlign::LeftAlign

Reimplemented in Vaca::CustomLabel.

void Label::setTextAlign ( TextAlign  align  )  [virtual]

Sets the text alignment.

Warning:
You can't change the text-alignment of a label with the SimpleLabelStyle style.

Reimplemented in Vaca::CustomLabel.

bool Label::useWordWrap (  )  [protected]

int Label::getFlagsForDrawString (  )  [protected]

Todo:
the return value is too Win32 specific.

void Label::onPreferredSize ( Size sz  )  [protected, virtual]

Returns the preferred size of the label using Graphics::measureString.

Reimplemented from Vaca::Widget.

Reimplemented in Vaca::LinkLabel.

void Label::onResize ( const Size sz  )  [protected, virtual]

If the label is resized, we must to redraw it.

This is necessary mainly if the Label isn't TextAlign::Left.

Reimplemented from Vaca::Widget.