The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
2.5KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2015 - ROLI Ltd.
  5. Permission is granted to use this software under the terms of either:
  6. a) the GPL v2 (or any later version)
  7. b) the Affero GPL v3
  8. Details of these licenses can be found at: www.gnu.org/licenses
  9. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  11. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  12. ------------------------------------------------------------------------------
  13. To release a closed-source product which uses JUCE, commercial licenses are
  14. available: visit www.juce.com for more information.
  15. ==============================================================================
  16. */
  17. #ifndef JUCER_SLIDINGPANELCOMPONENT_H_INCLUDED
  18. #define JUCER_SLIDINGPANELCOMPONENT_H_INCLUDED
  19. #include "../jucer_Headers.h"
  20. #include "../Application/jucer_Application.h"
  21. //==============================================================================
  22. class SlidingPanelComponent : public Component
  23. {
  24. public:
  25. SlidingPanelComponent();
  26. ~SlidingPanelComponent();
  27. /** Adds a new tab to the panel slider. */
  28. void addTab (const String& tabName,
  29. Component* contentComponent,
  30. bool deleteComponentWhenNotNeeded,
  31. int insertIndex = -1);
  32. /** Gets rid of one of the tabs. */
  33. void removeTab (int tabIndex);
  34. /** Gets index of current tab. */
  35. int getCurrentTabIndex() const noexcept { return currentIndex; }
  36. /** Returns the number of tabs. */
  37. int getNumTabs() const noexcept { return pages.size(); }
  38. /** Animates the window to the desired tab. */
  39. void goToTab (int targetTabIndex);
  40. //==============================================================================
  41. /** @internal */
  42. void resized() override;
  43. private:
  44. struct DotButton;
  45. friend struct DotButton;
  46. struct PageInfo
  47. {
  48. ~PageInfo();
  49. Component::SafePointer<Component> content;
  50. ScopedPointer<DotButton> dotButton;
  51. String name;
  52. bool shouldDelete;
  53. };
  54. OwnedArray<PageInfo> pages;
  55. Component pageHolder;
  56. int currentIndex, dotSize;
  57. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (SlidingPanelComponent)
  58. };
  59. #endif // JUCER_SLIDINGPANELCOMPONENT_H_INCLUDED