From 4c1d4f00819dd2666f2016e3ef4a9063e5d6744b Mon Sep 17 00:00:00 2001 From: ed Date: Mon, 9 Jan 2017 10:22:33 +0000 Subject: [PATCH] Added method TabbedComponent::moveTab() --- modules/juce_gui_basics/layout/juce_TabbedComponent.cpp | 6 ++++++ modules/juce_gui_basics/layout/juce_TabbedComponent.h | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/modules/juce_gui_basics/layout/juce_TabbedComponent.cpp b/modules/juce_gui_basics/layout/juce_TabbedComponent.cpp index 1682cf7865..25d7165898 100644 --- a/modules/juce_gui_basics/layout/juce_TabbedComponent.cpp +++ b/modules/juce_gui_basics/layout/juce_TabbedComponent.cpp @@ -174,6 +174,12 @@ void TabbedComponent::removeTab (const int tabIndex) } } +void TabbedComponent::moveTab (const int currentIndex, const int newIndex, const bool animate) +{ + contentComponents.move (currentIndex, newIndex); + tabs->moveTab (currentIndex, newIndex, animate); +} + int TabbedComponent::getNumTabs() const { return tabs->getNumTabs(); diff --git a/modules/juce_gui_basics/layout/juce_TabbedComponent.h b/modules/juce_gui_basics/layout/juce_TabbedComponent.h index 944ff83b79..98f627a366 100644 --- a/modules/juce_gui_basics/layout/juce_TabbedComponent.h +++ b/modules/juce_gui_basics/layout/juce_TabbedComponent.h @@ -116,6 +116,11 @@ public: /** Gets rid of one of the tabs. */ void removeTab (int tabIndex); + /** Moves a tab to a new index in the list. + Pass -1 as the index to move it to the end of the list. + */ + void moveTab (int currentIndex, int newIndex, bool animate = false); + /** Returns the number of tabs in the bar. */ int getNumTabs() const;