A button that uses the standard lozenge-shaped background with a line of text on it. More...
Inherits Button.
Public Types | |
| enum | ColourIds { buttonColourId = 0x1000100, buttonOnColourId = 0x1000101, textColourOffId = 0x1000102, textColourOnId = 0x1000103 } |
A set of colour IDs to use to change the colour of various aspects of the button. More... | |
Public Member Functions | |
| TextButton (const String &buttonName=String::empty, const String &toolTip=String::empty) | |
| Creates a TextButton. | |
| ~TextButton () | |
| Destructor. | |
| void | changeWidthToFitText (int newHeight=-1) |
| Resizes the button to fit neatly around its current text. | |
| virtual const Font | getFont () |
| This can be overridden to use different fonts than the default one. | |
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 uses the standard lozenge-shaped background with a line of text on 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.
| TextButton::TextButton | ( | const String & | buttonName = String::empty, |
| const String & | toolTip = String::empty |
||
| ) |
Creates a TextButton.
| buttonName | 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) |
| toolTip | an optional string to use as a toolip |
| TextButton::~TextButton | ( | ) |
Destructor.
| void TextButton::changeWidthToFitText | ( | int | newHeight = -1 ) |
Resizes the button to fit neatly around its current text.
If newHeight is >= 0, the button's height will be changed to this value. If it's less than zero, its height will be unaffected.
| virtual const Font TextButton::getFont | ( | ) | [virtual] |
This can be overridden to use different fonts than the default one.
Note that you'll need to set the font's size appropriately, too.
| void TextButton::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 TextButton::colourChanged | ( | ) | [protected, virtual] |
This method is called when a colour is changed by the setColour() method.
Reimplemented from Component.