Browse Source

Added method Toolbar::removeAndReturnItem.

tags/2021-05-28
jules 12 years ago
parent
commit
614afb1ca6
2 changed files with 16 additions and 2 deletions
  1. +12
    -0
      modules/juce_gui_basics/widgets/juce_Toolbar.cpp
  2. +4
    -2
      modules/juce_gui_basics/widgets/juce_Toolbar.h

+ 12
- 0
modules/juce_gui_basics/widgets/juce_Toolbar.cpp View File

@@ -325,6 +325,18 @@ void Toolbar::removeToolbarItem (const int itemIndex)
resized();
}
ToolbarItemComponent* Toolbar::removeAndReturnItem (const int itemIndex)
{
if (ToolbarItemComponent* const tc = items.removeAndReturn (itemIndex))
{
removeChildComponent (tc);
resized();
return tc;
}
return nullptr;
}
int Toolbar::getNumItems() const noexcept
{
return items.size();


+ 4
- 2
modules/juce_gui_basics/widgets/juce_Toolbar.h View File

@@ -121,10 +121,12 @@ public:
int itemId,
int insertIndex = -1);
/** Deletes one of the items from the bar.
*/
/** Deletes one of the items from the bar. */
void removeToolbarItem (int itemIndex);
/** Removes an item from the bar and returns it. */
ToolbarItemComponent* removeAndReturnItem (int itemIndex);
/** Returns the number of items currently on the toolbar.
@see getItemId, getItemComponent


Loading…
Cancel
Save