Public Types | Public Member Functions

GroupComponent Class Reference

A component that draws an outline around itself and has an optional title at the top, for drawing an outline around a group of controls. More...

Inherits Component.

List of all members.

Public Types

enum  ColourIds { outlineColourId = 0x1005400, textColourId = 0x1005410 }
 

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

More...

Public Member Functions

 GroupComponent (const String &componentName=String::empty, const String &labelText=String::empty)
 Creates a GroupComponent.
 ~GroupComponent ()
 Destructor.
void setText (const String &newText)
 Changes the text that's shown at the top of the component.
String getText () const
 Returns the currently displayed text label.
void setTextLabelPosition (const Justification &justification)
 Sets the positioning of the text label.
const Justification getTextLabelPosition () const noexcept
 Returns the current text label position.
void paint (Graphics &g)
 Components can override this method to draw their content.
void enablementChanged ()
 Callback to indicate that this component has been enabled or disabled.
void colourChanged ()
 This method is called when a colour is changed by the setColour() method.

Detailed Description

A component that draws an outline around itself and has an optional title at the top, for drawing an outline around a group of controls.


Member Enumeration Documentation

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

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

The colour to use for drawing the line around the edge.

textColourId 

The colour to use to draw the text label.


Constructor & Destructor Documentation

GroupComponent::GroupComponent ( const String componentName = String::empty,
const String labelText = String::empty 
)

Creates a GroupComponent.

Parameters:
componentNamethe name to give the component
labelTextthe text to show at the top of the outline
GroupComponent::~GroupComponent (  )

Destructor.


Member Function Documentation

void GroupComponent::setText ( const String newText )

Changes the text that's shown at the top of the component.

String GroupComponent::getText (  ) const

Returns the currently displayed text label.

void GroupComponent::setTextLabelPosition ( const Justification justification )

Sets the positioning of the text label.

(The default is Justification::left)

See also:
getTextLabelPosition
const Justification GroupComponent::getTextLabelPosition (  ) const

Returns the current text label position.

See also:
setTextLabelPosition
void GroupComponent::paint ( Graphics g ) [virtual]

Components can override this method to draw their content.

The paint() method gets called when a region of a component needs redrawing, either because the component's repaint() method has been called, or because something has happened on the screen that means a section of a window needs to be redrawn.

Any child components will draw themselves over whatever this method draws. If you need to paint over the top of your child components, you can also implement the paintOverChildren() method to do this.

If you want to cause a component to redraw itself, this is done asynchronously - calling the repaint() method marks a region of the component as "dirty", and the paint() method will automatically be called sometime later, by the message thread, to paint any bits that need refreshing. In Juce (and almost all modern UI frameworks), you never redraw something synchronously.

You should never need to call this method directly - to take a snapshot of the component you could use createComponentSnapshot() or paintEntireComponent().

Parameters:
gthe graphics context that must be used to do the drawing operations.
See also:
repaint, paintOverChildren, Graphics

Reimplemented from Component.

void GroupComponent::enablementChanged (  ) [virtual]

Callback to indicate that this component has been enabled or disabled.

This can be triggered by one of the component's parent components being enabled or disabled, as well as changes to the component itself.

The default implementation of this method does nothing; your class may wish to repaint itself or something when this happens.

See also:
setEnabled, isEnabled

Reimplemented from Component.

void GroupComponent::colourChanged (  ) [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