JUCE
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines
Public Types | Public Member Functions
ColourSelector Class Reference

A component that lets the user choose a colour. More...

Inherits Component, ChangeBroadcaster, and Slider::Listener.

List of all members.

Public Types

enum  ColourSelectorOptions { showAlphaChannel = 1 << 0, showColourAtTop = 1 << 1, showSliders = 1 << 2, showColourspace = 1 << 3 }
 Options for the type of selector to show. More...
enum  ColourIds { backgroundColourId = 0x1007000, labelTextColourId = 0x1007001 }
 A set of colour IDs to use to change the colour of various aspects of the keyboard. More...

Public Member Functions

 ColourSelector (int sectionsToShow=(showAlphaChannel|showColourAtTop|showSliders|showColourspace), int edgeGap=4, int gapAroundColourSpaceComponent=7)
 Creates a ColourSelector object.
 ~ColourSelector ()
 Destructor.
Colour getCurrentColour () const
 Returns the colour that the user has currently selected.
void setCurrentColour (const Colour &newColour)
 Changes the colour that is currently being shown.
virtual int getNumSwatches () const
 Tells the selector how many preset colour swatches you want to have on the component.
virtual Colour getSwatchColour (int index) const
 Called by the selector to find out the colour of one of the swatches.
virtual void setSwatchColour (int index, const Colour &newColour) const
 Called by the selector when the user puts a new colour into one of the swatches.

Detailed Description

A component that lets the user choose a colour.

This shows RGB sliders and a colourspace that the user can pick colours from.

This class is also a ChangeBroadcaster, so listeners can register to be told when the colour changes.


Member Enumeration Documentation

Options for the type of selector to show.

These are passed into the constructor.

Enumerator:
showAlphaChannel 

if set, the colour's alpha channel can be changed as well as its RGB.

showColourAtTop 

if set, a swatch of the colour is shown at the top of the component.

showSliders 

if set, RGB sliders are shown at the bottom of the component.

showColourspace 

if set, a big HSV selector is shown.

A set of colour IDs to use to change the colour of various aspects of the keyboard.

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:
backgroundColourId 

the colour used to fill the component's background.

labelTextColourId 

the colour used for the labels next to the sliders.


Constructor & Destructor Documentation

ColourSelector::ColourSelector ( int  sectionsToShow = (showAlphaChannel|showColourAtTop|showSliders|showColourspace),
int  edgeGap = 4,
int  gapAroundColourSpaceComponent = 7 
)

Creates a ColourSelector object.

The flags are a combination of values from the ColourSelectorOptions enum, specifying which of the selector's features should be visible.

The edgeGap value specifies the amount of space to leave around the edge.

gapAroundColourSpaceComponent indicates how much of a gap to put around the colourspace and hue selector components.

Destructor.


Member Function Documentation

Returns the colour that the user has currently selected.

The ColourSelector class is also a ChangeBroadcaster, so listeners can register to be told when the colour changes.

See also:
setCurrentColour
void ColourSelector::setCurrentColour ( const Colour newColour)

Changes the colour that is currently being shown.

virtual int ColourSelector::getNumSwatches ( ) const [virtual]

Tells the selector how many preset colour swatches you want to have on the component.

To enable swatches, you'll need to override getNumSwatches(), getSwatchColour(), and setSwatchColour(), to return the number of colours you want, and to set and retrieve their values.

virtual Colour ColourSelector::getSwatchColour ( int  index) const [virtual]

Called by the selector to find out the colour of one of the swatches.

Your subclass should return the colour of the swatch with the given index.

To enable swatches, you'll need to override getNumSwatches(), getSwatchColour(), and setSwatchColour(), to return the number of colours you want, and to set and retrieve their values.

virtual void ColourSelector::setSwatchColour ( int  index,
const Colour newColour 
) const [virtual]

Called by the selector when the user puts a new colour into one of the swatches.

Your subclass should change the colour of the swatch with the given index.

To enable swatches, you'll need to override getNumSwatches(), getSwatchColour(), and setSwatchColour(), to return the number of colours you want, and to set and retrieve their values.


The documentation for this class was generated from the following file: