GLOW API version 1.0 reference

Back to
Table of contents


class GlowCheckBoxWidget

General information

type: class
inherits: GlowWidget
module: glowCheckBoxWidget

GlowCheckBoxWidget is a checkbox widget. It can exist in three states: on, off and half. Normally, its behavior switches back and forth between on and off, but this can be changed to include half.

GLOW programs that make use of checkbox widgets should use this class.

Constants

States

enum GlowCheckBoxWidget::State on

On state

enum GlowCheckBoxWidget::State off

Off state

enum GlowCheckBoxWidget::State half

Mixed state

Behavior options
These behavior options should be or'ed together and passed in the options parameter.

enum GlowCheckBoxWidget::Behavior defaultBehavior

Defaults (equal to onFollowsOff | offFollowsOn | onFollowsHalf)

enum GlowCheckBoxWidget::Behavior onFollowsOff

Clicking during the off state results in change to on. (default)

enum GlowCheckBoxWidget::Behavior halfFollowsOff

Clicking during the off state results in change to half.

enum GlowCheckBoxWidget::Behavior offFollowsOn

Clicking during the on state results in change to off. (default)

enum GlowCheckBoxWidget::Behavior halfFollowsOn

Clicking during the on state results in change to half.

enum GlowCheckBoxWidget::Behavior onFollowsHalf

Clicking during the half state results in change to on. (default)

enum GlowCheckBoxWidget::Behavior offFollowsHalf

Clicking during the half state results in change to off.

Inherited constants
These constants are inherited from GlowWidget.

enum GlowWidget::AutoPackError noAutoPackError
enum GlowWidget::AutoPackError hAutoPackError
enum GlowWidget::AutoPackError vAutoPackError

enum GlowWidget::AutoPackOptions noReshape
enum GlowWidget::AutoPackOptions preferredSize
enum GlowWidget::AutoPackOptions expandPreferredSize
enum GlowWidget::AutoPackOptions forcedSize
enum GlowWidget::AutoPackOptions noMove
enum GlowWidget::AutoPackOptions leftPos
enum GlowWidget::AutoPackOptions rightPos
enum GlowWidget::AutoPackOptions topPos
enum GlowWidget::AutoPackOptions bottomPos
enum GlowWidget::AutoPackOptions centerPos

enum { unspecifiedSize }
enum { unspecifiedPos }

Methods

Constructors and destructor

GlowCheckBoxWidget(GlowWidget* parent, const GlowCheckBoxParams& params)

Creates a new GlowCheckBoxWidget using the given params and adds it to parent's children.

GlowCheckBoxWidget(GlowWidgetRoot* root, const GlowCheckBoxParams& params)

Creates a new GlowCheckBoxWidget using the given params and adds it to the top level under root.

GlowCheckBoxWidget(void)

Creates a new GlowCheckBoxWidget but does not initialize it. A checkbox created in this way may not be used until its Init() method is called.

void Init(GlowWidget* parent, const GlowCheckBoxParams& params)

Initializes a new GlowCheckBoxWidget using the given params and adds it to parent's children.

void Init(GlowWidgetRoot* root, const GlowCheckBoxParams& params)

Initializes a new GlowCheckBoxWidget using the given params and adds it to the top level under root.

virtual ~GlowCheckBoxWidget(void)

Attributes

const char* GetText(void) const

Returns the label string for the checkbox.

void SetText(const char* text)

Sets the label string for the checkbox.

GlowFont GetFont(void) const

Returns the font for the checkbox label.

void SetFont(GlowFont font)

Sets the font for the checkbox label.

int GetSpacing(void) const

Returns the pixel spacing between the box and label.

void SetSpacing(int spacing)

Sets the pixel spacing between the box and label.

GlowCheckBoxWidget::Behavior GetBehavior(void) const

Returns the current behavior options of the checkbox.

void SetBehavior(GlowCheckBoxWidget::Behavior behavior)

