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_DocumentWindow.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//==============================================================================
54class JUCE_API DocumentWindow : public ResizableWindow
55{
56public:
57 //==============================================================================
63 {
64 minimiseButton = 1,
65 maximiseButton = 2,
66 closeButton = 4,
67
69 allButtons = 7
70 };
71
72 //==============================================================================
93 DocumentWindow (const String& name,
94 Colour backgroundColour,
95 int requiredButtons,
96 bool addToDesktop = true);
97
101 ~DocumentWindow() override;
102
103 //==============================================================================
109 void setName (const String& newName) override;
110
117 void setIcon (const Image& imageToUse);
118
120 void setTitleBarHeight (int newHeight);
121
123 int getTitleBarHeight() const;
124
138 void setTitleBarButtonsRequired (int requiredButtons,
139 bool positionTitleBarButtonsOnLeft);
140
146 void setTitleBarTextCentred (bool textShouldBeCentred);
147
148 //==============================================================================
160 void setMenuBar (MenuBarModel* menuBarModel,
161 int menuBarHeight = 0);
162
167 Component* getMenuBarComponent() const noexcept;
168
172 void setMenuBarComponent (Component* newMenuBarComponent);
173
174 //==============================================================================
195 virtual void closeButtonPressed();
196
204 virtual void minimiseButtonPressed();
205
214 virtual void maximiseButtonPressed();
215
216 //==============================================================================
218 Button* getCloseButton() const noexcept;
219
221 Button* getMinimiseButton() const noexcept;
222
224 Button* getMaximiseButton() const noexcept;
225
226 //==============================================================================
235 {
236 textColourId = 0x1005701,
238 };
239
240 //==============================================================================
244 struct JUCE_API LookAndFeelMethods
245 {
246 virtual ~LookAndFeelMethods() = default;
247
248 virtual void drawDocumentWindowTitleBar (DocumentWindow&,
249 Graphics&, int w, int h,
250 int titleSpaceX, int titleSpaceW,
251 const Image* icon,
252 bool drawTitleTextOnLeft) = 0;
253
254 virtual Button* createDocumentWindowButton (int buttonType) = 0;
255
256 virtual void positionDocumentWindowButtons (DocumentWindow&,
257 int titleBarX, int titleBarY, int titleBarW, int titleBarH,
258 Button* minimiseButton,
259 Button* maximiseButton,
260 Button* closeButton,
261 bool positionTitleBarButtonsOnLeft) = 0;
262 };
263
264 //==============================================================================
265 #ifndef DOXYGEN
267 void paint (Graphics&) override;
269 void resized() override;
271 void lookAndFeelChanged() override;
273 BorderSize<int> getBorderThickness() override;
275 BorderSize<int> getContentComponentBorder() override;
277 void mouseDoubleClick (const MouseEvent&) override;
279 void userTriedToCloseWindow() override;
281 void activeWindowStatusChanged() override;
283 int getDesktopWindowStyleFlags() const override;
285 void parentHierarchyChanged() override;
287 Rectangle<int> getTitleBarArea();
288 #endif
289
290private:
291 //==============================================================================
292 int titleBarHeight = 26, menuBarHeight = 24, requiredButtons;
293 bool positionTitleBarButtonsOnLeft, drawTitleTextCentred = true;
294 std::unique_ptr<Button> titleBarButtons [3];
295 Image titleBarIcon;
297 MenuBarModel* menuBarModel = nullptr;
298
301
302 void repaintTitleBar();
303
305};
306
307} // namespace juce
Specifies a set of gaps to be left around the sides of a rectangle.
A base class for buttons.
Definition juce_Button.h:43
Represents a colour, also including a transparency value.
Definition juce_Colour.h:38
The base class for all JUCE user-interface objects.
A resizable window with a title bar and maximise, minimise and close buttons.
ColourIds
A set of colour IDs to use to change the colour of various aspects of the window.
TitleBarButtons
The set of available button-types that can be put on the title bar.
A graphics context, used for drawing a component or image.
Holds a fixed-size bitmap.
Definition juce_Image.h:58
A class for controlling MenuBar components.
Contains position and status information about a mouse event.
Manages a rectangle and allows geometric operations to be performed on it.
A base class for top-level windows that can be dragged around and resized.
The JUCE String class!
Definition juce_String.h:53
#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.
This abstract base class is implemented by LookAndFeel classes to provide window drawing functionalit...