Public Member Functions | Protected Member Functions

ShapeButton Class Reference

A button that contains a filled shape. More...

Inherits Button.

List of all members.

Public Member Functions

 ShapeButton (const String &name, const Colour &normalColour, const Colour &overColour, const Colour &downColour)
 Creates a ShapeButton.
 ~ShapeButton ()
 Destructor.
void setShape (const Path &newShape, bool resizeNowToFitThisShape, bool maintainShapeProportions, bool hasDropShadow)
 Sets the shape to use.
void setColours (const Colour &normalColour, const Colour &overColour, const Colour &downColour)
 Set the colours to use for drawing the shape.
void setOutline (const Colour &outlineColour, float outlineStrokeWidth)
 Sets up an outline to draw around the shape.

Protected Member Functions

void paintButton (Graphics &g, bool isMouseOverButton, bool isButtonDown)
 Subclasses should override this to actually paint the button's contents.

Detailed Description

A button that contains a filled shape.

See also:
Button, ImageButton, TextButton, ArrowButton

Constructor & Destructor Documentation

ShapeButton::ShapeButton ( const String name,
const Colour normalColour,
const Colour overColour,
const Colour downColour 
)

Creates a ShapeButton.

Parameters:
namea name to give the component - see Component::setName()
normalColourthe colour to fill the shape with when the mouse isn't over
overColourthe colour to use when the mouse is over the shape
downColourthe colour to use when the button is in the pressed-down state
ShapeButton::~ShapeButton (  )

Destructor.


Member Function Documentation

void ShapeButton::setShape ( const Path newShape,
bool  resizeNowToFitThisShape,
bool  maintainShapeProportions,
bool  hasDropShadow 
)

Sets the shape to use.

Parameters:
newShapethe shape to use
resizeNowToFitThisShapeif true, the button will be resized to fit the shape's bounds
maintainShapeProportionsif true, the shape's proportions will be kept fixed when the button is resized
hasDropShadowif true, the button will be given a drop-shadow effect
void ShapeButton::setColours ( const Colour normalColour,
const Colour overColour,
const Colour downColour 
)

Set the colours to use for drawing the shape.

Parameters:
normalColourthe colour to fill the shape with when the mouse isn't over
overColourthe colour to use when the mouse is over the shape
downColourthe colour to use when the button is in the pressed-down state
void ShapeButton::setOutline ( const Colour outlineColour,
float  outlineStrokeWidth 
)

Sets up an outline to draw around the shape.

Parameters:
outlineColourthe colour to use
outlineStrokeWidththe thickness of line to draw
void ShapeButton::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