openshot-audio  0.1.5
juce_TabbedComponent.h
Go to the documentation of this file.
1 /*
2  ==============================================================================
3 
4  This file is part of the JUCE library.
5  Copyright (c) 2015 - ROLI Ltd.
6 
7  Permission is granted to use this software under the terms of either:
8  a) the GPL v2 (or any later version)
9  b) the Affero GPL v3
10 
11  Details of these licenses can be found at: www.gnu.org/licenses
12 
13  JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
14  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15  A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 
17  ------------------------------------------------------------------------------
18 
19  To release a closed-source product which uses JUCE, commercial licenses are
20  available: visit www.juce.com for more information.
21 
22  ==============================================================================
23 */
24 
25 #ifndef JUCE_TABBEDCOMPONENT_H_INCLUDED
26 #define JUCE_TABBEDCOMPONENT_H_INCLUDED
27 
28 
29 //==============================================================================
40 {
41 public:
42  //==============================================================================
46  explicit TabbedComponent (TabbedButtonBar::Orientation orientation);
47 
49  ~TabbedComponent();
50 
51  //==============================================================================
59  void setOrientation (TabbedButtonBar::Orientation orientation);
60 
64  TabbedButtonBar::Orientation getOrientation() const noexcept;
65 
72  void setTabBarDepth (int newDepth);
73 
77  int getTabBarDepth() const noexcept { return tabDepth; }
78 
86  void setOutline (int newThickness);
87 
91  void setIndent (int indentThickness);
92 
93  //==============================================================================
97  void clearTabs();
98 
107  void addTab (const String& tabName,
108  Colour tabBackgroundColour,
109  Component* contentComponent,
110  bool deleteComponentWhenNotNeeded,
111  int insertIndex = -1);
112 
114  void setTabName (int tabIndex, const String& newName);
115 
117  void removeTab (int tabIndex);
118 
120  int getNumTabs() const;
121 
123  StringArray getTabNames() const;
124 
129  Component* getTabContentComponent (int tabIndex) const noexcept;
130 
132  Colour getTabBackgroundColour (int tabIndex) const noexcept;
133 
135  void setTabBackgroundColour (int tabIndex, Colour newColour);
136 
137  //==============================================================================
142  void setCurrentTabIndex (int newTabIndex, bool sendChangeMessage = true);
143 
147  int getCurrentTabIndex() const;
148 
152  String getCurrentTabName() const;
153 
157  Component* getCurrentContentComponent() const noexcept { return panelComponent; }
158 
159  //==============================================================================
163  virtual void currentTabChanged (int newCurrentTabIndex, const String& newCurrentTabName);
164 
166  virtual void popupMenuClickOnTab (int tabIndex, const String& tabName);
167 
169  TabbedButtonBar& getTabbedButtonBar() const noexcept { return *tabs; }
170 
171  //==============================================================================
180  {
181  backgroundColourId = 0x1005800,
182  outlineColourId = 0x1005801,
184  };
185 
186  //==============================================================================
188  void paint (Graphics&) override;
190  void resized() override;
192  void lookAndFeelChanged() override;
193 
194 protected:
195  //==============================================================================
201  virtual TabBarButton* createTabButton (const String& tabName, int tabIndex);
202 
205 
206 private:
207  //==============================================================================
208  Array <WeakReference<Component> > contentComponents;
209  WeakReference<Component> panelComponent;
210  int tabDepth, outlineThickness, edgeIndent;
211 
212  class ButtonBar;
213  friend class ButtonBar;
214  void changeCallback (int newCurrentTabIndex, const String& newTabName);
215 
217 };
218 
219 
220 #endif // JUCE_TABBEDCOMPONENT_H_INCLUDED
virtual void lookAndFeelChanged()
Definition: juce_Component.cpp:2138
#define noexcept
Definition: juce_CompilerSupport.h:141
Component * getCurrentContentComponent() const noexcept
Definition: juce_TabbedComponent.h:157
ScopedPointer< TabbedButtonBar > tabs
Definition: juce_TabbedComponent.h:204
Definition: juce_TabbedButtonBar.h:40
Definition: juce_String.h:43
#define JUCE_API
Definition: juce_StandardHeader.h:139
Orientation
Definition: juce_TabbedButtonBar.h:155
ColourIds
Definition: juce_TabbedComponent.h:179
Definition: juce_TabbedComponent.h:39
virtual void resized()
Definition: juce_Component.cpp:2272
Definition: juce_TabbedButtonBar.h:147
Definition: juce_Colour.h:35
TabbedButtonBar & getTabbedButtonBar() const noexcept
Definition: juce_TabbedComponent.h:169
Definition: juce_TabbedComponent.cpp:52
virtual void paint(Graphics &g)
Definition: juce_Component.cpp:1929
Definition: juce_Component.h:33
Definition: juce_StringArray.h:39
Definition: juce_Array.h:60
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
Definition: juce_PlatformDefs.h:198
Definition: juce_GraphicsContext.h:42
int getTabBarDepth() const noexcept
Definition: juce_TabbedComponent.h:77