A completely custom-drawn bitmapped button. The class wxClearButton provides a number of features: When the user mouses over, if the button is enabled, the cursor is changed to a hand, indicating the user can click the button. When clicked, the button shifts itself one pixel right and down, to give visual feedback that is in the down state. The click message to the parent is not sent unless the mouse button is released, and the mouse is still over the button. This emulates the Windows OS. The button may also be set with a certain color, which “colorizes” the bitmap with that color, allowing for custom colors with minimal fuss. If the button is disabled, it is shown with no color at all, indicating its disabled state. The button is drawn using memory bitmaps, to completely remove flicker. Finally, the font used to draw the label on the button is resized if the button is resized so that its height is always around 70% or less of the available button height, giving a consistent look, even on differently sized buttons.
wxWindow (see http://www.wxwindows.org/manuals/2.4.2/wx411.htm)
ClearButton.h
A completely custom-drawn bitmapped button. | |
The wxClearButton constructor. | |
Enables or disables the button. | |
Sets the button text. | |
The wxWidgets event table declaration. | |
Mouse handling flags. | |
Paints the button using the disabled/enabled bitmap image and the label text. | |
Paints the button. | |
Erases the button. | |
Resizes the button. | |
Handles the mouse entering the button’s rectangle. | |
Handles the left mouse down event. | |
Handles the left mouse up event. | |
Handles the mouse leaving the button’s rectangle. | |
The memory bitmap for the window. | |
The button text. | |
The enabled bitmap. | |
The disabled bitmap. | |
The color the button is colorized with. | |
The font the button text is drawn with. | |
The button mode. |
|
The wxClearButton constructor. Creates the button with the given label, size, and color.
| parent | The parent window. Must not be NULL. |
| id | The message handling ID. Should be a unique (to the parent window) ID, if the parent window wants to receive messages from the control. |
| label | The button text. |
| size | The button size. |
| color | The color the button should be colorized with. |
Mouse handling flags. | |
Paints the button using the disabled/enabled bitmap image and the label text. | |
Paints the button. | |
Erases the button. | |
Resizes the button. | |
Handles the mouse entering the button’s rectangle. | |
Handles the left mouse down event. | |
Handles the left mouse up event. | |
Handles the mouse leaving the button’s rectangle. | |
The memory bitmap for the window. | |
The button text. | |
The enabled bitmap. | |
The disabled bitmap. | |
The color the button is colorized with. | |
The font the button text is drawn with. | |
The button mode. |
|
|
|
|
|
|
|
|
|
|
|
| wxBitmap mMemBitmap |
| wxString mLabel |
| wxBitmap mEnabledBitmap |
| wxBitmap mDisabledBitmap |
| wxColour mColor |
| wxFont mFont |
| Mode mMode |