A button that can be toggled on/off. More...
Inherits Button.
Public Types | |
| enum | ColourIds { textColourId = 0x1006501 } |
A set of colour IDs to use to change the colour of various aspects of the button. More... | |
Public Member Functions | |
| ToggleButton (const String &buttonText=String::empty) | |
| Creates a ToggleButton. | |
| ~ToggleButton () | |
| Destructor. | |
| void | changeWidthToFitText () |
| Resizes the button to fit neatly around its current text. | |
Protected Member Functions | |
| void | paintButton (Graphics &g, bool isMouseOverButton, bool isButtonDown) |
| Subclasses should override this to actually paint the button's contents. | |
| void | colourChanged () |
| This method is called when a colour is changed by the setColour() method. | |
A button that can be toggled on/off.
All buttons can be toggle buttons, but this lets you create one of the standard ones which has a tick-box and a text label next to it.
A set of colour IDs to use to change the colour of various aspects of the button.
These constants can be used either via the Component::setColour(), or LookAndFeel::setColour() methods.
| ToggleButton::ToggleButton | ( | const String & | buttonText = String::empty ) |
[explicit] |
Creates a ToggleButton.
| buttonText | the text to put in the button (the component's name is also initially set to this string, but these can be changed later using the setName() and setButtonText() methods) |
| ToggleButton::~ToggleButton | ( | ) |
Destructor.
| void ToggleButton::changeWidthToFitText | ( | ) |
Resizes the button to fit neatly around its current text.
The button's height won't be affected, only its width.
| void ToggleButton::paintButton | ( | Graphics & | g, |
| bool | isMouseOverButton, | ||
| bool | isButtonDown | ||
| ) | [protected, virtual] |
Subclasses should override this to actually paint the button's contents.
It's better to use this than the paint method, because it gives you information about the over/down state of the button.
| g | the graphics context to use |
| isMouseOverButton | true if the button is either in the 'over' or 'down' state |
| isButtonDown | true if the button should be drawn in the 'down' position |
Implements Button.
| void ToggleButton::colourChanged | ( | ) | [protected, virtual] |
This method is called when a colour is changed by the setColour() method.
Reimplemented from Component.