Public Types | Public Member Functions | Protected Member Functions

HyperlinkButton Class Reference

A button showing an underlined weblink, that will launch the link when it's clicked. More...

Inherits Button.

List of all members.

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 URLgetURL () 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.

Detailed Description

A button showing an underlined weblink, that will launch the link when it's clicked.

See also:
Button

Member Enumeration Documentation

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.

See also:
Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour
Enumerator:
textColourId 

The colour to use for the URL text.


Constructor & Destructor Documentation

HyperlinkButton::HyperlinkButton ( const String linkText,
const URL linkURL 
)

Creates a HyperlinkButton.

Parameters:
linkTextthe 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
linkURLthe URL to launch when the user clicks the button
HyperlinkButton::~HyperlinkButton (  )

Destructor.


Member Function Documentation

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::setURL ( const URL newURL )

Changes the URL that the button will trigger.

const URL& HyperlinkButton::getURL (  ) const

Returns the URL that the button will trigger.

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.

See also:
triggerClick

Reimplemented from Button.

void HyperlinkButton::colourChanged (  ) [protected, virtual]

This method is called when a colour is changed by the setColour() method.

See also:
setColour, findColour

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.

Parameters:
gthe graphics context to use
isMouseOverButtontrue if the button is either in the 'over' or 'down' state
isButtonDowntrue if the button should be drawn in the 'down' position

Implements Button.


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines