class MASKING_DLL_DECLSPEC Button

Button is a simple widget that implements the functionality of several types of buttons.

Inheritance:

Button - Label - Widget - Rect


Public Methods

[more] Button()
default constructor
[more]void Setup(int x, int y, int w, int h, int key, int flags, const char* text)
Like Label::Setup() with the exception that there is no text alignment parameter.
[more]void Setup(int x, int y, int w, int h, int key, int flags, const char* file, int index, const char* text=NULL)
[more]void Setup(int x, int y, int w, int h, int key, int flags, Bitmap &bmp, int index, const char* text=NULL)
[more]void Setup(int x, int y, int w, int h, int key, int flags, int index, const char* text=NULL)
Extra overloads for easily changing the default button bitmap.

Protected Fields

[more]int counter
A couple of counters that help make sure the button is properly animated when MSG_KEY is received and that MSG_ACTIVATE messages are sent at regular intervals if D_SPINNER is set
[more]int spinCounter
See counter

Protected Methods

[more]void Draw(Bitmap &canvas)
Draws the button on the canvas.
[more]void MsgStart()
Initializes the button whe the dialog starts
[more]void MsgInitSkin()
Initializes the button with the default bitmap, fonts and font colours from the skin
[more]void MsgGotfocus()
Every time a button gets or loses input focus it plays an appropriate sound and animates itself
[more]void MsgLostfocus()
See MsgGotfocus()
[more]void MsgKey()
When a button receives a MSG_KEY it simulates a mouse click
[more]void MsgLPress()
When a button receives MSG_LPRESS it just sets the D_PRESSED flag.
[more]void MsgLRelease()
See MsgLPress();
[more]bool MsgWantfocus()
returns true
[more]void MsgTick()
Handles animating the button after receiving a MSG_KEY message (it toggles the button back a few hundred miliseconds after MsgKey() was called) and makes sure MSG_ACTIVATE messages are sent at regular intervals to the parent dialog if D_SPINNER is set
[more]void Toggle()
Toggles the button's state between normal and selected states and animates it
[more]void UpdateSize()
If D_AUTOSIZE flag is set this function resizes the button to the size of the button bitmap.


Documentation

Button is a simple widget that implements the functionality of several types of buttons. When a button is clicked or the button's shortcut is pressed or space or enter is pressed while the button has input focus, it sends a MSG_ACTIVATE message to its parent dialog. If the D_TOGGLE flag is set the button can be toggled on and off otherwise it is a normal push button. If the D_SPINNER flag is set the button sends MSG_ACTIVATE to the parent dialog at regular intervals while it is being pressed down otherwise it sends MSG_ACTIVATE only when it is released. The button can contain text or it can only have a button bitmap. In that case it automatically resizes itself to the size of the bitmap if the D_AUTOSIZE flag is set.
oint counter
A couple of counters that help make sure the button is properly animated when MSG_KEY is received and that MSG_ACTIVATE messages are sent at regular intervals if D_SPINNER is set

oint spinCounter
See counter

ovoid Draw(Bitmap &canvas)
Draws the button on the canvas. The button can draw either a button bitmap or text or both.

ovoid MsgStart()
Initializes the button whe the dialog starts

ovoid MsgInitSkin()
Initializes the button with the default bitmap, fonts and font colours from the skin

ovoid MsgGotfocus()
Every time a button gets or loses input focus it plays an appropriate sound and animates itself

ovoid MsgLostfocus()
See MsgGotfocus()

ovoid MsgKey()
When a button receives a MSG_KEY it simulates a mouse click

ovoid MsgLPress()
When a button receives MSG_LPRESS it just sets the D_PRESSED flag. When the mouse button is later released the button sends a MSG_ACTIVATE to its parent dialog if the mouse release was made while the mouse was still on top of the button or just clears the D_PRESSED flag to abort detecting a button click if the mouse button was released outside of the button.

ovoid MsgLRelease()
See MsgLPress();

obool MsgWantfocus()
returns true

ovoid MsgTick()
Handles animating the button after receiving a MSG_KEY message (it toggles the button back a few hundred miliseconds after MsgKey() was called) and makes sure MSG_ACTIVATE messages are sent at regular intervals to the parent dialog if D_SPINNER is set

ovoid Toggle()
Toggles the button's state between normal and selected states and animates it

ovoid UpdateSize()
If D_AUTOSIZE flag is set this function resizes the button to the size of the button bitmap. This makes it possible to create icon buttons.

o Button()
default constructor

ovoid Setup(int x, int y, int w, int h, int key, int flags, const char* text)
Like Label::Setup() with the exception that there is no text alignment parameter. On a button the text is always centered.

ovoid Setup(int x, int y, int w, int h, int key, int flags, const char* file, int index, const char* text=NULL)

ovoid Setup(int x, int y, int w, int h, int key, int flags, Bitmap &bmp, int index, const char* text=NULL)

ovoid Setup(int x, int y, int w, int h, int key, int flags, int index, const char* text=NULL)
Extra overloads for easily changing the default button bitmap. To change the bitmap the button will use, you first need to upload it to the skin and then pass its index in the skin bitmap array to Button::SetBitmap(). These functions are shortcuts for doing that in only one step. Pass the index of the bitmap you want to assign to the button and either the bitmap you want to upload to the skin or the path to the file you want to upload.


Direct child classes:
Header
HyperText
CheckBox

Alphabetic index Hierarchy of classes


Back to front page   |   page generated with DOC++