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_LookAndFeel_V4.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//==============================================================================
36class JUCE_API LookAndFeel_V4 : public LookAndFeel_V3
37{
38public:
43 {
44 public:
47 {
48 windowBackground = 0,
49 widgetBackground,
50 menuBackground,
51 outline,
52 defaultText,
53 defaultFill,
54 highlightedText,
55 highlightedFill,
56 menuText,
57
58 numColours
59 };
60
61 template <typename... ItemColours>
62 ColourScheme (ItemColours... coloursToUse)
63 {
64 static_assert (sizeof... (coloursToUse) == numColours, "Must supply one colour for each UIColour item");
65 const Colour c[] = { Colour (coloursToUse)... };
66
67 for (int i = 0; i < numColours; ++i)
68 palette[i] = c[i];
69 }
70
71 ColourScheme (const ColourScheme&) = default;
72 ColourScheme& operator= (const ColourScheme&) = default;
73
75 Colour getUIColour (UIColour colourToGet) const noexcept;
76
78 void setUIColour (UIColour colourToSet, Colour newColour) noexcept;
79
81 bool operator== (const ColourScheme&) const noexcept;
83 bool operator!= (const ColourScheme&) const noexcept;
84
85 private:
86 Colour palette[numColours];
87 };
88
89 //==============================================================================
91 LookAndFeel_V4();
92
94 LookAndFeel_V4 (ColourScheme);
95
97 ~LookAndFeel_V4() override;
98
99 //==============================================================================
100 void setColourScheme (ColourScheme);
101 ColourScheme& getCurrentColourScheme() noexcept { return currentColourScheme; }
102
103 static ColourScheme getDarkColourScheme();
104 static ColourScheme getMidnightColourScheme();
105 static ColourScheme getGreyColourScheme();
106 static ColourScheme getLightColourScheme();
107
108 //==============================================================================
109 Button* createDocumentWindowButton (int) override;
110 void positionDocumentWindowButtons (DocumentWindow&, int, int, int, int, Button*, Button*, Button*, bool) override;
111 void drawDocumentWindowTitleBar (DocumentWindow&, Graphics&, int, int, int, int, const Image*, bool) override;
112
113 //==============================================================================
114 Font getTextButtonFont (TextButton&, int buttonHeight) override;
115
116 void drawButtonBackground (Graphics&, Button&, const Colour& backgroundColour,
117 bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override;
118
119 void drawToggleButton (Graphics&, ToggleButton&,
120 bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override;
121 void drawTickBox (Graphics&, Component&,
122 float x, float y, float w, float h,
123 bool ticked, bool isEnabled,
124 bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override;
125
126 void changeToggleButtonWidthToFitText (ToggleButton&) override;
127
128 //==============================================================================
129 AlertWindow* createAlertWindow (const String& title, const String& message,
130 const String& button1,
131 const String& button2,
132 const String& button3,
133 MessageBoxIconType iconType,
134 int numButtons, Component* associatedComponent) override;
135 void drawAlertBox (Graphics&, AlertWindow&, const Rectangle<int>& textArea, TextLayout&) override;
136
137 int getAlertWindowButtonHeight() override;
138 Font getAlertWindowTitleFont() override;
139 Font getAlertWindowMessageFont() override;
140 Font getAlertWindowFont() override;
141
142 //==============================================================================
143 void drawProgressBar (Graphics&, ProgressBar&, int width, int height, double progress, const String&) override;
144 bool isProgressBarOpaque (ProgressBar&) override { return false; }
145 ProgressBar::Style getDefaultProgressBarStyle (const ProgressBar&) override;
146
147 //==============================================================================
148 int getDefaultScrollbarWidth() override;
149 void drawScrollbar (Graphics&, ScrollBar&, int x, int y, int width, int height, bool isScrollbarVertical,
150 int thumbStartPosition, int thumbSize, bool isMouseOver, bool isMouseDown) override;
151
152 //==============================================================================
153 Path getTickShape (float height) override;
154 Path getCrossShape (float height) override;
155
156 //==============================================================================
157 void fillTextEditorBackground (Graphics&, int width, int height, TextEditor&) override;
158 void drawTextEditorOutline (Graphics&, int width, int height, TextEditor&) override;
159
160 //==============================================================================
161 Button* createFileBrowserGoUpButton() override;
162
163 void layoutFileBrowserComponent (FileBrowserComponent&,
164 DirectoryContentsDisplayComponent*,
165 FilePreviewComponent*,
166 ComboBox* currentPathBox,
167 TextEditor* filenameBox,
168 Button* goUpButton) override;
169
170 void drawFileBrowserRow (Graphics&, int width, int height,
171 const File& file, const String& filename, Image* icon,
172 const String& fileSizeDescription, const String& fileTimeDescription,
173 bool isDirectory, bool isItemSelected, int itemIndex,
174 DirectoryContentsDisplayComponent&) override;
175
176 //==============================================================================
177 void drawPopupMenuItem (Graphics&, const Rectangle<int>& area,
178 bool isSeparator, bool isActive, bool isHighlighted, bool isTicked, bool hasSubMenu,
179 const String& text, const String& shortcutKeyText,
180 const Drawable* icon, const Colour* textColour) override;
181
182 void getIdealPopupMenuItemSize (const String& text, bool isSeparator, int standardMenuItemHeight,
183 int& idealWidth, int& idealHeight) override;
184
185 void drawMenuBarBackground (Graphics&, int width, int height, bool isMouseOverBar, MenuBarComponent&) override;
186
187 void drawMenuBarItem (Graphics&, int width, int height,
188 int itemIndex, const String& itemText,
189 bool isMouseOverItem, bool isMenuOpen, bool isMouseOverBar,
190 MenuBarComponent&) override;
191
192 //==============================================================================
193 void drawComboBox (Graphics&, int width, int height, bool isButtonDown,
194 int buttonX, int buttonY, int buttonW, int buttonH,
195 ComboBox&) override;
196 Font getComboBoxFont (ComboBox&) override;
197 void positionComboBoxText (ComboBox&, Label&) override;
198
199 //==============================================================================
200 int getSliderThumbRadius (Slider&) override;
201
202 void drawLinearSlider (Graphics&, int x, int y, int width, int height,
203 float sliderPos, float minSliderPos, float maxSliderPos,
204 Slider::SliderStyle, Slider&) override;
205
206 void drawRotarySlider (Graphics&, int x, int y, int width, int height,
207 float sliderPosProportional, float rotaryStartAngle,
208 float rotaryEndAngle, Slider&) override;
209
210 void drawPointer (Graphics&, float x, float y, float diameter,
211 const Colour&, int direction) noexcept;
212
213 Label* createSliderTextBox (Slider&) override;
214
215 //==============================================================================
216 void drawTooltip (Graphics&, const String& text, int width, int height) override;
217
218 //==============================================================================
219 void drawConcertinaPanelHeader (Graphics&, const Rectangle<int>& area,
220 bool isMouseOver, bool isMouseDown,
221 ConcertinaPanel&, Component& panel) override;
222
223 //==============================================================================
224 void drawLevelMeter (Graphics&, int, int, float) override;
225
226 //==============================================================================
227 void paintToolbarBackground (Graphics&, int width, int height, Toolbar&) override;
228
229 void paintToolbarButtonLabel (Graphics&, int x, int y, int width, int height,
230 const String& text, ToolbarItemComponent&) override;
231
232 //==============================================================================
233 void drawPropertyPanelSectionHeader (Graphics&, const String& name, bool isOpen, int width, int height) override;
234 void drawPropertyComponentBackground (Graphics&, int width, int height, PropertyComponent&) override;
235 void drawPropertyComponentLabel (Graphics&, int width, int height, PropertyComponent&) override;
236 Rectangle<int> getPropertyComponentContentPosition (PropertyComponent&) override;
237
238 //==============================================================================
239 void drawCallOutBoxBackground (CallOutBox&, Graphics&, const Path&, Image&) override;
240
241 //==============================================================================
242 void drawStretchableLayoutResizerBar (Graphics&, int, int, bool, bool, bool) override;
243
244private:
245 //==============================================================================
246 static void drawLinearProgressBar (Graphics&, const ProgressBar&, int, int, double, const String&);
247 static void drawCircularProgressBar (Graphics&, const ProgressBar&, const String&);
248
249 //==============================================================================
250 int getPropertyComponentIndent (PropertyComponent&);
251
252 //==============================================================================
253 void initialiseColours();
254 ColourScheme currentColourScheme;
255
256 //==============================================================================
258};
259
260} // namespace juce
Represents a colour, also including a transparency value.
Definition juce_Colour.h:38
The latest JUCE look-and-feel style, as introduced in 2013.
A struct containing the set of colours to apply to the GUI.
UIColour
The standard set of colours to use.
The latest JUCE look-and-feel style, as introduced in 2017.
#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.