Public Member Functions

PropertyPanel Class Reference

A panel that holds a list of PropertyComponent objects. More...

Inherits Component.

List of all members.

Public Member Functions

 PropertyPanel ()
 Creates an empty property panel.
 ~PropertyPanel ()
 Destructor.
void clear ()
 Deletes all property components from the panel.
void addProperties (const Array< PropertyComponent * > &newPropertyComponents)
 Adds a set of properties to the panel.
void addSection (const String &sectionTitle, const Array< PropertyComponent * > &newPropertyComponents, bool shouldSectionInitiallyBeOpen=true)
 Adds a set of properties to the panel.
void refreshAll () const
 Calls the refresh() method of all PropertyComponents in the panel.
StringArray getSectionNames () const
 Returns a list of all the names of sections in the panel.
bool isSectionOpen (int sectionIndex) const
 Returns true if the section at this index is currently open.
void setSectionOpen (int sectionIndex, bool shouldBeOpen)
 Opens or closes one of the sections.
void setSectionEnabled (int sectionIndex, bool shouldBeEnabled)
 Enables or disables one of the sections.
XmlElementgetOpennessState () const
 Saves the current state of open/closed sections so it can be restored later.
void restoreOpennessState (const XmlElement &newState)
 Restores a previously saved arrangement of open/closed sections.
void setMessageWhenEmpty (const String &newMessage)
 Sets a message to be displayed when there are no properties in the panel.
const StringgetMessageWhenEmpty () const
 Returns the message that is displayed when there are no properties.
void paint (Graphics &g)
 Components can override this method to draw their content.
void resized ()
 Called when this component's size has been changed.

Detailed Description

A panel that holds a list of PropertyComponent objects.

This panel displays a list of PropertyComponents, and allows them to be organised into collapsible sections.

To use, simply create one of these and add your properties to it with addProperties() or addSection().

See also:
PropertyComponent

Constructor & Destructor Documentation

PropertyPanel::PropertyPanel (  )

Creates an empty property panel.

PropertyPanel::~PropertyPanel (  )

Destructor.


Member Function Documentation

void PropertyPanel::clear (  )

Deletes all property components from the panel.

void PropertyPanel::addProperties ( const Array< PropertyComponent * > &  newPropertyComponents )

Adds a set of properties to the panel.

The components in the list will be owned by this object and will be automatically deleted later on when no longer needed.

These properties are added without them being inside a named section. If you want them to be kept together in a collapsible section, use addSection() instead.

void PropertyPanel::addSection ( const String sectionTitle,
const Array< PropertyComponent * > &  newPropertyComponents,
bool  shouldSectionInitiallyBeOpen = true 
)

Adds a set of properties to the panel.

These properties are added at the bottom of the list, under a section heading with a plus/minus button that allows it to be opened and closed.

The components in the list will be owned by this object and will be automatically deleted later on when no longer needed.

To add properies without them being in a section, use addProperties().

void PropertyPanel::refreshAll (  ) const

Calls the refresh() method of all PropertyComponents in the panel.

StringArray PropertyPanel::getSectionNames (  ) const

Returns a list of all the names of sections in the panel.

These are the sections that have been added with addSection().

bool PropertyPanel::isSectionOpen ( int  sectionIndex ) const

Returns true if the section at this index is currently open.

The index is from 0 up to the number of items returned by getSectionNames().

void PropertyPanel::setSectionOpen ( int  sectionIndex,
bool  shouldBeOpen 
)

Opens or closes one of the sections.

The index is from 0 up to the number of items returned by getSectionNames().

void PropertyPanel::setSectionEnabled ( int  sectionIndex,
bool  shouldBeEnabled 
)

Enables or disables one of the sections.

The index is from 0 up to the number of items returned by getSectionNames().

XmlElement* PropertyPanel::getOpennessState (  ) const

Saves the current state of open/closed sections so it can be restored later.

The caller is responsible for deleting the object that is returned.

To restore this state, use restoreOpennessState().

See also:
restoreOpennessState
void PropertyPanel::restoreOpennessState ( const XmlElement newState )

Restores a previously saved arrangement of open/closed sections.

This will try to restore a snapshot of the panel's state that was created by the getOpennessState() method. If any of the sections named in the original XML aren't present, they will be ignored.

See also:
getOpennessState
void PropertyPanel::setMessageWhenEmpty ( const String newMessage )

Sets a message to be displayed when there are no properties in the panel.

The default message is "nothing selected".

const String& PropertyPanel::getMessageWhenEmpty (  ) const

Returns the message that is displayed when there are no properties.

See also:
setMessageWhenEmpty
void PropertyPanel::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 PropertyPanel::resized (  ) [virtual]

Called when this component's size has been changed.

A component can implement this method to do things such as laying out its child components when its width or height changes.

The method is called synchronously as a result of the setBounds or setSize methods, so repeatedly changing a components size will repeatedly call its resized method (unlike things like repainting, where multiple calls to repaint are coalesced together).

If the component is a top-level window on the desktop, its size could also be changed by operating-system factors beyond the application's control.

See also:
moved, setSize

Reimplemented from Component.


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