#include <label.h>
Public Types | |
enum | TextAlignmentHoriz { TEXT_ALIGNMENT_HORIZ_CENTRE = 0, TEXT_ALIGNMENT_HORIZ_LEFT = 1, TEXT_ALIGNMENT_HORIZ_RIGHT = 2 } |
enum | TextAlignmentVert { TEXT_ALIGNMENT_VERT_CENTRE = 0, TEXT_ALIGNMENT_VERT_TOP = 1, TEXT_ALIGNMENT_VERT_BOTTOM = 2 } |
Public Member Functions | |
Label (s16 x, s16 y, u16 width, u16 height, const char *text, FontBase *font=NULL) | |
Label (s16 x, s16 y, u16 width, u16 height, const char letter, FontBase *font=NULL) | |
virtual void | draw (Rect clipRect) |
virtual void | setTextAlignmentHoriz (TextAlignmentHoriz alignment) |
virtual void | setTextAlignmentVert (TextAlignmentVert alignment) |
virtual const char * | getText () const |
virtual void | setText (const char *text) |
virtual void | setText (const char text) |
virtual void | appendText (const char *text) |
virtual void | appendText (const char text) |
virtual void | insertText (const char *text, const u32 index) |
virtual void | insertText (const char text, const u32 index) |
virtual bool | resize (u16 width, u16 height) |
virtual void | getPreferredDimensions (Rect &rect) const |
Protected Member Functions | |
virtual void | calculateTextPosition () |
virtual | ~Label () |
Label (const Label &label) | |
Protected Attributes | |
WoopsiString * | _text |
u16 | _textX |
u16 | _textY |
u8 | _padding |
TextAlignmentHoriz | _hAlignment |
TextAlignmentVert | _vAlignment |
Single-line label gadget. Can align text both vertically and horizontally in different ways.
WoopsiUI::Label::Label | ( | s16 | x, | |
s16 | y, | |||
u16 | width, | |||
u16 | height, | |||
const char * | text, | |||
FontBase * | font = NULL | |||
) |
Constructor for a label containing a string.
x | The x co-ordinate of the text box, relative to its parent. | |
y | The y co-ordinate of the text box, relative to its parent. | |
width | The width of the textbox. | |
height | The height of the textbox. | |
text | Pointer to a string to display in the textbox. | |
font | The font to use in this text box. |
WoopsiUI::Label::Label | ( | s16 | x, | |
s16 | y, | |||
u16 | width, | |||
u16 | height, | |||
const char | letter, | |||
FontBase * | font = NULL | |||
) |
Constructor for a label containing a single character.
x | The x co-ordinate of the text box, relative to its parent. | |
y | The y co-ordinate of the text box, relative to its parent. | |
width | The width of the textbox. | |
height | The height of the textbox. | |
letter | Single character to display in the textbox. | |
font | The font to use in this text box. |
virtual WoopsiUI::Label::~Label | ( | ) | [inline, protected, virtual] |
Destructor.
WoopsiUI::Label::Label | ( | const Label & | label | ) | [inline, protected] |
Copy constructor is protected to prevent usage.
virtual void WoopsiUI::Label::appendText | ( | const char | text | ) | [virtual] |
Append new text to the end of the current text displayed in the label.
text | Char to append. |
Reimplemented in WoopsiUI::TextBox.
virtual void WoopsiUI::Label::appendText | ( | const char * | text | ) | [virtual] |
Append new text to the end of the current text displayed in the label.
text | String to append. |
Reimplemented in WoopsiUI::TextBox.
virtual void WoopsiUI::Label::calculateTextPosition | ( | ) | [protected, virtual] |
Calculate the position of the string based on its length and the alignment options.
Reimplemented in WoopsiUI::CycleButton.
virtual void WoopsiUI::Label::draw | ( | Rect | clipRect | ) | [virtual] |
Draw the region of the label within the clipping rect. Should not be called directly.
clipRect | The clipping rect to limit drawing to. |
Reimplemented from WoopsiUI::Gadget.
Reimplemented in WoopsiUI::Button, WoopsiUI::CheckBox, WoopsiUI::ContextMenuItem, WoopsiUI::CycleButton, WoopsiUI::DecorationGlyphButton, WoopsiUI::RadioButton, WoopsiUI::TextBox, and WoopsiUI::WindowBorderButton.
virtual void WoopsiUI::Label::getPreferredDimensions | ( | Rect & | rect | ) | const [virtual] |
Insert the dimensions that this gadget wants to have into the rect passed in as a parameter. All co-ordinates are relative to the gadget's parent.
rect | Reference to a rect to populate with data. |
Reimplemented from WoopsiUI::Gadget.
Reimplemented in WoopsiUI::CycleButton.
virtual const char* WoopsiUI::Label::getText | ( | ) | const [inline, virtual] |
Returns a pointer to the string shown in the label.
virtual void WoopsiUI::Label::insertText | ( | const char | text, | |
const u32 | index | |||
) | [virtual] |
Insert text at the specified index.
text | Char to insert. | |
index | Index at which to insert the char. |
Reimplemented in WoopsiUI::TextBox.
virtual void WoopsiUI::Label::insertText | ( | const char * | text, | |
const u32 | index | |||
) | [virtual] |
Insert text at the specified index.
text | The text to insert. | |
index | Index at which to insert the text. |
Reimplemented in WoopsiUI::TextBox.
virtual bool WoopsiUI::Label::resize | ( | u16 | width, | |
u16 | height | |||
) | [virtual] |
Resize the gadget to the new dimensions.
width | The new width. | |
height | The new height. |
Reimplemented from WoopsiUI::Gadget.
virtual void WoopsiUI::Label::setText | ( | const char | text | ) | [virtual] |
Set the text displayed in the label.
text | Character to display. |
Reimplemented in WoopsiUI::TextBox.
virtual void WoopsiUI::Label::setText | ( | const char * | text | ) | [virtual] |
Set the text displayed in the label.
text | String to display. |
Reimplemented in WoopsiUI::TextBox.
virtual void WoopsiUI::Label::setTextAlignmentHoriz | ( | TextAlignmentHoriz | alignment | ) | [virtual] |
Set the horizontal alignment of text within the label.
alignment | The horizontal position of the text. |
virtual void WoopsiUI::Label::setTextAlignmentVert | ( | TextAlignmentVert | alignment | ) | [virtual] |
Set the vertical alignment of text within the label.
alignment | The vertical position of the text. |
TextAlignmentHoriz WoopsiUI::Label::_hAlignment [protected] |
Horizontal alignment of the text
u8 WoopsiUI::Label::_padding [protected] |
Padding around the text in pixels
WoopsiString* WoopsiUI::Label::_text [protected] |
Text that the textbox will display
u16 WoopsiUI::Label::_textX [protected] |
X co-ordinate of the text relative to the gadget
u16 WoopsiUI::Label::_textY [protected] |
Y co-ordinate of the text relative to the gadget
TextAlignmentVert WoopsiUI::Label::_vAlignment [protected] |
Vertical alignment of the text