A button showing an underlined weblink, that will launch the link when it's clicked. More...
Inherits Button.
Public Types | |
| enum | ColourIds { textColourId = 0x1001f00 } |
A set of colour IDs to use to change the colour of various aspects of the link. More... | |
Public Member Functions | |
| HyperlinkButton (const String &linkText, const URL &linkURL) | |
| Creates a HyperlinkButton. | |
| ~HyperlinkButton () | |
| Destructor. | |
| void | setFont (const Font &newFont, bool resizeToMatchComponentHeight, const Justification &justificationType=Justification::horizontallyCentred) |
| Changes the font to use for the text. | |
| void | setURL (const URL &newURL) noexcept |
| Changes the URL that the button will trigger. | |
| const URL & | getURL () const noexcept |
| Returns the URL that the button will trigger. | |
| void | changeWidthToFitText () |
| Resizes the button horizontally to fit snugly around the text. | |
Protected Member Functions | |
| void | clicked () |
| This method is called when the button has been clicked. | |
| void | colourChanged () |
| This method is called when a colour is changed by the setColour() method. | |
| void | paintButton (Graphics &g, bool isMouseOverButton, bool isButtonDown) |
| Subclasses should override this to actually paint the button's contents. | |
A button showing an underlined weblink, that will launch the link when it's clicked.
A set of colour IDs to use to change the colour of various aspects of the link.
These constants can be used either via the Component::setColour(), or LookAndFeel::setColour() methods.
| textColourId |
The colour to use for the URL text. |
Creates a HyperlinkButton.
| linkText | the text that will be displayed in the button - this is also set as the Component's name, but the text can be changed later with the Button::getButtonText() method |
| linkURL | the URL to launch when the user clicks the button |
| HyperlinkButton::~HyperlinkButton | ( | ) |
Destructor.
| void HyperlinkButton::setFont | ( | const Font & | newFont, |
| bool | resizeToMatchComponentHeight, | ||
| const Justification & | justificationType = Justification::horizontallyCentred |
||
| ) |
Changes the font to use for the text.
If resizeToMatchComponentHeight is true, the font's height will be adjusted to match the size of the component.
| void HyperlinkButton::changeWidthToFitText | ( | ) |
Resizes the button horizontally to fit snugly around the text.
This won't affect the button's height.
| void HyperlinkButton::clicked | ( | ) | [protected, virtual] |
This method is called when the button has been clicked.
Subclasses can override this to perform whatever they actions they need to do.
Alternatively, a ButtonListener can be added to the button, and these listeners will be called when the click occurs.
Reimplemented from Button.
| void HyperlinkButton::colourChanged | ( | ) | [protected, virtual] |
This method is called when a colour is changed by the setColour() method.
Reimplemented from Component.
| void HyperlinkButton::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.