Sets the behavior options of the checkbox.

GlowCheckBoxWidget::State GetState(void) const

Returns the current state of the checkbox.

void SetState(GlowCheckBoxWidget::State state)

Sets the current state of the checkbox.

void ToggleState(void)

Toggles the state of the checkbox according to the current behavior.

Color attributes

GlowColor GetBoxColor(void) const

void SetBoxColor(GlowColor c)

GlowColor GetTextColor(void) const

void SetTextColor(GlowColor c)

GlowColor GetCheckColor(void) const

void SetCheckColor(GlowColor c)

GlowColor GetHiliteBoxColor(void) const

void SetHiliteBoxColor(GlowColor c)

GlowColor GetHiliteTextColor(void) const

void SetHiliteTextColor(GlowColor c)

GlowColor GetHiliteCheckColor(void) const

void SetHiliteCheckColor(GlowColor c)

GlowColor GetDisableBoxColor(void) const

void SetDisableBoxColor(GlowColor c)

GlowColor GetDisableTextColor(void) const

void SetDisableTextColor(GlowColor c)

GlowColor GetDisableCheckColor(void) const

void SetDisableCheckColor(GlowColor c)

GlowColor GetDisableOutlineColor(void) const

void SetDisableOutlineColor(GlowColor c)

GlowColor GetLightBevelColor(void) const

void SetLightBevelColor(GlowColor c)

GlowColor GetDarkBevelColor(void) const

void SetDarkBevelColor(GlowColor c)

Other methods

void CropWidth(void)

Reduces the width of a checkbox to fit snugly around the label. Only reduces the width: does not widen the widget if it is too narrow to contain the label.

TSender<const GlowCheckBoxMessage&>& Notifier(void)

Returns a reference to the sender used by the checkbox to notify objects of changes to the state. Bind this sender to a GlowCheckBoxReceiver to cause that receiver to be notified when the user toggles the checkbox.

void Hit(Glow::MouseButton mouseButton, Glow::Modifiers modifiers)

Simulates a hit on this check box by calling the OnHit() method.

Inherited methods
These methods are inherited from GlowWidget.

void Move(int x, int y)

int PositionX(void) const

int PositionY(void) const

int RootPositionX(void) const

int RootPositionY(void) const

int GlobalPositionX(void) const

int GlobalPositionY(void) const

void Reshape(int width, int height)

int Width(void) const

int Height(void) const

GlowWidget::AutoPackError AutoPack(int leftLimit, int rightLimit, int topLimit, int bottomLimit, GlowWidget::AutoPackOptions hOption, GlowWidget::AutoPackOptions vOption, int& leftMargin, int& rightMargin, int& topMargin, int& bottomMargin)
GlowWidget::AutoPackError AutoPack(int leftLimit, int rightLimit, int topLimit, int bottomLimit, GlowWidget::AutoPackOptions hOption, GlowWidget::AutoPackOptions vOption)

GlowWidget::AutoPackError AutoReshape(int& leftMargin, int& rightMargin, int& topMargin, int& bottomMargin)
GlowWidget::AutoPackError AutoReshape()

void Hide(void)

void Show(void)

bool IsVisible(void) const

bool IsInvisible(void) const

bool IsVisibleMasked(void) const

void Refresh(void)

void SetRefreshEnabled(bool enabled)

bool IsRefreshEnabled(void) const

void SetClipping(bool clip)

bool IsClipping(void)

void GrabKeyboardFocus(void)

Checkboxes should not attempt to grab the keyboard focus unless a subclass makes use of keyboard events.

void RelinquishKeyboardFocus(void)

bool HasKeyboardFocus(void)

GlowWidgetRoot* Root(void)

void SetRefCon(long refcon)

long GetRefCon(void)

Inherited methods
These methods are inherited from GlowComponent.

void Close(void)

GlowComponent* Parent(void) const

GlowSubwindow* WhichWindow(void)

