JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
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) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
29//==============================================================================
41class JUCE_API TabbedComponent : public Component
42{
43public:
44 //==============================================================================
48 explicit TabbedComponent (TabbedButtonBar::Orientation orientation);
49
51 ~TabbedComponent() override;
52
53 //==============================================================================
61 void setOrientation (TabbedButtonBar::Orientation orientation);
62
66 TabbedButtonBar::Orientation getOrientation() const noexcept;
67
74 void setTabBarDepth (int newDepth);
75
79 int getTabBarDepth() const noexcept { return tabDepth; }
80
88 void setOutline (int newThickness);
89
93 void setIndent (int indentThickness);
94
95 //==============================================================================
99 void clearTabs();
100
109 void addTab (const String& tabName,
110 Colour tabBackgroundColour,
111 Component* contentComponent,
112 bool deleteComponentWhenNotNeeded,
113 int insertIndex = -1);
114
116 void setTabName (int tabIndex, const String& newName);
117
119 void removeTab (int tabIndex);
120
124 void moveTab (int currentIndex, int newIndex, bool animate = false);
125
127 int getNumTabs() const;
128
130 StringArray getTabNames() const;
131
136 Component* getTabContentComponent (int tabIndex) const noexcept;
137
139 Colour getTabBackgroundColour (int tabIndex) const noexcept;
140
142 void setTabBackgroundColour (int tabIndex, Colour newColour);
143
144 //==============================================================================
149 void setCurrentTabIndex (int newTabIndex, bool sendChangeMessage = true);
150
154 int getCurrentTabIndex() const;
155
159 String getCurrentTabName() const;
160
164 Component* getCurrentContentComponent() const noexcept { return panelComponent.get(); }
165
166 //==============================================================================
170 virtual void currentTabChanged (int newCurrentTabIndex, const String& newCurrentTabName);
171
173 virtual void popupMenuClickOnTab (int tabIndex, const String& tabName);
174
176 TabbedButtonBar& getTabbedButtonBar() const noexcept { return *tabs; }
177
178 //==============================================================================
187 {
188 backgroundColourId = 0x1005800,
189 outlineColourId = 0x1005801,
191 };
192
193 //==============================================================================
195 void paint (Graphics&) override;
197 void resized() override;
199 void lookAndFeelChanged() override;
201 std::unique_ptr<AccessibilityHandler> createAccessibilityHandler() override;
202
203protected:
204 //==============================================================================
210 virtual TabBarButton* createTabButton (const String& tabName, int tabIndex);
211
214
215private:
216 //==============================================================================
217 Array<WeakReference<Component>> contentComponents;
218 WeakReference<Component> panelComponent;
219 int tabDepth = 30, outlineThickness = 1, edgeIndent = 0;
220
221 struct ButtonBar;
222 void changeCallback (int newCurrentTabIndex, const String& newTabName);
223
225};
226
227} // namespace juce
Holds a resizable array of primitive or copy-by-value objects.
Definition juce_Array.h:56
Represents a colour, also including a transparency value.
Definition juce_Colour.h:38
The base class for all JUCE user-interface objects.
A graphics context, used for drawing a component or image.
A special array for holding a list of strings.
The JUCE String class!
Definition juce_String.h:53
In a TabbedButtonBar, this component is used for each of the buttons.
A vertical or horizontal bar containing tabs that you can select.
Orientation
The placement of the tab-bar.
A component with a TabbedButtonBar along one of its sides.
int getTabBarDepth() const noexcept
Returns the current thickness of the tab bar.
Component * getCurrentContentComponent() const noexcept
Returns the current component that's filling the panel.
ColourIds
A set of colour IDs to use to change the colour of various aspects of the component.
TabbedButtonBar & getTabbedButtonBar() const noexcept
Returns the tab button bar component that is being used.
This class acts as a pointer which will automatically become null if the object to which it points is...
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
This is a shorthand way of writing both a JUCE_DECLARE_NON_COPYABLE and JUCE_LEAK_DETECTOR macro for ...
JUCE Namespace.