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.cpp
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
30{
31 if (isPositiveAndBelow (index, numColours))
32 return palette[index];
33
35 return {};
36}
37
39{
40 if (isPositiveAndBelow (index, numColours))
41 palette[index] = newColour;
42 else
44}
45
47{
48 for (auto i = 0; i < numColours; ++i)
49 if (palette[i] != other.palette[i])
50 return false;
51
52 return true;
53}
54
56{
57 return ! operator== (other);
58}
59
60//==============================================================================
61LookAndFeel_V4::LookAndFeel_V4() : currentColourScheme (getDarkColourScheme())
62{
63 initialiseColours();
64}
65
67{
68 initialiseColours();
69}
70
72
73//==============================================================================
74void LookAndFeel_V4::setColourScheme (ColourScheme newColourScheme)
75{
76 currentColourScheme = newColourScheme;
77 initialiseColours();
78}
79
80LookAndFeel_V4::ColourScheme LookAndFeel_V4::getDarkColourScheme()
81{
82 return { 0xff323e44, 0xff263238, 0xff323e44,
83 0xff8e989b, 0xffffffff, 0xff42a2c8,
84 0xffffffff, 0xff181f22, 0xffffffff };
85}
86
87LookAndFeel_V4::ColourScheme LookAndFeel_V4::getMidnightColourScheme()
88{
89 return { 0xff2f2f3a, 0xff191926, 0xffd0d0d0,
90 0xff66667c, 0xc8ffffff, 0xffd8d8d8,
91 0xffffffff, 0xff606073, 0xff000000 };
92}
93
94LookAndFeel_V4::ColourScheme LookAndFeel_V4::getGreyColourScheme()
95{
96 return { 0xff505050, 0xff424242, 0xff606060,
97 0xffa6a6a6, 0xffffffff, 0xff21ba90,
98 0xff000000, 0xffffffff, 0xffffffff };
99}
100
101LookAndFeel_V4::ColourScheme LookAndFeel_V4::getLightColourScheme()
102{
103 return { 0xffefefef, 0xffffffff, 0xffffffff,
104 0xffdddddd, 0xff000000, 0xffa9a9a9,
105 0xffffffff, 0xff42a2c8, 0xff000000 };
106}
107
108//==============================================================================
110{
111public:
112 LookAndFeel_V4_DocumentWindowButton (const String& name, Colour c, const Path& normal, const Path& toggled)
113 : Button (name), colour (c), normalShape (normal), toggledShape (toggled)
114 {
115 }
116
118 {
119 auto background = Colours::grey;
120
122 if (auto lf = dynamic_cast<LookAndFeel_V4*> (&rw->getLookAndFeel()))
123 background = lf->getCurrentColourScheme().getUIColour (LookAndFeel_V4::ColourScheme::widgetBackground);
124
125 g.fillAll (background);
126
127 g.setColour ((! isEnabled() || shouldDrawButtonAsDown) ? colour.withAlpha (0.6f)
128 : colour);
129
131 {
132 g.fillAll();
133 g.setColour (background);
134 }
135
136 auto& p = getToggleState() ? toggledShape : normalShape;
137
140 .toFloat()
141 .reduced ((float) getHeight() * 0.3f);
142
143 g.fillPath (p, p.getTransformToScaleToFit (reducedRect, true));
144 }
145
146private:
147 Colour colour;
148 Path normalShape, toggledShape;
149
151};
152
153Button* LookAndFeel_V4::createDocumentWindowButton (int buttonType)
154{
155 Path shape;
156 auto crossThickness = 0.15f;
157
158 if (buttonType == DocumentWindow::closeButton)
159 {
160 shape.addLineSegment ({ 0.0f, 0.0f, 1.0f, 1.0f }, crossThickness);
161 shape.addLineSegment ({ 1.0f, 0.0f, 0.0f, 1.0f }, crossThickness);
162
163 return new LookAndFeel_V4_DocumentWindowButton ("close", Colour (0xff9A131D), shape, shape);
164 }
165
166 if (buttonType == DocumentWindow::minimiseButton)
167 {
168 shape.addLineSegment ({ 0.0f, 0.5f, 1.0f, 0.5f }, crossThickness);
169
170 return new LookAndFeel_V4_DocumentWindowButton ("minimise", Colour (0xffaa8811), shape, shape);
171 }
172
173 if (buttonType == DocumentWindow::maximiseButton)
174 {
175 shape.addLineSegment ({ 0.5f, 0.0f, 0.5f, 1.0f }, crossThickness);
176 shape.addLineSegment ({ 0.0f, 0.5f, 1.0f, 0.5f }, crossThickness);
177
178 Path fullscreenShape;
179 fullscreenShape.startNewSubPath (45.0f, 100.0f);
180 fullscreenShape.lineTo (0.0f, 100.0f);
181 fullscreenShape.lineTo (0.0f, 0.0f);
182 fullscreenShape.lineTo (100.0f, 0.0f);
183 fullscreenShape.lineTo (100.0f, 45.0f);
184 fullscreenShape.addRectangle (45.0f, 45.0f, 100.0f, 100.0f);
185 PathStrokeType (30.0f).createStrokedPath (fullscreenShape, fullscreenShape);
186
187 return new LookAndFeel_V4_DocumentWindowButton ("maximise", Colour (0xff0A830A), shape, fullscreenShape);
188 }
189
191 return nullptr;
192}
193
194void LookAndFeel_V4::positionDocumentWindowButtons (DocumentWindow&,
195 int titleBarX, int titleBarY,
196 int titleBarW, int titleBarH,
197 Button* minimiseButton,
198 Button* maximiseButton,
199 Button* closeButton,
200 bool positionTitleBarButtonsOnLeft)
201{
202 auto buttonW = static_cast<int> (titleBarH * 1.2);
203
204 auto x = positionTitleBarButtonsOnLeft ? titleBarX
206
207 if (closeButton != nullptr)
208 {
209 closeButton->setBounds (x, titleBarY, buttonW, titleBarH);
210 x += positionTitleBarButtonsOnLeft ? buttonW : -buttonW;
211 }
212
213 if (positionTitleBarButtonsOnLeft)
214 std::swap (minimiseButton, maximiseButton);
215
216 if (maximiseButton != nullptr)
217 {
218 maximiseButton->setBounds (x, titleBarY, buttonW, titleBarH);
219 x += positionTitleBarButtonsOnLeft ? buttonW : -buttonW;
220 }
221
222 if (minimiseButton != nullptr)
223 minimiseButton->setBounds (x, titleBarY, buttonW, titleBarH);
224}
225
226void LookAndFeel_V4::drawDocumentWindowTitleBar (DocumentWindow& window, Graphics& g,
227 int w, int h, int titleSpaceX, int titleSpaceW,
228 const Image* icon, bool drawTitleTextOnLeft)
229{
230 if (w * h == 0)
231 return;
232
233 auto isActive = window.isActiveWindow();
234
235 g.setColour (getCurrentColourScheme().getUIColour (ColourScheme::widgetBackground));
236 g.fillAll();
237
238 Font font ((float) h * 0.65f, Font::plain);
239 g.setFont (font);
240
241 auto textW = font.getStringWidth (window.getName());
242 auto iconW = 0;
243 auto iconH = 0;
244
245 if (icon != nullptr)
246 {
247 iconH = static_cast<int> (font.getHeight());
248 iconW = icon->getWidth() * iconH / icon->getHeight() + 4;
249 }
250
253 : jmax (titleSpaceX, (w - textW) / 2);
254
257
258 if (icon != nullptr)
259 {
260 g.setOpacity (isActive ? 1.0f : 0.6f);
261 g.drawImageWithin (*icon, textX, (h - iconH) / 2, iconW, iconH,
263 textX += iconW;
264 textW -= iconW;
265 }
266
268 g.setColour (window.findColour (DocumentWindow::textColourId));
269 else
270 g.setColour (getCurrentColourScheme().getUIColour (ColourScheme::defaultText));
271
272 g.drawText (window.getName(), textX, 0, textW, h, Justification::centredLeft, true);
273}
274
275//==============================================================================
276Font LookAndFeel_V4::getTextButtonFont (TextButton&, int buttonHeight)
277{
278 return { jmin (16.0f, (float) buttonHeight * 0.6f) };
279}
280
281void LookAndFeel_V4::drawButtonBackground (Graphics& g,
282 Button& button,
283 const Colour& backgroundColour,
286{
287 auto cornerSize = 6.0f;
288 auto bounds = button.getLocalBounds().toFloat().reduced (0.5f, 0.5f);
289
290 auto baseColour = backgroundColour.withMultipliedSaturation (button.hasKeyboardFocus (true) ? 1.3f : 0.9f)
291 .withMultipliedAlpha (button.isEnabled() ? 1.0f : 0.5f);
292
294 baseColour = baseColour.contrasting (shouldDrawButtonAsDown ? 0.2f : 0.05f);
295
296 g.setColour (baseColour);
297
298 auto flatOnLeft = button.isConnectedOnLeft();
299 auto flatOnRight = button.isConnectedOnRight();
300 auto flatOnTop = button.isConnectedOnTop();
301 auto flatOnBottom = button.isConnectedOnBottom();
302
304 {
305 Path path;
306 path.addRoundedRectangle (bounds.getX(), bounds.getY(),
307 bounds.getWidth(), bounds.getHeight(),
308 cornerSize, cornerSize,
309 ! (flatOnLeft || flatOnTop),
310 ! (flatOnRight || flatOnTop),
313
314 g.fillPath (path);
315
316 g.setColour (button.findColour (ComboBox::outlineColourId));
317 g.strokePath (path, PathStrokeType (1.0f));
318 }
319 else
320 {
321 g.fillRoundedRectangle (bounds, cornerSize);
322
323 g.setColour (button.findColour (ComboBox::outlineColourId));
324 g.drawRoundedRectangle (bounds, cornerSize, 1.0f);
325 }
326}
327
330{
331 auto fontSize = jmin (15.0f, (float) button.getHeight() * 0.75f);
332 auto tickWidth = fontSize * 1.1f;
333
334 drawTickBox (g, button, 4.0f, ((float) button.getHeight() - tickWidth) * 0.5f,
336 button.getToggleState(),
337 button.isEnabled(),
340
341 g.setColour (button.findColour (ToggleButton::textColourId));
342 g.setFont (fontSize);
343
344 if (! button.isEnabled())
345 g.setOpacity (0.5f);
346
347 g.drawFittedText (button.getButtonText(),
348 button.getLocalBounds().withTrimmedLeft (roundToInt (tickWidth) + 10)
349 .withTrimmedRight (2),
351}
352
353void LookAndFeel_V4::drawTickBox (Graphics& g, Component& component,
354 float x, float y, float w, float h,
355 const bool ticked,
356 [[maybe_unused]] const bool isEnabled,
359{
360 Rectangle<float> tickBounds (x, y, w, h);
361
363 g.drawRoundedRectangle (tickBounds, 4.0f, 1.0f);
364
365 if (ticked)
366 {
368 auto tick = getTickShape (0.75f);
369 g.fillPath (tick, tick.getTransformToScaleToFit (tickBounds.reduced (4, 5).toFloat(), false));
370 }
371}
372
373void LookAndFeel_V4::changeToggleButtonWidthToFitText (ToggleButton& button)
374{
375 auto fontSize = jmin (15.0f, (float) button.getHeight() * 0.75f);
376 auto tickWidth = fontSize * 1.1f;
377
378 Font font (fontSize);
379
380 button.setSize (font.getStringWidth (button.getButtonText()) + roundToInt (tickWidth) + 14, button.getHeight());
381}
382
383//==============================================================================
384AlertWindow* LookAndFeel_V4::createAlertWindow (const String& title, const String& message,
385 const String& button1, const String& button2, const String& button3,
386 MessageBoxIconType iconType,
387 int numButtons, Component* associatedComponent)
388{
389 auto boundsOffset = 50;
390
391 auto* aw = LookAndFeel_V2::createAlertWindow (title, message, button1, button2, button3,
392 iconType, numButtons, associatedComponent);
393
394 auto bounds = aw->getBounds();
395 bounds = bounds.withSizeKeepingCentre (bounds.getWidth() + boundsOffset, bounds.getHeight() + boundsOffset);
396 aw->setBounds (bounds);
397
398 for (auto* child : aw->getChildren())
399 if (auto* button = dynamic_cast<TextButton*> (child))
400 button->setBounds (button->getBounds() + Point<int> (25, 40));
401
402 return aw;
403}
404
405void LookAndFeel_V4::drawAlertBox (Graphics& g, AlertWindow& alert,
406 const Rectangle<int>& textArea, TextLayout& textLayout)
407{
408 auto cornerSize = 4.0f;
409
410 g.setColour (alert.findColour (AlertWindow::outlineColourId));
411 g.drawRoundedRectangle (alert.getLocalBounds().toFloat(), cornerSize, 2.0f);
412
413 auto bounds = alert.getLocalBounds().reduced (1);
414 g.reduceClipRegion (bounds);
415
416 g.setColour (alert.findColour (AlertWindow::backgroundColourId));
417 g.fillRoundedRectangle (bounds.toFloat(), cornerSize);
418
419 auto iconSpaceUsed = 0;
420
421 auto iconWidth = 80;
422 auto iconSize = jmin (iconWidth + 50, bounds.getHeight() + 20);
423
424 if (alert.containsAnyExtraComponents() || alert.getNumButtons() > 2)
425 iconSize = jmin (iconSize, textArea.getHeight() + 50);
426
427 Rectangle<int> iconRect (iconSize / -10, iconSize / -10,
429
430 if (alert.getAlertType() != MessageBoxIconType::NoIcon)
431 {
432 Path icon;
433 char character;
434 uint32 colour;
435
436 if (alert.getAlertType() == MessageBoxIconType::WarningIcon)
437 {
438 character = '!';
439
440 icon.addTriangle ((float) iconRect.getX() + (float) iconRect.getWidth() * 0.5f, (float) iconRect.getY(),
441 static_cast<float> (iconRect.getRight()), static_cast<float> (iconRect.getBottom()),
442 static_cast<float> (iconRect.getX()), static_cast<float> (iconRect.getBottom()));
443
444 icon = icon.createPathWithRoundedCorners (5.0f);
445 colour = 0x66ff2a00;
446 }
447 else
448 {
449 colour = Colour (0xff00b0b9).withAlpha (0.4f).getARGB();
450 character = alert.getAlertType() == MessageBoxIconType::InfoIcon ? 'i' : '?';
451
452 icon.addEllipse (iconRect.toFloat());
453 }
454
455 GlyphArrangement ga;
456 ga.addFittedText ({ (float) iconRect.getHeight() * 0.9f, Font::bold },
457 String::charToString ((juce_wchar) (uint8) character),
458 static_cast<float> (iconRect.getX()), static_cast<float> (iconRect.getY()),
459 static_cast<float> (iconRect.getWidth()), static_cast<float> (iconRect.getHeight()),
461 ga.createPath (icon);
462
463 icon.setUsingNonZeroWinding (false);
464 g.setColour (Colour (colour));
465 g.fillPath (icon);
466
468 }
469
470 g.setColour (alert.findColour (AlertWindow::textColourId));
471
472 Rectangle<int> alertBounds (bounds.getX() + iconSpaceUsed, 30,
473 bounds.getWidth(), bounds.getHeight() - getAlertWindowButtonHeight() - 20);
474
475 textLayout.draw (g, alertBounds.toFloat());
476}
477
478int LookAndFeel_V4::getAlertWindowButtonHeight() { return 40; }
481Font LookAndFeel_V4::getAlertWindowFont() { return { 14.0f }; }
482
483//==============================================================================
485 int width, int height, double progress,
486 const String& textToShow)
487{
488 switch (progressBar.getResolvedStyle())
489 {
491 drawLinearProgressBar (g, progressBar, width, height, progress, textToShow);
492 break;
493
495 drawCircularProgressBar (g, progressBar, textToShow);
496 break;
497 }
498}
499
501{
502 return progressBar.getWidth() == progressBar.getHeight() ? ProgressBar::Style::circular
504}
505
506void LookAndFeel_V4::drawLinearProgressBar (Graphics& g, const ProgressBar& progressBar,
507 int width, int height, double progress,
508 const String& textToShow)
509{
510 auto background = progressBar.findColour (ProgressBar::backgroundColourId);
511 auto foreground = progressBar.findColour (ProgressBar::foregroundColourId);
512
513 auto barBounds = progressBar.getLocalBounds().toFloat();
514
515 g.setColour (background);
516 g.fillRoundedRectangle (barBounds, (float) progressBar.getHeight() * 0.5f);
517
518 if (progress >= 0.0f && progress <= 1.0f)
519 {
520 Path p;
521 p.addRoundedRectangle (barBounds, (float) progressBar.getHeight() * 0.5f);
522 g.reduceClipRegion (p);
523
524 barBounds.setWidth (barBounds.getWidth() * (float) progress);
526 g.fillRoundedRectangle (barBounds, (float) progressBar.getHeight() * 0.5f);
527 }
528 else
529 {
530 // spinning bar..
531 g.setColour (background);
532
533 auto stripeWidth = height * 2;
534 auto position = static_cast<int> (Time::getMillisecondCounter() / 15) % stripeWidth;
535
536 Path p;
537
538 for (auto x = static_cast<float> (-position); x < (float) (width + stripeWidth); x += (float) stripeWidth)
539 p.addQuadrilateral (x, 0.0f,
540 x + (float) stripeWidth * 0.5f, 0.0f,
541 x, static_cast<float> (height),
542 x - (float) stripeWidth * 0.5f, static_cast<float> (height));
543
544 Image im (Image::ARGB, width, height, true);
545
546 {
547 Graphics g2 (im);
548 g2.setColour (foreground);
549 g2.fillRoundedRectangle (barBounds, (float) progressBar.getHeight() * 0.5f);
550 }
551
552 g.setTiledImageFill (im, 0, 0, 0.85f);
553 g.fillPath (p);
554 }
555
556 if (textToShow.isNotEmpty())
557 {
558 g.setColour (Colour::contrasting (background, foreground));
559 g.setFont ((float) height * 0.6f);
560
561 g.drawText (textToShow, 0, 0, width, height, Justification::centred, false);
562 }
563}
564
565void LookAndFeel_V4::drawCircularProgressBar (Graphics& g, const ProgressBar& progressBar,
566 const String& textToShow)
567{
568 const auto background = progressBar.findColour (ProgressBar::backgroundColourId);
569 const auto foreground = progressBar.findColour (ProgressBar::foregroundColourId);
570
571 const auto barBounds = progressBar.getLocalBounds().reduced (2, 2).toFloat();
572 const auto size = jmin (barBounds.getWidth(), barBounds.getHeight());
573
574 const auto rotationInDegrees = static_cast<float> ((Time::getMillisecondCounter() / 10) % 360);
575 const auto normalisedRotation = rotationInDegrees / 360.0f;
576
577 constexpr auto rotationOffset = 22.5f;
578 constexpr auto maxRotation = 315.0f;
579
582
583 if (normalisedRotation >= 0.25f && normalisedRotation < 0.5f)
584 {
585 auto rescaledRotation = (normalisedRotation * 4.0f) - 1.0f;
587 }
588 else if (normalisedRotation >= 0.5f && normalisedRotation <= 1.0f)
589 {
591 auto rescaledRotation = 1.0f - ((normalisedRotation * 2.0f) - 1.0f);
593 }
594
595 g.setColour (background);
596 Path arcPath2;
597 arcPath2.addCentredArc (barBounds.getCentreX(),
598 barBounds.getCentreY(),
599 size * 0.5f,
600 size * 0.5f, 0.0f,
601 0.0f,
603 true);
604 g.strokePath (arcPath2, PathStrokeType (4.0f));
605
606 g.setColour (foreground);
607 Path arcPath;
608 arcPath.addCentredArc (barBounds.getCentreX(),
609 barBounds.getCentreY(),
610 size * 0.5f,
611 size * 0.5f,
612 0.0f,
615 true);
616
617 arcPath.applyTransform (AffineTransform::rotation (normalisedRotation * MathConstants<float>::pi * 2.25f, barBounds.getCentreX(), barBounds.getCentreY()));
618 g.strokePath (arcPath, PathStrokeType (4.0f));
619
620 if (textToShow.isNotEmpty())
621 {
622 g.setColour (progressBar.findColour (TextButton::textColourOffId));
623 g.setFont ({ 12.0f, Font::italic });
624 g.drawText (textToShow, barBounds, Justification::centred, false);
625 }
626}
627
628//==============================================================================
630{
631 return 8;
632}
633
634void LookAndFeel_V4::drawScrollbar (Graphics& g, ScrollBar& scrollbar, int x, int y, int width, int height,
635 bool isScrollbarVertical, int thumbStartPosition, int thumbSize, bool isMouseOver, [[maybe_unused]] bool isMouseDown)
636{
638
640 thumbBounds = { x, thumbStartPosition, width, thumbSize };
641 else
642 thumbBounds = { thumbStartPosition, y, thumbSize, height };
643
645 g.setColour (isMouseOver ? c.brighter (0.25f) : c);
646 g.fillRoundedRectangle (thumbBounds.reduced (1).toFloat(), 4.0f);
647}
648
649//==============================================================================
651{
652 static const unsigned char pathData[] = { 110,109,32,210,202,64,126,183,148,64,108,39,244,247,64,245,76,124,64,108,178,131,27,65,246,76,252,64,108,175,242,4,65,246,76,252,
653 64,108,236,5,68,65,0,0,160,180,108,240,150,90,65,21,136,52,63,108,48,59,16,65,0,0,32,65,108,32,210,202,64,126,183,148,64, 99,101,0,0 };
654
655 Path path;
656 path.loadPathFromData (pathData, sizeof (pathData));
657 path.scaleToFit (0, 0, height * 2.0f, height, true);
658
659 return path;
660}
661
663{
664 static const unsigned char pathData[] = { 110,109,51,51,255,66,0,0,0,0,108,205,204,13,67,51,51,99,65,108,0,0,170,66,205,204,141,66,108,51,179,13,67,52,51,255,66,108,0,0,255,
665 66,205,204,13,67,108,205,204,141,66,0,0,170,66,108,52,51,99,65,51,179,13,67,108,0,0,0,0,51,51,255,66,108,205,204,98,66, 204,204,141,66,108,0,0,0,0,51,51,99,65,108,51,51,
666 99,65,0,0,0,0,108,205,204,141,66,205,204,98,66,108,51,51,255,66,0,0,0,0,99,101,0,0 };
667
668 Path path;
669 path.loadPathFromData (pathData, sizeof (pathData));
670 path.scaleToFit (0, 0, height * 2.0f, height, true);
671
672 return path;
673}
674
675//==============================================================================
676void LookAndFeel_V4::fillTextEditorBackground (Graphics& g, int width, int height, TextEditor& textEditor)
677{
678 if (dynamic_cast<AlertWindow*> (textEditor.getParentComponent()) != nullptr)
679 {
681 g.fillRect (0, 0, width, height);
682
684 g.drawHorizontalLine (height - 1, 0.0f, static_cast<float> (width));
685 }
686 else
687 {
688 LookAndFeel_V2::fillTextEditorBackground (g, width, height, textEditor);
689 }
690}
691
692void LookAndFeel_V4::drawTextEditorOutline (Graphics& g, int width, int height, TextEditor& textEditor)
693{
694 if (dynamic_cast<AlertWindow*> (textEditor.getParentComponent()) == nullptr)
695 {
696 if (textEditor.isEnabled())
697 {
698 if (textEditor.hasKeyboardFocus (true) && ! textEditor.isReadOnly())
699 {
700 g.setColour (textEditor.findColour (TextEditor::focusedOutlineColourId));
701 g.drawRect (0, 0, width, height, 2);
702 }
703 else
704 {
705 g.setColour (textEditor.findColour (TextEditor::outlineColourId));
706 g.drawRect (0, 0, width, height);
707 }
708 }
709 }
710}
711
712//==============================================================================
713Button* LookAndFeel_V4::createFileBrowserGoUpButton()
714{
715 auto* goUpButton = new DrawableButton ("up", DrawableButton::ImageOnButtonBackground);
716
717 Path arrowPath;
718 arrowPath.addArrow ({ 50.0f, 100.0f, 50.0f, 0.0f }, 40.0f, 100.0f, 50.0f);
719
720 DrawablePath arrowImage;
721 arrowImage.setFill (goUpButton->findColour (TextButton::textColourOffId));
722 arrowImage.setPath (arrowPath);
723
724 goUpButton->setImages (&arrowImage);
725
726 return goUpButton;
727}
728
729void LookAndFeel_V4::layoutFileBrowserComponent (FileBrowserComponent& browserComp,
730 DirectoryContentsDisplayComponent* fileListComponent,
731 FilePreviewComponent* previewComp,
732 ComboBox* currentPathBox,
733 TextEditor* filenameBox,
734 Button* goUpButton)
735{
736 auto sectionHeight = 22;
737 auto buttonWidth = 50;
738
739 auto b = browserComp.getLocalBounds().reduced (20, 5);
740
741 auto topSlice = b.removeFromTop (sectionHeight);
742 auto bottomSlice = b.removeFromBottom (sectionHeight);
743
744 currentPathBox->setBounds (topSlice.removeFromLeft (topSlice.getWidth() - buttonWidth));
745
746 topSlice.removeFromLeft (6);
747 goUpButton->setBounds (topSlice);
748
749 bottomSlice.removeFromLeft (20);
750 filenameBox->setBounds (bottomSlice);
751
752 if (previewComp != nullptr)
753 previewComp->setBounds (b.removeFromRight (b.getWidth() / 3));
754
755 if (auto* listAsComp = dynamic_cast<Component*> (fileListComponent))
756 listAsComp->setBounds (b.reduced (0, 10));
757}
758
759void LookAndFeel_V4::drawFileBrowserRow (Graphics& g, int width, int height,
760 const File& file, const String& filename, Image* icon,
761 const String& fileSizeDescription,
762 const String& fileTimeDescription,
763 bool isDirectory, bool isItemSelected,
764 int itemIndex, DirectoryContentsDisplayComponent& dcc)
765{
766 LookAndFeel_V2::drawFileBrowserRow (g, width, height, file, filename, icon,
768 isDirectory, isItemSelected, itemIndex, dcc);
769}
770
771//==============================================================================
773 const bool isSeparator, const bool isActive,
774 const bool isHighlighted, const bool isTicked,
775 const bool hasSubMenu, const String& text,
776 const String& shortcutKeyText,
777 const Drawable* icon, const Colour* const textColourToUse)
778{
779 if (isSeparator)
780 {
781 auto r = area.reduced (5, 0);
782 r.removeFromTop (roundToInt (((float) r.getHeight() * 0.5f) - 0.5f));
783
784 g.setColour (findColour (PopupMenu::textColourId).withAlpha (0.3f));
785 g.fillRect (r.removeFromTop (1));
786 }
787 else
788 {
790 : *textColourToUse);
791
792 auto r = area.reduced (1);
793
794 if (isHighlighted && isActive)
795 {
797 g.fillRect (r);
798
800 }
801 else
802 {
803 g.setColour (textColour.withMultipliedAlpha (isActive ? 1.0f : 0.5f));
804 }
805
806 r.reduce (jmin (5, area.getWidth() / 20), 0);
807
808 auto font = getPopupMenuFont();
809
810 auto maxFontHeight = (float) r.getHeight() / 1.3f;
811
812 if (font.getHeight() > maxFontHeight)
813 font.setHeight (maxFontHeight);
814
815 g.setFont (font);
816
817 auto iconArea = r.removeFromLeft (roundToInt (maxFontHeight)).toFloat();
818
819 if (icon != nullptr)
820 {
822 r.removeFromLeft (roundToInt (maxFontHeight * 0.5f));
823 }
824 else if (isTicked)
825 {
826 auto tick = getTickShape (1.0f);
827 g.fillPath (tick, tick.getTransformToScaleToFit (iconArea.reduced (iconArea.getWidth() / 5, 0).toFloat(), true));
828 }
829
830 if (hasSubMenu)
831 {
832 auto arrowH = 0.6f * getPopupMenuFont().getAscent();
833
834 auto x = static_cast<float> (r.removeFromRight ((int) arrowH).getX());
835 auto halfH = static_cast<float> (r.getCentreY());
836
837 Path path;
838 path.startNewSubPath (x, halfH - arrowH * 0.5f);
839 path.lineTo (x + arrowH * 0.6f, halfH);
840 path.lineTo (x, halfH + arrowH * 0.5f);
841
842 g.strokePath (path, PathStrokeType (2.0f));
843 }
844
845 r.removeFromRight (3);
847
848 if (shortcutKeyText.isNotEmpty())
849 {
850 auto f2 = font;
851 f2.setHeight (f2.getHeight() * 0.75f);
852 f2.setHorizontalScale (0.95f);
853 g.setFont (f2);
854
856 }
857 }
858}
859
860void LookAndFeel_V4::getIdealPopupMenuItemSize (const String& text, const bool isSeparator,
862{
863 if (isSeparator)
864 {
865 idealWidth = 50;
867 }
868 else
869 {
870 auto font = getPopupMenuFont();
871
872 if (standardMenuItemHeight > 0 && font.getHeight() > (float) standardMenuItemHeight / 1.3f)
873 font.setHeight ((float) standardMenuItemHeight / 1.3f);
874
875 idealHeight = standardMenuItemHeight > 0 ? standardMenuItemHeight : roundToInt (font.getHeight() * 1.3f);
876 idealWidth = font.getStringWidth (text) + idealHeight * 2;
877 }
878}
879
880void LookAndFeel_V4::drawMenuBarBackground (Graphics& g, int width, int height,
881 bool, MenuBarComponent& menuBar)
882{
883 auto colour = menuBar.findColour (TextButton::buttonColourId).withAlpha (0.4f);
884
885 Rectangle<int> r (width, height);
886
887 g.setColour (colour.contrasting (0.15f));
888 g.fillRect (r.removeFromTop (1));
889 g.fillRect (r.removeFromBottom (1));
890
891 g.setGradientFill (ColourGradient::vertical (colour, 0, colour.darker (0.2f), (float) height));
892 g.fillRect (r);
893}
894
895void LookAndFeel_V4::drawMenuBarItem (Graphics& g, int width, int height,
896 int itemIndex, const String& itemText,
897 bool isMouseOverItem, bool isMenuOpen,
898 bool /*isMouseOverBar*/, MenuBarComponent& menuBar)
899{
900 if (! menuBar.isEnabled())
901 {
902 g.setColour (menuBar.findColour (TextButton::textColourOffId)
903 .withMultipliedAlpha (0.5f));
904 }
905 else if (isMenuOpen || isMouseOverItem)
906 {
907 g.fillAll (menuBar.findColour (TextButton::buttonOnColourId));
908 g.setColour (menuBar.findColour (TextButton::textColourOnId));
909 }
910 else
911 {
912 g.setColour (menuBar.findColour (TextButton::textColourOffId));
913 }
914
915 g.setFont (getMenuBarFont (menuBar, itemIndex, itemText));
916 g.drawFittedText (itemText, 0, 0, width, height, Justification::centred, 1);
917}
918
919//==============================================================================
920void LookAndFeel_V4::drawComboBox (Graphics& g, int width, int height, bool,
921 int, int, int, int, ComboBox& box)
922{
923 auto cornerSize = box.findParentComponentOfClass<ChoicePropertyComponent>() != nullptr ? 0.0f : 3.0f;
924 Rectangle<int> boxBounds (0, 0, width, height);
925
926 g.setColour (box.findColour (ComboBox::backgroundColourId));
927 g.fillRoundedRectangle (boxBounds.toFloat(), cornerSize);
928
929 g.setColour (box.findColour (ComboBox::outlineColourId));
930 g.drawRoundedRectangle (boxBounds.toFloat().reduced (0.5f, 0.5f), cornerSize, 1.0f);
931
932 Rectangle<int> arrowZone (width - 30, 0, 20, height);
933 Path path;
934 path.startNewSubPath ((float) arrowZone.getX() + 3.0f, (float) arrowZone.getCentreY() - 2.0f);
935 path.lineTo ((float) arrowZone.getCentreX(), (float) arrowZone.getCentreY() + 3.0f);
936 path.lineTo ((float) arrowZone.getRight() - 3.0f, (float) arrowZone.getCentreY() - 2.0f);
937
938 g.setColour (box.findColour (ComboBox::arrowColourId).withAlpha ((box.isEnabled() ? 0.9f : 0.2f)));
939 g.strokePath (path, PathStrokeType (2.0f));
940}
941
942Font LookAndFeel_V4::getComboBoxFont (ComboBox& box)
943{
944 return { jmin (16.0f, (float) box.getHeight() * 0.85f) };
945}
946
947void LookAndFeel_V4::positionComboBoxText (ComboBox& box, Label& label)
948{
949 label.setBounds (1, 1,
950 box.getWidth() - 30,
951 box.getHeight() - 2);
952
953 label.setFont (getComboBoxFont (box));
954}
955
956//==============================================================================
957int LookAndFeel_V4::getSliderThumbRadius (Slider& slider)
958{
959 return jmin (12, slider.isHorizontal() ? static_cast<int> ((float) slider.getHeight() * 0.5f)
960 : static_cast<int> ((float) slider.getWidth() * 0.5f));
961}
962
963void LookAndFeel_V4::drawLinearSlider (Graphics& g, int x, int y, int width, int height,
964 float sliderPos,
965 float minSliderPos,
966 float maxSliderPos,
967 const Slider::SliderStyle style, Slider& slider)
968{
969 if (slider.isBar())
970 {
971 g.setColour (slider.findColour (Slider::trackColourId));
972 g.fillRect (slider.isHorizontal() ? Rectangle<float> (static_cast<float> (x), (float) y + 0.5f, sliderPos - (float) x, (float) height - 1.0f)
973 : Rectangle<float> ((float) x + 0.5f, sliderPos, (float) width - 1.0f, (float) y + ((float) height - sliderPos)));
974
975 drawLinearSliderOutline (g, x, y, width, height, style, slider);
976 }
977 else
978 {
981
982 auto trackWidth = jmin (6.0f, slider.isHorizontal() ? (float) height * 0.25f : (float) width * 0.25f);
983
984 Point<float> startPoint (slider.isHorizontal() ? (float) x : (float) x + (float) width * 0.5f,
985 slider.isHorizontal() ? (float) y + (float) height * 0.5f : (float) (height + y));
986
987 Point<float> endPoint (slider.isHorizontal() ? (float) (width + x) : startPoint.x,
988 slider.isHorizontal() ? startPoint.y : (float) y);
989
990 Path backgroundTrack;
991 backgroundTrack.startNewSubPath (startPoint);
992 backgroundTrack.lineTo (endPoint);
993 g.setColour (slider.findColour (Slider::backgroundColourId));
995
996 Path valueTrack;
997 Point<float> minPoint, maxPoint, thumbPoint;
998
999 if (isTwoVal || isThreeVal)
1000 {
1001 minPoint = { slider.isHorizontal() ? minSliderPos : (float) width * 0.5f,
1002 slider.isHorizontal() ? (float) height * 0.5f : minSliderPos };
1003
1004 if (isThreeVal)
1005 thumbPoint = { slider.isHorizontal() ? sliderPos : (float) width * 0.5f,
1006 slider.isHorizontal() ? (float) height * 0.5f : sliderPos };
1007
1008 maxPoint = { slider.isHorizontal() ? maxSliderPos : (float) width * 0.5f,
1009 slider.isHorizontal() ? (float) height * 0.5f : maxSliderPos };
1010 }
1011 else
1012 {
1013 auto kx = slider.isHorizontal() ? sliderPos : ((float) x + (float) width * 0.5f);
1014 auto ky = slider.isHorizontal() ? ((float) y + (float) height * 0.5f) : sliderPos;
1015
1017 maxPoint = { kx, ky };
1018 }
1019
1020 auto thumbWidth = getSliderThumbRadius (slider);
1021
1022 valueTrack.startNewSubPath (minPoint);
1024 g.setColour (slider.findColour (Slider::trackColourId));
1026
1027 if (! isTwoVal)
1028 {
1029 g.setColour (slider.findColour (Slider::thumbColourId));
1030 g.fillEllipse (Rectangle<float> (static_cast<float> (thumbWidth), static_cast<float> (thumbWidth)).withCentre (isThreeVal ? thumbPoint : maxPoint));
1031 }
1032
1033 if (isTwoVal || isThreeVal)
1034 {
1035 auto sr = jmin (trackWidth, (slider.isHorizontal() ? (float) height : (float) width) * 0.4f);
1036 auto pointerColour = slider.findColour (Slider::thumbColourId);
1037
1038 if (slider.isHorizontal())
1039 {
1040 drawPointer (g, minSliderPos - sr,
1041 jmax (0.0f, (float) y + (float) height * 0.5f - trackWidth * 2.0f),
1042 trackWidth * 2.0f, pointerColour, 2);
1043
1044 drawPointer (g, maxSliderPos - trackWidth,
1045 jmin ((float) (y + height) - trackWidth * 2.0f, (float) y + (float) height * 0.5f),
1046 trackWidth * 2.0f, pointerColour, 4);
1047 }
1048 else
1049 {
1050 drawPointer (g, jmax (0.0f, (float) x + (float) width * 0.5f - trackWidth * 2.0f),
1052 trackWidth * 2.0f, pointerColour, 1);
1053
1054 drawPointer (g, jmin ((float) (x + width) - trackWidth * 2.0f, (float) x + (float) width * 0.5f), maxSliderPos - sr,
1055 trackWidth * 2.0f, pointerColour, 3);
1056 }
1057 }
1058
1059 if (slider.isBar())
1060 drawLinearSliderOutline (g, x, y, width, height, style, slider);
1061 }
1062}
1063
1064void LookAndFeel_V4::drawRotarySlider (Graphics& g, int x, int y, int width, int height, float sliderPos,
1065 const float rotaryStartAngle, const float rotaryEndAngle, Slider& slider)
1066{
1067 auto outline = slider.findColour (Slider::rotarySliderOutlineColourId);
1068 auto fill = slider.findColour (Slider::rotarySliderFillColourId);
1069
1070 auto bounds = Rectangle<int> (x, y, width, height).toFloat().reduced (10);
1071
1072 auto radius = jmin (bounds.getWidth(), bounds.getHeight()) / 2.0f;
1074 auto lineW = jmin (8.0f, radius * 0.5f);
1075 auto arcRadius = radius - lineW * 0.5f;
1076
1077 Path backgroundArc;
1078 backgroundArc.addCentredArc (bounds.getCentreX(),
1079 bounds.getCentreY(),
1080 arcRadius,
1081 arcRadius,
1082 0.0f,
1085 true);
1086
1087 g.setColour (outline);
1088 g.strokePath (backgroundArc, PathStrokeType (lineW, PathStrokeType::curved, PathStrokeType::rounded));
1089
1090 if (slider.isEnabled())
1091 {
1092 Path valueArc;
1093 valueArc.addCentredArc (bounds.getCentreX(),
1094 bounds.getCentreY(),
1095 arcRadius,
1096 arcRadius,
1097 0.0f,
1099 toAngle,
1100 true);
1101
1102 g.setColour (fill);
1103 g.strokePath (valueArc, PathStrokeType (lineW, PathStrokeType::curved, PathStrokeType::rounded));
1104 }
1105
1106 auto thumbWidth = lineW * 2.0f;
1107 Point<float> thumbPoint (bounds.getCentreX() + arcRadius * std::cos (toAngle - MathConstants<float>::halfPi),
1108 bounds.getCentreY() + arcRadius * std::sin (toAngle - MathConstants<float>::halfPi));
1109
1110 g.setColour (slider.findColour (Slider::thumbColourId));
1111 g.fillEllipse (Rectangle<float> (thumbWidth, thumbWidth).withCentre (thumbPoint));
1112}
1113
1114void LookAndFeel_V4::drawPointer (Graphics& g, const float x, const float y, const float diameter,
1115 const Colour& colour, const int direction) noexcept
1116{
1117 Path p;
1118 p.startNewSubPath (x + diameter * 0.5f, y);
1119 p.lineTo (x + diameter, y + diameter * 0.6f);
1120 p.lineTo (x + diameter, y + diameter);
1121 p.lineTo (x, y + diameter);
1122 p.lineTo (x, y + diameter * 0.6f);
1123 p.closeSubPath();
1124
1125 p.applyTransform (AffineTransform::rotation ((float) direction * MathConstants<float>::halfPi,
1126 x + diameter * 0.5f, y + diameter * 0.5f));
1127 g.setColour (colour);
1128 g.fillPath (p);
1129}
1130
1131Label* LookAndFeel_V4::createSliderTextBox (Slider& slider)
1132{
1133 auto* l = LookAndFeel_V2::createSliderTextBox (slider);
1134
1135 if (getCurrentColourScheme() == LookAndFeel_V4::getGreyColourScheme() && (slider.getSliderStyle() == Slider::LinearBar
1136 || slider.getSliderStyle() == Slider::LinearBarVertical))
1137 {
1138 l->setColour (Label::textColourId, Colours::black.withAlpha (0.7f));
1139 }
1140
1141 return l;
1142}
1143
1144//==============================================================================
1145void LookAndFeel_V4::drawTooltip (Graphics& g, const String& text, int width, int height)
1146{
1147 Rectangle<int> bounds (width, height);
1148 auto cornerSize = 5.0f;
1149
1151 g.fillRoundedRectangle (bounds.toFloat(), cornerSize);
1152
1154 g.drawRoundedRectangle (bounds.toFloat().reduced (0.5f, 0.5f), cornerSize, 1.0f);
1155
1156 detail::LookAndFeelHelpers::layoutTooltipText (text, findColour (TooltipWindow::textColourId))
1157 .draw (g, { static_cast<float> (width), static_cast<float> (height) });
1158}
1159
1160//==============================================================================
1161void LookAndFeel_V4::drawConcertinaPanelHeader (Graphics& g, const Rectangle<int>& area,
1162 bool isMouseOver, bool /*isMouseDown*/,
1163 ConcertinaPanel& concertina, Component& panel)
1164{
1165 auto bounds = area.toFloat().reduced (0.5f);
1166 auto cornerSize = 4.0f;
1167 auto isTopPanel = (concertina.getPanel (0) == &panel);
1168
1169 Path p;
1170 p.addRoundedRectangle (bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight(),
1171 cornerSize, cornerSize, isTopPanel, isTopPanel, false, false);
1172
1173 g.setGradientFill (ColourGradient::vertical (Colours::white.withAlpha (isMouseOver ? 0.4f : 0.2f), static_cast<float> (area.getY()),
1174 Colours::darkgrey.withAlpha (0.1f), static_cast<float> (area.getBottom())));
1175 g.fillPath (p);
1176}
1177
1178//==============================================================================
1179void LookAndFeel_V4::drawLevelMeter (Graphics& g, int width, int height, float level)
1180{
1181 auto outerCornerSize = 3.0f;
1182 auto outerBorderWidth = 2.0f;
1183 auto totalBlocks = 7;
1184 auto spacingFraction = 0.03f;
1185
1187 g.fillRoundedRectangle (0.0f, 0.0f, static_cast<float> (width), static_cast<float> (height), outerCornerSize);
1188
1190 auto numBlocks = roundToInt ((float) totalBlocks * level);
1191
1192 auto blockWidth = ((float) width - doubleOuterBorderWidth) / static_cast<float> (totalBlocks);
1193 auto blockHeight = (float) height - doubleOuterBorderWidth;
1194
1195 auto blockRectWidth = (1.0f - 2.0f * spacingFraction) * blockWidth;
1197
1198 auto blockCornerSize = 0.1f * blockWidth;
1199
1201
1202 for (auto i = 0; i < totalBlocks; ++i)
1203 {
1204 if (i >= numBlocks)
1205 g.setColour (c.withAlpha (0.5f));
1206 else
1207 g.setColour (i < totalBlocks - 1 ? c : Colours::red);
1208
1209 g.fillRoundedRectangle (outerBorderWidth + ((float) i * blockWidth) + blockRectSpacing,
1214 }
1215}
1216
1217//==============================================================================
1218void LookAndFeel_V4::paintToolbarBackground (Graphics& g, int w, int h, Toolbar& toolbar)
1219{
1220 auto background = toolbar.findColour (Toolbar::backgroundColourId);
1221
1222 g.setGradientFill ({ background, 0.0f, 0.0f,
1223 background.darker (0.2f),
1224 toolbar.isVertical() ? (float) w - 1.0f : 0.0f,
1225 toolbar.isVertical() ? 0.0f : (float) h - 1.0f,
1226 false });
1227 g.fillAll();
1228}
1229
1230void LookAndFeel_V4::paintToolbarButtonLabel (Graphics& g, int x, int y, int width, int height,
1231 const String& text, ToolbarItemComponent& component)
1232{
1233 auto baseTextColour = component.findParentComponentOfClass<PopupMenu::CustomComponent>() != nullptr
1234 ? component.findColour (PopupMenu::textColourId)
1235 : component.findColour (Toolbar::labelTextColourId);
1236
1237 g.setColour (baseTextColour.withAlpha (component.isEnabled() ? 1.0f : 0.25f));
1238
1239 auto fontHeight = jmin (14.0f, (float) height * 0.85f);
1240 g.setFont (fontHeight);
1241
1242 g.drawFittedText (text,
1243 x, y, width, height,
1245 jmax (1, height / (int) fontHeight));
1246}
1247
1248//==============================================================================
1249void LookAndFeel_V4::drawPropertyPanelSectionHeader (Graphics& g, const String& name,
1250 bool isOpen, int width, int height)
1251{
1252 auto buttonSize = (float) height * 0.75f;
1253 auto buttonIndent = ((float) height - buttonSize) * 0.5f;
1254
1255 drawTreeviewPlusMinusBox (g, { buttonIndent, buttonIndent, buttonSize, buttonSize },
1257
1258 auto textX = static_cast<int> ((buttonIndent * 2.0f + buttonSize + 2.0f));
1259
1261
1262 g.setFont ({ (float) height * 0.7f, Font::bold });
1263 g.drawText (name, textX, 0, width - textX - 4, height, Justification::centredLeft, true);
1264}
1265
1266void LookAndFeel_V4::drawPropertyComponentBackground (Graphics& g, int width, int height, PropertyComponent& component)
1267{
1268 g.setColour (component.findColour (PropertyComponent::backgroundColourId));
1269 g.fillRect (0, 0, width, height - 1);
1270}
1271
1272void LookAndFeel_V4::drawPropertyComponentLabel (Graphics& g, [[maybe_unused]] int width, int height, PropertyComponent& component)
1273{
1274 auto indent = getPropertyComponentIndent (component);
1275
1276 g.setColour (component.findColour (PropertyComponent::labelTextColourId)
1277 .withMultipliedAlpha (component.isEnabled() ? 1.0f : 0.6f));
1278
1279 g.setFont ((float) jmin (height, 24) * 0.65f);
1280
1281 auto r = getPropertyComponentContentPosition (component);
1282
1283 g.drawFittedText (component.getName(),
1284 indent, r.getY(), r.getX() - 5, r.getHeight(),
1286}
1287
1288int LookAndFeel_V4::getPropertyComponentIndent (PropertyComponent& component)
1289{
1290 return jmin (10, component.getWidth() / 10);
1291}
1292
1293Rectangle<int> LookAndFeel_V4::getPropertyComponentContentPosition (PropertyComponent& component)
1294{
1295 auto textW = jmin (200, component.getWidth() / 2);
1296 return { textW, 0, component.getWidth() - textW, component.getHeight() - 1 };
1297}
1298
1299//==============================================================================
1300void LookAndFeel_V4::drawCallOutBoxBackground (CallOutBox& box, Graphics& g,
1301 const Path& path, Image& cachedImage)
1302{
1303 if (cachedImage.isNull())
1304 {
1305 cachedImage = { Image::ARGB, box.getWidth(), box.getHeight(), true };
1306 Graphics g2 (cachedImage);
1307
1308 DropShadow (Colours::black.withAlpha (0.7f), 8, { 0, 2 }).drawForPath (g2, path);
1309 }
1310
1311 g.setColour (Colours::black);
1312 g.drawImageAt (cachedImage, 0, 0);
1313
1314 g.setColour (currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).withAlpha (0.8f));
1315 g.fillPath (path);
1316
1317 g.setColour (currentColourScheme.getUIColour (ColourScheme::UIColour::outline).withAlpha (0.8f));
1318 g.strokePath (path, PathStrokeType (2.0f));
1319}
1320
1321//==============================================================================
1322void LookAndFeel_V4::drawStretchableLayoutResizerBar (Graphics& g, int /*w*/, int /*h*/, bool /*isVerticalBar*/,
1323 bool isMouseOver, bool isMouseDragging)
1324{
1325 if (isMouseOver || isMouseDragging)
1326 g.fillAll (currentColourScheme.getUIColour (ColourScheme::UIColour::defaultFill).withAlpha (0.5f));
1327}
1328
1329//==============================================================================
1330void LookAndFeel_V4::initialiseColours()
1331{
1332 const uint32 transparent = 0x00000000;
1333
1334 const uint32 coloursToUse[] =
1335 {
1336 TextButton::buttonColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
1337 TextButton::buttonOnColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::highlightedFill).getARGB(),
1338 TextButton::textColourOnId, currentColourScheme.getUIColour (ColourScheme::UIColour::highlightedText).getARGB(),
1339 TextButton::textColourOffId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
1340
1341 ToggleButton::textColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
1342 ToggleButton::tickColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
1343 ToggleButton::tickDisabledColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).withAlpha (0.5f).getARGB(),
1344
1345 TextEditor::backgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
1346 TextEditor::textColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
1347 TextEditor::highlightColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultFill).withAlpha (0.4f).getARGB(),
1348 TextEditor::highlightedTextColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::highlightedText).getARGB(),
1349 TextEditor::outlineColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
1350 TextEditor::focusedOutlineColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
1352
1353 CaretComponent::caretColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultFill).getARGB(),
1354
1356 Label::textColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
1358 Label::textWhenEditingColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
1359
1361 ScrollBar::thumbColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultFill).getARGB(),
1363
1366 TreeView::dragAndDropIndicatorColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
1370
1371 PopupMenu::backgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::menuBackground).getARGB(),
1372 PopupMenu::textColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::menuText).getARGB(),
1373 PopupMenu::headerTextColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::menuText).getARGB(),
1374 PopupMenu::highlightedTextColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::highlightedText).getARGB(),
1375 PopupMenu::highlightedBackgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::highlightedFill).getARGB(),
1376
1377 ComboBox::buttonColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
1378 ComboBox::outlineColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
1379 ComboBox::textColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
1380 ComboBox::backgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
1381 ComboBox::arrowColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
1382 ComboBox::focusedOutlineColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
1383
1384 PropertyComponent::backgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
1385 PropertyComponent::labelTextColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
1386
1387 TextPropertyComponent::backgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
1388 TextPropertyComponent::textColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
1389 TextPropertyComponent::outlineColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
1390
1391 BooleanPropertyComponent::backgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
1392 BooleanPropertyComponent::outlineColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
1393
1394 ListBox::backgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
1395 ListBox::outlineColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
1396 ListBox::textColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
1397
1398 Slider::backgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
1399 Slider::thumbColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultFill).getARGB(),
1400 Slider::trackColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::highlightedFill).getARGB(),
1401 Slider::rotarySliderFillColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::highlightedFill).getARGB(),
1402 Slider::rotarySliderOutlineColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
1403 Slider::textBoxTextColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
1404 Slider::textBoxBackgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).withAlpha (0.0f).getARGB(),
1405 Slider::textBoxHighlightColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultFill).withAlpha (0.4f).getARGB(),
1406 Slider::textBoxOutlineColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
1407
1408 ResizableWindow::backgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::windowBackground).getARGB(),
1409
1410 DocumentWindow::textColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
1411
1412 AlertWindow::backgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
1413 AlertWindow::textColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
1414 AlertWindow::outlineColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
1415
1416 ProgressBar::backgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
1417 ProgressBar::foregroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::highlightedFill).getARGB(),
1418
1419 TooltipWindow::backgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::highlightedFill).getARGB(),
1420 TooltipWindow::textColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::highlightedText).getARGB(),
1422
1424 TabbedComponent::outlineColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
1425 TabbedButtonBar::tabOutlineColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).withAlpha (0.5f).getARGB(),
1426 TabbedButtonBar::frontOutlineColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
1427
1428 Toolbar::backgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).withAlpha (0.4f).getARGB(),
1429 Toolbar::separatorColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
1430 Toolbar::buttonMouseOverBackgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).contrasting (0.2f).getARGB(),
1431 Toolbar::buttonMouseDownBackgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).contrasting (0.5f).getARGB(),
1432 Toolbar::labelTextColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
1433 Toolbar::editingModeOutlineColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
1434 Toolbar::customisationDialogBackgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
1435
1436 DrawableButton::textColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
1437 DrawableButton::textColourOnId, currentColourScheme.getUIColour (ColourScheme::UIColour::highlightedText).getARGB(),
1439 DrawableButton::backgroundOnColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::highlightedFill).getARGB(),
1440
1441 HyperlinkButton::textColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).interpolatedWith (Colours::blue, 0.4f).getARGB(),
1442
1443 GroupComponent::outlineColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
1444 GroupComponent::textColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
1445
1446 BubbleComponent::backgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
1447 BubbleComponent::outlineColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
1448
1449 DirectoryContentsDisplayComponent::highlightColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::highlightedFill).getARGB(),
1450 DirectoryContentsDisplayComponent::textColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::menuText).getARGB(),
1451 DirectoryContentsDisplayComponent::highlightedTextColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::highlightedText).getARGB(),
1452
1453 0x1000440, /*LassoComponent::lassoFillColourId*/ currentColourScheme.getUIColour (ColourScheme::UIColour::defaultFill).getARGB(),
1454 0x1000441, /*LassoComponent::lassoOutlineColourId*/ currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
1455
1456 0x1004000, /*KeyboardComponentBase::upDownButtonBackgroundColourId*/ 0xffd3d3d3,
1457 0x1004001, /*KeyboardComponentBase::upDownButtonArrowColourId*/ 0xff000000,
1458
1459 0x1005000, /*MidiKeyboardComponent::whiteNoteColourId*/ 0xffffffff,
1460 0x1005001, /*MidiKeyboardComponent::blackNoteColourId*/ 0xff000000,
1461 0x1005002, /*MidiKeyboardComponent::keySeparatorLineColourId*/ 0x66000000,
1462 0x1005003, /*MidiKeyboardComponent::mouseOverKeyOverlayColourId*/ 0x80ffff00,
1463 0x1005004, /*MidiKeyboardComponent::keyDownOverlayColourId*/ 0xffb6b600,
1464 0x1005005, /*MidiKeyboardComponent::textLabelColourId*/ 0xff000000,
1465 0x1005006, /*MidiKeyboardComponent::shadowColourId*/ 0x4c000000,
1466
1467 0x1006000, /*MPEKeyboardComponent::whiteNoteColourId*/ 0xff1a1c27,
1468 0x1006001, /*MPEKeyboardComponent::blackNoteColourId*/ 0x99f1f1f1,
1469 0x1006002, /*MPEKeyboardComponent::textLabelColourId*/ 0xfff1f1f1,
1470 0x1006003, /*MPEKeyboardComponent::noteCircleFillColourId*/ 0x99ba00ff,
1471 0x1006004, /*MPEKeyboardComponent::noteCircleOutlineColourId*/ 0xfff1f1f1,
1472
1473 0x1004500, /*CodeEditorComponent::backgroundColourId*/ currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
1474 0x1004502, /*CodeEditorComponent::highlightColourId*/ currentColourScheme.getUIColour (ColourScheme::UIColour::defaultFill).withAlpha (0.4f).getARGB(),
1475 0x1004503, /*CodeEditorComponent::defaultTextColourId*/ currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
1476 0x1004504, /*CodeEditorComponent::lineNumberBackgroundId*/ currentColourScheme.getUIColour (ColourScheme::UIColour::highlightedFill).withAlpha (0.5f).getARGB(),
1477 0x1004505, /*CodeEditorComponent::lineNumberTextId*/ currentColourScheme.getUIColour (ColourScheme::UIColour::defaultFill).getARGB(),
1478
1479 0x1007000, /*ColourSelector::backgroundColourId*/ currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
1480 0x1007001, /*ColourSelector::labelTextColourId*/ currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
1481
1482 0x100ad00, /*KeyMappingEditorComponent::backgroundColourId*/ currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
1483 0x100ad01, /*KeyMappingEditorComponent::textColourId*/ currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
1484
1485 FileSearchPathListComponent::backgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::menuBackground).getARGB(),
1486
1487 FileChooserDialogBox::titleTextColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
1488
1489 SidePanel::backgroundColour, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
1490 SidePanel::titleTextColour, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
1491 SidePanel::shadowBaseColour, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).darker().getARGB(),
1492 SidePanel::dismissButtonNormalColour, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultFill).getARGB(),
1493 SidePanel::dismissButtonOverColour, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultFill).darker().getARGB(),
1494 SidePanel::dismissButtonDownColour, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultFill).brighter().getARGB(),
1495
1496 FileBrowserComponent::currentPathBoxBackgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::menuBackground).getARGB(),
1497 FileBrowserComponent::currentPathBoxTextColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::menuText).getARGB(),
1498 FileBrowserComponent::currentPathBoxArrowColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::menuText).getARGB(),
1499 FileBrowserComponent::filenameBoxBackgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::menuBackground).getARGB(),
1500 FileBrowserComponent::filenameBoxTextColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::menuText).getARGB(),
1501 };
1502
1503 for (int i = 0; i < numElementsInArray (coloursToUse); i += 2)
1504 setColour ((int) coloursToUse [i], Colour ((uint32) coloursToUse [i + 1]));
1505}
1506
1507} // namespace juce
static AffineTransform rotation(float angleInRadians) noexcept
Returns a new transform which is a rotation about (0, 0).
A window that displays a message and has buttons for the user to react to it.
@ textColourId
The colour for the text.
@ outlineColourId
An optional colour to use to draw a border around the window.
@ backgroundColourId
The background colour for the window.
@ backgroundColourId
The colour to fill the background of the button area.
@ outlineColourId
The colour to use to draw an outline around the text area.
@ outlineColourId
The colour to use for an outline around the bubble.
@ backgroundColourId
A background colour to fill the bubble with.
A base class for buttons.
Definition juce_Button.h:43
bool getToggleState() const noexcept
Returns true if the button is 'on'.
@ caretColourId
The colour with which to draw the caret.
static ColourGradient vertical(Colour colour1, float y1, Colour colour2, float y2)
Creates a vertical linear gradient between two Y coordinates.
Represents a colour, also including a transparency value.
Definition juce_Colour.h:38
Colour withAlpha(uint8 newAlpha) const noexcept
Returns a colour that's the same colour as this one, but with a new alpha value.
Colour brighter(float amountBrighter=0.4f) const noexcept
Returns a brighter version of this colour.
Colour darker(float amountDarker=0.4f) const noexcept
Returns a darker version of this colour.
Colour interpolatedWith(Colour other, float proportionOfOther) const noexcept
Returns a colour that lies somewhere between this one and another.
uint32 getARGB() const noexcept
Returns a 32-bit integer that represents this colour.
Colour contrasting(float amount=1.0f) const noexcept
Returns a colour that will be clearly visible against this colour.
@ arrowColourId
The colour for the arrow shape that pops up the menu.
@ outlineColourId
The colour for an outline around the box.
@ focusedOutlineColourId
The colour that will be used to draw a box around the edge of the component when it has focus.
@ textColourId
The colour for the text in the box.
@ buttonColourId
The base colour for the button (a LookAndFeel class will probably use variations on this).
@ backgroundColourId
The background colour to fill the box with.
The base class for all JUCE user-interface objects.
Component * getParentComponent() const noexcept
Returns the component which this component is inside.
int getHeight() const noexcept
Returns the component's height in pixels.
Colour findColour(int colourID, bool inheritFromParent=false) const
Looks for a colour that has been registered with the given colour ID number.
bool isEnabled() const noexcept
Returns true if the component (and all its parents) are enabled.
Rectangle< int > getLocalBounds() const noexcept
Returns the component's bounds, relative to its own origin.
@ highlightColourId
The colour to use to fill a highlighted row of the list.
@ highlightedTextColourId
The colour with which to draw the text in highlighted sections.
@ textColourId
The colour to draw any text with.
@ ImageOnButtonBackground
Draws the button as a standard rounded-rectangle button with the image on top.
@ textColourOnId
The colour to use for the button's text when the button's toggle state is "on".
@ textColourId
The colour to use for the button's text label.
@ backgroundColourId
The colour used to fill the button's background (when the button is toggled 'off').
@ backgroundOnColourId
The colour used to fill the button's background (when the button is toggled 'on').
The base class for objects which can draw themselves, e.g.
void drawWithin(Graphics &g, Rectangle< float > destArea, RectanglePlacement placement, float opacity) const
Renders the Drawable within a rectangle, scaling it to fit neatly inside without changing its aspect-...
@ currentPathBoxTextColourId
The colour to use for the text of the current path ComboBox.
@ filenameBoxBackgroundColourId
The colour to use to fill the background of the filename TextEditor.
@ currentPathBoxBackgroundColourId
The colour to use to fill the background of the current path ComboBox.
@ filenameBoxTextColourId
The colour to use for the text of the filename TextEditor.
@ currentPathBoxArrowColourId
The colour to use to draw the arrow of the current path ComboBox.
@ titleTextColourId
The colour to use to draw the box's title.
@ backgroundColourId
The background colour to fill the component with.
Represents a particular font, including its size, style, etc.
Definition juce_Font.h:42
float getAscent() const
Returns the height of the font above its baseline, in pixels.
@ bold
boldens the font.
Definition juce_Font.h:51
@ plain
indicates a plain, non-bold, non-italic version of the font.
Definition juce_Font.h:50
@ italic
finds an italic version of the font.
Definition juce_Font.h:52
A graphics context, used for drawing a component or image.
void setOpacity(float newOpacity)
Changes the opacity to use with the current colour.
void drawText(const String &text, int x, int y, int width, int height, Justification justificationType, bool useEllipsesIfTooBig=true) const
Draws a line of text within a specified rectangle.
void drawFittedText(const String &text, int x, int y, int width, int height, Justification justificationFlags, int maximumNumberOfLines, float minimumHorizontalScale=0.0f) const
Tries to draw a text string inside a given space.
void setFont(const Font &newFont)
Changes the font to use for subsequent text-drawing functions.
void setGradientFill(const ColourGradient &gradient)
Sets the context to use a gradient for its fill pattern.
void fillRoundedRectangle(float x, float y, float width, float height, float cornerSize) const
Uses the current colour or brush to fill a rectangle with rounded corners.
void setTiledImageFill(const Image &imageToUse, int anchorX, int anchorY, float opacity)
Sets the context to use a tiled image pattern for filling.
void fillRect(Rectangle< int > rectangle) const
Fills a rectangle with the current colour or brush.
void fillPath(const Path &path) const
Fills a path using the currently selected colour or brush.
bool reduceClipRegion(int x, int y, int width, int height)
Intersects the current clipping region with another region.
void drawHorizontalLine(int y, float left, float right) const
Draws a horizontal line of pixels at a given y position.
void setColour(Colour newColour)
Changes the current drawing colour.
void strokePath(const Path &path, const PathStrokeType &strokeType, const AffineTransform &transform={}) const
Draws a path's outline using the currently selected colour or brush.
void fillAll() const
Fills the context's entire clip region with the current colour or brush.
void drawRoundedRectangle(float x, float y, float width, float height, float cornerSize, float lineThickness) const
Uses the current colour or brush to draw the outline of a rectangle with rounded corners.
@ textColourId
The colour to use to draw the text label.
@ outlineColourId
The colour to use for drawing the line around the edge.
@ textColourId
The colour to use for the URL text.
@ ARGB
< each pixel is a 4-byte ARGB premultiplied colour value.
Definition juce_Image.h:67
Represents a type of justification to be used when positioning graphical items.
@ centredRight
Indicates that the item should be centred vertically but placed on the right hand side.
@ centred
Indicates that the item should be centred vertically and horizontally.
@ centredLeft
Indicates that the item should be centred vertically but placed on the left hand side.
const Rectangle< ValueType > appliedToRectangle(const Rectangle< ValueType > &areaToAdjust, const Rectangle< ValueType > &targetSpace) const noexcept
Returns the new position of a rectangle that has been justified to fit within a given space.
@ outlineColourId
An optional colour to use to draw a border around the label.
Definition juce_Label.h:108
@ backgroundColourId
The background colour to fill the label with.
Definition juce_Label.h:106
@ textWhenEditingColourId
The colour for the text when the label is being edited.
Definition juce_Label.h:111
@ textColourId
The colour for the text.
Definition juce_Label.h:107
@ textColourId
The preferred colour to use for drawing text in the listbox.
@ backgroundColourId
The background colour to fill the list with.
@ outlineColourId
An optional colour to use to draw a border around the list.
Font getPopupMenuFont() override
Returns the size and style of font to use in popup menus.
A struct containing the set of colours to apply to the GUI.
Colour getUIColour(UIColour colourToGet) const noexcept
Returns a colour from the scheme.
bool operator==(const ColourScheme &) const noexcept
Returns true if two ColourPalette objects contain the same colours.
UIColour
The standard set of colours to use.
bool operator!=(const ColourScheme &) const noexcept
Returns false if two ColourPalette objects contain the same colours.
void setUIColour(UIColour colourToSet, Colour newColour) noexcept
Sets a scheme colour.
void paintButton(Graphics &g, bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override
Subclasses should override this to actually paint the button's contents.
The latest JUCE look-and-feel style, as introduced in 2017.
void drawToggleButton(Graphics &, ToggleButton &, bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override
Draws the contents of a standard ToggleButton.
void drawScrollbar(Graphics &, ScrollBar &, int x, int y, int width, int height, bool isScrollbarVertical, int thumbStartPosition, int thumbSize, bool isMouseOver, bool isMouseDown) override
Draws the thumb area of a scrollbar.
void drawProgressBar(Graphics &, ProgressBar &, int width, int height, double progress, const String &) override
Draws a progress bar.
void getIdealPopupMenuItemSize(const String &text, bool isSeparator, int standardMenuItemHeight, int &idealWidth, int &idealHeight) override
Finds the best size for an item in a popup menu.
Font getAlertWindowTitleFont() override
Override this function to supply a custom font for the alert window title.
Path getTickShape(float height) override
Returns a tick shape for use in yes/no boxes, etc.
ProgressBar::Style getDefaultProgressBarStyle(const ProgressBar &) override
Returns the default style a progress bar should use if one hasn't been set.
Font getAlertWindowMessageFont() override
Override this function to supply a custom font for the alert window message.
~LookAndFeel_V4() override
Destructor.
LookAndFeel_V4()
Creates a LookAndFeel_V4 object with a default colour scheme.
int getDefaultScrollbarWidth() override
Returns the default thickness to use for a scrollbar.
Path getCrossShape(float height) override
Returns a cross shape for use in yes/no boxes, etc.
void drawPopupMenuItem(Graphics &, const Rectangle< int > &area, bool isSeparator, bool isActive, bool isHighlighted, bool isTicked, bool hasSubMenu, const String &text, const String &shortcutKeyText, const Drawable *icon, const Colour *textColour) override
Draws one of the items in a popup menu.
bool isColourSpecified(int colourId) const noexcept
Returns true if the specified colour ID has been explicitly set using the setColour() method.
void setColour(int colourId, Colour colour) noexcept
Registers a colour to be used for a particular purpose.
Colour findColour(int colourId) const noexcept
Looks for a colour that has been registered with the given colour ID number.
A menu bar component.
Describes a type of stroke used to render a solid outline along a path.
@ curved
Indicates that corners should be drawn as rounded-off.
@ rounded
Ends of lines are rounded-off with a circular shape.
A path is a sequence of lines and curves that may either form a closed shape or be open-ended.
Definition juce_Path.h:65
void loadPathFromData(const void *data, size_t numberOfBytes)
Loads a stored path from a block of data.
void addRoundedRectangle(float x, float y, float width, float height, float cornerSize)
Adds a rectangle with rounded corners to the path.
void startNewSubPath(float startX, float startY)
Begins a new subpath with a given starting position.
void scaleToFit(float x, float y, float width, float height, bool preserveProportions) noexcept
Rescales this path to make it fit neatly into a given space.
void lineTo(float endX, float endY)
Adds a line from the shape's last position to a new end-point.
void addLineSegment(Line< float > line, float lineThickness)
Adds a line with a specified thickness.
void addQuadrilateral(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
Adds a quadrilateral to the path.
@ headerTextColourId
The colour for section header item text (see the addSectionHeader() method).
@ highlightedTextColourId
The colour to use for the text of the currently highlighted item.
@ backgroundColourId
The colour to fill the menu's background with.
@ highlightedBackgroundColourId
The colour to fill the background of the currently highlighted menu item.
@ textColourId
The colour for normal menu item text, (unless the colour is specified when the item is added).
A progress bar component.
@ backgroundColourId
The background colour, behind the bar.
@ foregroundColourId
The colour to use to draw the bar itself.
Style
The types of ProgressBar styles available.
@ linear
A linear progress bar.
@ circular
A circular progress indicator.
@ labelTextColourId
The colour for the property's label text.
@ backgroundColourId
The background colour to fill the component with.
@ onlyReduceInSize
Indicates that the source rectangle can be reduced in size if required, but should never be made larg...
@ centred
A shorthand value that is equivalent to (xMid | yMid).
Manages a rectangle and allows geometric operations to be performed on it.
ValueType getWidth() const noexcept
Returns the width of the rectangle.
Rectangle removeFromTop(ValueType amountToRemove) noexcept
Removes a strip from the top of this rectangle, reducing this rectangle by the specified amount and r...
Rectangle reduced(ValueType deltaX, ValueType deltaY) const noexcept
Returns a rectangle that is smaller than this one by a given amount.
@ backgroundColourId
A colour to use to fill the window's background.
A scrollbar component.
@ thumbColourId
A base colour to use for the thumb.
@ trackColourId
A base colour to use for the slot area of the bar.
@ backgroundColourId
The background colour of the scrollbar.
SliderStyle
The types of slider available.
Definition juce_Slider.h:62
@ LinearBarVertical
A vertical bar slider with the text label drawn on top of it.
Definition juce_Slider.h:66
@ ThreeValueHorizontal
A horizontal slider that has three thumbs instead of one, so it can show a minimum and maximum value,...
Definition juce_Slider.h:82
@ TwoValueHorizontal
A horizontal slider that has two thumbs instead of one, so it can show a minimum and maximum value.
Definition juce_Slider.h:77
@ LinearBar
A horizontal bar slider with the text label drawn on top of it.
Definition juce_Slider.h:65
@ ThreeValueVertical
A vertical slider that has three thumbs instead of one, so it can show a minimum and maximum value,...
Definition juce_Slider.h:85
@ TwoValueVertical
A vertical slider that has two thumbs instead of one, so it can show a minimum and maximum value.
Definition juce_Slider.h:79
@ textBoxBackgroundColourId
The background colour for the text-editor box.
@ textBoxTextColourId
The colour for the text in the text-editor box used for editing the value.
@ rotarySliderFillColourId
For rotary sliders, this colour fills the outer curve.
@ textBoxHighlightColourId
The text highlight colour for the text-editor box.
@ textBoxOutlineColourId
The colour to use for a border around the text-editor box.
@ trackColourId
The colour to draw the groove that the thumb moves along.
@ backgroundColourId
A colour to use to fill the slider's background.
@ rotarySliderOutlineColourId
For rotary sliders, this colour is used to draw the outer curve's outline.
@ thumbColourId
The colour to draw the thumb with.
The JUCE String class!
Definition juce_String.h:53
static String charToString(juce_wchar character)
Creates a string from a single character.
@ tabOutlineColourId
The colour to use to draw an outline around the tabs.
@ frontOutlineColourId
The colour to use to draw an outline around the currently-selected tab.
@ outlineColourId
The colour to use to draw an outline around the content.
@ backgroundColourId
The colour to fill the background behind the tabs.
@ textColourOnId
The colour to use for the button's text.when the button's toggle state is "on".
@ buttonColourId
The colour used to fill the button shape (when the button is toggled 'off').
@ buttonOnColourId
The colour used to fill the button shape (when the button is toggled 'on').
@ textColourOffId
The colour to use for the button's text when the button's toggle state is "off".
An editable text box.
@ backgroundColourId
The colour to use for the text component's background - this can be transparent if necessary.
@ highlightColourId
The colour with which to fill the background of highlighted sections of the text - this can be transp...
@ textColourId
The colour that will be used when text is added to the editor.
@ outlineColourId
If this is non-transparent, it will be used to draw a box around the edge of the component.
@ highlightedTextColourId
The colour with which to draw the text in highlighted sections.
@ focusedOutlineColourId
If this is non-transparent, it will be used to draw a box around the edge of the component when it ha...
@ shadowColourId
If this is non-transparent, it'll be used to draw an inner shadow around the edge of the editor.
@ backgroundColourId
The colour to fill the background of the text area.
@ outlineColourId
The colour to use to draw an outline around the text area.
@ textColourId
The colour to use for the editable text.
static uint32 getMillisecondCounter() noexcept
Returns the number of millisecs since a fixed event (usually system startup).
A button that can be toggled on/off.
@ tickDisabledColourId
The colour to use for the disabled tick mark and/or outline.
@ textColourId
The colour to use for the button's text.
@ tickColourId
The colour to use for the tick mark.
@ backgroundColourId
A colour to use to fill the toolbar's background.
@ customisationDialogBackgroundColourId
A colour used to paint the background of the CustomisationDialog.
@ editingModeOutlineColourId
A colour to use for an outline around buttons when the customisation dialog is active and the mouse m...
@ buttonMouseOverBackgroundColourId
A colour used to paint the background of buttons when the mouse is over them.
@ labelTextColourId
A colour to use for drawing the text under buttons when the style is set to iconsWithText or textOnly...
@ separatorColourId
A colour to use to draw the separator lines.
@ buttonMouseDownBackgroundColourId
A colour used to paint the background of buttons when the mouse is held down on them.
@ textColourId
The colour to use for the text.
@ outlineColourId
The colour to use to draw an outline around the tooltip.
@ backgroundColourId
The colour to fill the background with.
@ dragAndDropIndicatorColourId
The colour to use for the drag-and-drop target position indicator.
@ oddItemsColourId
The colour to use to fill the background of the odd numbered items.
@ linesColourId
The colour to draw the lines with.
@ evenItemsColourId
The colour to use to fill the background of the even numbered items.
@ selectedItemBackgroundColourId
The colour to use to fill the background of any selected items.
@ backgroundColourId
A background colour to fill the component with.
T cos(T... args)
T fill(T... args)
#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 ...
#define jassertfalse
This will always cause an assertion failure.
typedef int
typedef float
JUCE Namespace.
wchar_t juce_wchar
A platform-independent 32-bit unicode character type.
constexpr Type jmin(Type a, Type b)
Returns the smaller of two values.
constexpr Type jmax(Type a, Type b)
Returns the larger of two values.
MessageBoxIconType
The type of icon to show in the dialog box.
@ WarningIcon
An exclamation mark to indicate that the dialog is a warning about something and shouldn't be ignored...
@ NoIcon
No icon will be shown on the dialog box.
@ InfoIcon
An icon that indicates that the dialog box is just giving the user some information,...
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
Definition juce_Memory.h:88
bool isPositiveAndBelow(Type1 valueToTest, Type2 upperLimit) noexcept
Returns true if a value is at least zero, and also below a specified upper limit.
unsigned int uint32
A platform-independent 32-bit unsigned integer type.
constexpr FloatType degreesToRadians(FloatType degrees) noexcept
Converts an angle in degrees to radians.
unsigned char uint8
A platform-independent 8-bit unsigned integer type.
int roundToInt(const FloatType value) noexcept
Fast floating-point-to-integer conversion.
constexpr int numElementsInArray(Type(&)[N]) noexcept
Handy function for getting the number of elements in a simple const C array.
T sin(T... args)
T size(T... args)
static constexpr FloatType halfPi
A predefined value for Pi / 2.
static constexpr FloatType twoPi
A predefined value for 2 * Pi.
static constexpr FloatType pi
A predefined value for Pi.
T swap(T... args)