GlowSubwindow* ParentWindow(void) const

GlowWindow* ToplevelWindow(void)

bool IsToplevel(void) const

GlowComponent* Next(void) const

GlowComponent* Prev(void) const

int NumChildren(void) const

GlowComponent* FirstChild(void) const

GlowComponent* LastChild(void) const

void ReorderChild(GlowComponent* child, GlowComponent* pos)

void KillChildren(void)

void Activate(void)

void Deactivate(void)

bool IsActive(void)

bool IsInactive(void)

bool IsActiveStandby(void)

void Paint(void)

Protected methods for subclasses

Initialization

void Init(GlowWidgetRoot* root, GlowWidget* parent, const GlowCheckBoxParams& params)

Initializes a new GlowCheckBoxWidget using the given params and adds it to root's hierarchy under parent. parent must be present in root's hierarchy.

Inherited methods
These methods are inherited from GlowWidget.

void NormalizeCoordinates(int x, int y, GLfloat& xn, GLfloat& yn) const

void RegisterMouseEvents(void)

void RegisterKeyboardEvents(void)

void UnegisterMouseEvents(void)

void UnregisterKeyboardEvents(void)

Overrideable methods

Event handlers
These methods are called as soon as a widget-level event occurs. The default methods typically send the appropriate messages to the attached receivers.

virtual void OnHit(Glow::MouseButton mouseButton, Glow::Modifiers modifiers)

Called when a checkbox has been toggled. mouseButton is the mouse button pressed (see constants in Glow) and modifiers gives the keyboard modifiers that were down when the mouse button was pressed. The default method toggles the state according to the current behavior and sends messages to the attached GlowCheckBoxReceivers.

Inherited methods
These methods are inherited from GlowWidget.

virtual void OnWidgetPaint(void)

GlowCheckBoxWidget overrides this method to draw the check box. You should not override it again unless a subclass needs to modify how checkboxes are drawn.

virtual void OnWidgetMouseDown(Glow::MouseButton mouseButton, int x, int y, Glow::Modifiers modifiers)

GlowCheckBoxWidget overrides this method to handle mouse events. You should not override it again unless a subclass needs to modify how events are handled.

virtual void OnWidgetMouseUp(Glow::MouseButton mouseButton, int x, int y, Glow::Modifiers modifiers)

GlowCheckBoxWidget overrides this method to handle mouse events. You should not override it again unless a subclass needs to modify how events are handled.

virtual void OnWidgetMouseDrag(int x, int y)

GlowCheckBoxWidget overrides this method to handle mouse events. You should not override it again unless a subclass needs to modify how events are handled.

virtual void OnWidgetKeyboard(Glow::KeyCode key, int x, int y, Glow::Modifiers modifiers)

The standard GlowCheckBoxWidget does not handle keyboard events. Override this method if a subclass needs to receive keyboard events.

virtual void OnWidgetMove(int x, int y)

virtual void OnWidgetReshape(int width, int height)

virtual void OnWidgetInvisible(void)

virtual void OnWidgetVisible(void)

virtual void OnWidgetDeactivate(void)

virtual void OnWidgetActivate(void)

virtual void OnGotKeyboardFocus(void)

virtual void OnLostKeyboardFocus(void)

virtual GlowWidget::AutoPackError OnAutoPack(int hSize, int vSize, GlowWidget::AutoPackOptions hOption, GlowWidget::AutoPackOptions vOption, int& leftMargin, int& rightMargin, int& topMargin, int& bottomMargin)

GlowCheckBoxWidget implements this method to pack a checkbox. Override it if a subclass requires different packing.

Inherited methods
These methods are inherited from GlowComponent, but are used by GlowWidget and should not be overridden again.

virtual void OnActivate(void)

virtual void OnDeactivate(void)

virtual void OnBeginPaint(void)

virtual void OnEndPaint(void)


Back to
Table of contents


The GLOW Toolkit