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_MultiDocumentPanel.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
29class MultiDocumentPanel;
30
31
32//==============================================================================
45{
46public:
47 //==============================================================================
50 MultiDocumentPanelWindow (Colour backgroundColour);
51
54
55 //==============================================================================
57 void maximiseButtonPressed() override;
59 void closeButtonPressed() override;
61 void activeWindowStatusChanged() override;
63 void broughtToFront() override;
64
65private:
66 //==============================================================================
67 void updateActiveDocument();
68 MultiDocumentPanel* getOwner() const noexcept;
69
71};
72
73
74//==============================================================================
88class JUCE_API MultiDocumentPanel : public Component,
89 private ComponentListener
90{
91public:
92 //==============================================================================
100
109 ~MultiDocumentPanel() override;
110
111 //==============================================================================
112 #if JUCE_MODAL_LOOPS_PERMITTED
124 bool closeAllDocuments (bool checkItsOkToCloseFirst);
125 #endif
126
139 void closeAllDocumentsAsync (bool checkItsOkToCloseFirst,
140 std::function<void (bool)> callback);
141
159 bool addDocument (Component* component,
160 Colour backgroundColour,
161 bool deleteWhenRemoved);
162
163 #if JUCE_MODAL_LOOPS_PERMITTED
178 bool closeDocument (Component* component,
179 bool checkItsOkToCloseFirst);
180 #endif
181
196 void closeDocumentAsync (Component* component,
197 bool checkItsOkToCloseFirst,
198 std::function<void (bool)> callback);
199
204 int getNumDocuments() const noexcept;
205
213 Component* getDocument (int index) const noexcept;
214
224 Component* getActiveDocument() const noexcept;
225
230 void setActiveDocument (Component* component);
231
233 virtual void activeDocumentChanged();
234
240 void setMaximumNumDocuments (int maximumNumDocuments);
241
249 void useFullscreenWhenOneDocument (bool shouldUseTabs);
250
253 bool isFullscreenWhenOneDocument() const noexcept;
254
255 //==============================================================================
258 {
260 MaximisedWindowsWithTabs
261 };
262
267 void setLayoutMode (LayoutMode newLayoutMode);
268
270 LayoutMode getLayoutMode() const noexcept { return mode; }
271
277 void setBackgroundColour (Colour newBackgroundColour);
278
283 Colour getBackgroundColour() const noexcept { return backgroundColour; }
284
286 TabbedComponent* getCurrentTabbedComponent() const noexcept { return tabComponent.get(); }
287
288 //==============================================================================
289 #if JUCE_MODAL_LOOPS_PERMITTED
311 virtual bool tryToCloseDocument (Component* component);
312 #endif
313
336 virtual void tryToCloseDocumentAsync (Component* component, std::function<void (bool)> callback) = 0;
337
343 virtual MultiDocumentPanelWindow* createNewDocumentWindow();
344
345 //==============================================================================
347 void paint (Graphics&) override;
349 void resized() override;
351 void componentNameChanged (Component&) override;
352
353private:
354 //==============================================================================
355 void closeDocumentInternal (Component*);
356 static void closeLastDocumentRecursive (SafePointer<MultiDocumentPanel>,
357 bool,
358 std::function<void (bool)>);
359
360 //==============================================================================
362 friend class MultiDocumentPanelWindow;
363
364 Component* getContainerComp (Component*) const;
365 void updateActiveDocumentFromUIState();
366 void updateActiveDocument (Component*);
367 void addWindow (Component*);
368 void recreateLayout();
369
370 LayoutMode mode = MaximisedWindowsWithTabs;
371 Array<Component*> components;
372 Component* activeComponent = nullptr;
373 bool isLayoutBeingChanged = false;
375 Colour backgroundColour { Colours::lightblue };
376 int maximumNumDocuments = 0, numDocsBeforeTabsUsed = 0;
377
379};
380
381} // 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
Gets informed about changes to a component's hierarchy or position.
Holds a pointer to some type of Component, which automatically becomes null if the component is delet...
The base class for all JUCE user-interface objects.
A resizable window with a title bar and maximise, minimise and close buttons.
A graphics context, used for drawing a component or image.
This is a derivative of DocumentWindow that is used inside a MultiDocumentPanel component.
A component that contains a set of other components either in floating windows or tabs.
virtual void tryToCloseDocumentAsync(Component *component, std::function< void(bool)> callback)=0
A subclass must override this to say whether its currently ok for a document to be closed.
LayoutMode
The different layout modes available.
@ FloatingWindows
In this mode, there are overlapping DocumentWindow components for each document.
Colour getBackgroundColour() const noexcept
Returns the current background colour.
TabbedComponent * getCurrentTabbedComponent() const noexcept
If the panel is being used in tabbed mode, this returns the TabbedComponent that's involved.
LayoutMode getLayoutMode() const noexcept
Returns the current layout mode.
A component with a TabbedButtonBar along one of its sides.
#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.