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, 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)
void colourChanged ()

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,
const String toolTip = String::empty 
)

Creates a TextButton.

Parameters:
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
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]

For internal use only.

Implements Button.

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

For internal use only.

Reimplemented from Component.


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Mon Apr 26 11:42:19 2010 for JUCE by  doxygen 1.6.3