GLOW API version 1.0 reference

Back to
Table of contents


class GlowWidgetLabelHelper

General information

type: base
inherits: (none)
module: glowLabelWidget

GlowWidgetLabelHelper assists the creation of labeled widget. It manages and poisitions the label and provides accessors and mutators for the label's size and attributes. You do not instantiate a GlowWidgetLabelHelper directly, but instead use one of the classes derived from it, such as GlowLabeledPopupMenuWidget. To create a labeled widget class, you should inherit both from the main class for your widget, and from GlowWidgetLabelHelper.

GLOW programs that use labeled widgets must deal with GlowWidgetLabelHelpers.

Constants

Positioning constants
These constants specify the positioning of the label.

enum GlowWidgetLabelHelper::LabelPosition defaultLabelPosition

Default position (equal to leftLabelPosition)

enum GlowWidgetLabelHelper::LabelPosition leftLabelPosition

Position to the left of the widget.

enum GlowWidgetLabelHelper::LabelPosition rightLabelPosition

Position to the right of the widget.

enum GlowWidgetLabelHelper::LabelPosition topLabelPosition

Position over the widget.

enum GlowWidgetLabelHelper::LabelPosition bottomLabelPosition

Position under the widget.

Methods

Label attributes
You can access the label's attributes using these methods.

int GetLabelSpacing(void) const

Returns the spacing between the label and the widget.

void SetLabelSpacing(int spacing)

Sets the spacing between the label and the widget.

GlowWidgetLabelHelper::LabelPosition GetLabelPosition(void) const

Returns the position code for the label.

void SetLabelPosition(GlowWidgetLabelHelper::LabelPosition position)

Sets the position code for the label.

int GetLabelWidth(void) const

Returns the maximum width for the label.

void SetLabelWidth(int width)

Sets the maximum width for the label.

int GetLabelHeight(void) const

Returns the maximum height for the label.

void SetLabelHeight(int height)

Sets the maximum height for the label.

const char* GetLabelText(void) const

Returns the current text of the label.

void SetLabelText(const char* text)

Sets the current text of the label.

GlowFont GetLabelFont(void) const

Returns the font of the label.

void SetLabelFont(GlowFont font)

Sets the font of the label.

GlowColor GetLabelTextColor(void) const

Returns the color of the label's text.

void SetLabelTextColor(GlowColor font)

Sets the color of the label's text.

GlowColor GetLabelDisableTextColor(void) const

Returns the color of the label's text when disabled.

void SetLabelDisableTextColor(GlowColor font)

Sets the color of the label's text when disabled.

Methods for subclasses

Initializer

void InitLabel(GlowWidget* main, GlowWidgetLabelHelper::LabelPosition position, int width, int height, int spacing, const char* text, GlowFont font = GlowFont::helvetica12, GlowColor textColor = GlowLabelParams::defaults.textColor, GlowColor disableTextColor = GlowLabelParams::defaults.disableTextColor)

Initializes a GlowWidgetLabelHelper with options specified by the given params. main specifies the main widget. spacing gives the space in pixels between the label and the widget. position gives the position of the label relative to the widget. width and height give a maximum size for the label. font gives the font to use for the label. textColor and disableTextColor give the colors for the label. This method must be called, normally from a widget's constructor or its Init() method, before the label may be accessed.

Assistance
These methods are provided to assist widgets in managing their labels.

GlowWidget::AutoPackError HelpAutoPack(int& hSize, int& vSize, int& leftMargin, int& rightMargin, int& topMargin, int& bottomMargin)

Modifies the given reference parameters to reflect the label. It reduces the sizes by the label's size and spacing, and sets the margins appropriately.

GlowWidgetLabelWidget* Label(void) const

Returns a pointer to the actual widget implementing the label. A subclass normally shouldn't need to gain access to this pointer, but should instead use the provided access methods.

Back to
Table of contents


The GLOW Toolkit