#include <label.h>
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 WoopsiString & | text, | |||
GadgetStyle * | style = 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. | |
style | The style that the gadget should use. If this is not specified, the gadget will use the values stored in the global defaultGadgetStyle object. The gadget will copy the properties of the style into its own internal style object. |
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 WoopsiString & | 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::calculateTextPositionHorizontal | ( | ) | [protected, virtual] |
Calculate the position of the string based on its length and the alignment options.
Reimplemented in WoopsiUI::TextBox.
virtual void WoopsiUI::Label::calculateTextPositionVertical | ( | ) | [protected, virtual] |
Calculate the vertical position of the string based on the font height and the alignment options.
virtual void WoopsiUI::Label::drawBorder | ( | GraphicsPort * | port | ) | [protected, virtual] |
Draw the area of this gadget that falls within the clipping region. Called by the redraw() function to draw all visible regions.
port | The GraphicsPort to draw to. |
Reimplemented from WoopsiUI::Gadget.
Reimplemented in WoopsiUI::Button, WoopsiUI::CheckBox, WoopsiUI::CycleButton, WoopsiUI::DecorationGlyphButton, WoopsiUI::TextBox, and WoopsiUI::WindowBorderButton.
virtual void WoopsiUI::Label::drawContents | ( | GraphicsPort * | port | ) | [protected, virtual] |
Draw the area of this gadget that falls within the clipping region. Called by the redraw() function to draw all visible regions.
port | The GraphicsPort to draw to. |
Reimplemented from WoopsiUI::Gadget.
Reimplemented in WoopsiUI::Button, WoopsiUI::CheckBox, 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 WoopsiString& WoopsiUI::Label::getText | ( | ) | const [inline, virtual] |
Returns the string shown in the label.
virtual void WoopsiUI::Label::insertText | ( | const WoopsiString & | 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 void WoopsiUI::Label::onResize | ( | u16 | width, | |
u16 | height | |||
) | [protected, virtual] |
Resize the gadget to the new dimensions.
width | The new width. | |
height | The new height. |
Reimplemented from WoopsiUI::Gadget.
Reimplemented in WoopsiUI::CycleButton.
virtual void WoopsiUI::Label::onTextChange | ( | ) | [protected, virtual] |
Updates the GUI after the text has changed.
virtual void WoopsiUI::Label::setFont | ( | FontBase * | font | ) | [virtual] |
virtual void WoopsiUI::Label::setText | ( | const WoopsiString & | 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
WoopsiString WoopsiUI::Label::_text [protected] |
Text that the textbox will display
s32 WoopsiUI::Label::_textX [protected] |
X co-ordinate of the text relative to the gadget
s32 WoopsiUI::Label::_textY [protected] |
Y co-ordinate of the text relative to the gadget
TextAlignmentVert WoopsiUI::Label::_vAlignment [protected] |
Vertical alignment of the text