Public Types | Public Member Functions | Protected Member Functions

TextButton Class Reference

A button that uses the standard lozenge-shaped background with a line of text on it. More...

Inherits Button.

List of all members.

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.

Detailed Description

A button that uses the standard lozenge-shaped background with a line of text on it.

See also:
Button, DrawableButton

Member Enumeration Documentation

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.

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

The colour used to fill the button shape (when the button is toggled 'off').

The look-and-feel class might re-interpret this to add effects, etc.

buttonOnColourId 

The colour used to fill the button shape (when the button is toggled 'on').

The look-and-feel class might re-interpret this to add effects, etc.

textColourOffId 

The colour to use for the button's text when the button's toggle state is "off".

textColourOnId 

The colour to use for the button's text.when the button's toggle state is "on".


Constructor & Destructor Documentation

TextButton::TextButton ( const String buttonName = String::empty,
const String toolTip = String::empty 
)

Creates a TextButton.

Parameters:
buttonNamethe 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)
toolTipan optional string to use as a toolip
See also:
Button
TextButton::~TextButton (  )

Destructor.


Member Function Documentation

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.

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.

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

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

See also:
setColour, findColour

Reimplemented from Component.


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