Browse Source

Minor fix + isEmpty() method for PropertyPanel.

tags/2021-05-28
jules 12 years ago
parent
commit
1fe9bc5a7e
2 changed files with 13 additions and 5 deletions
  1. +10
    -5
      modules/juce_gui_basics/properties/juce_PropertyPanel.cpp
  2. +3
    -0
      modules/juce_gui_basics/properties/juce_PropertyPanel.h

+ 10
- 5
modules/juce_gui_basics/properties/juce_PropertyPanel.cpp View File

@@ -197,7 +197,7 @@ PropertyPanel::~PropertyPanel()
//==============================================================================
void PropertyPanel::paint (Graphics& g)
{
if (propertyHolderComponent->getNumSections() == 0)
if (isEmpty())
{
g.setColour (Colours::black.withAlpha (0.5f));
g.setFont (14.0f);
@@ -215,16 +215,21 @@ void PropertyPanel::resized()
//==============================================================================
void PropertyPanel::clear()
{
if (propertyHolderComponent->getNumSections() > 0)
if (! isEmpty())
{
propertyHolderComponent->clear();
repaint();
updatePropHolderLayout();
}
}
bool PropertyPanel::isEmpty() const
{
return propertyHolderComponent->getNumSections() == 0;
}
void PropertyPanel::addProperties (const Array <PropertyComponent*>& newProperties)
{
if (propertyHolderComponent->getNumSections() == 0)
if (isEmpty())
repaint();
propertyHolderComponent->addSection (new SectionComponent (String::empty, newProperties, true));
@@ -237,7 +242,7 @@ void PropertyPanel::addSection (const String& sectionTitle,
{
jassert (sectionTitle.isNotEmpty());
if (propertyHolderComponent->getNumSections() == 0)
if (isEmpty())
repaint();
propertyHolderComponent->addSection (new SectionComponent (sectionTitle, newProperties, shouldBeOpen));


+ 3
- 0
modules/juce_gui_basics/properties/juce_PropertyPanel.h View File

@@ -84,6 +84,9 @@ public:
/** Calls the refresh() method of all PropertyComponents in the panel */
void refreshAll() const;
/** Returns true if there no properties have been added. */
bool isEmpty() const;
//==============================================================================
/** Returns a list of all the names of sections in the panel.


Loading…
Cancel
Save