Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1493 lines
69KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2022 - Raw Material Software Limited
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. By using JUCE, you agree to the terms of both the JUCE 7 End-User License
  8. Agreement and JUCE Privacy Policy.
  9. End User License Agreement: www.juce.com/juce-7-licence
  10. Privacy Policy: www.juce.com/juce-privacy-policy
  11. Or: You may also use this code under the terms of the GPL v3 (see
  12. www.gnu.org/licenses).
  13. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  14. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  15. DISCLAIMED.
  16. ==============================================================================
  17. */
  18. namespace juce
  19. {
  20. Colour LookAndFeel_V4::ColourScheme::getUIColour (UIColour index) const noexcept
  21. {
  22. if (isPositiveAndBelow (index, numColours))
  23. return palette[index];
  24. jassertfalse;
  25. return {};
  26. }
  27. void LookAndFeel_V4::ColourScheme::setUIColour (UIColour index, Colour newColour) noexcept
  28. {
  29. if (isPositiveAndBelow (index, numColours))
  30. palette[index] = newColour;
  31. else
  32. jassertfalse;
  33. }
  34. bool LookAndFeel_V4::ColourScheme::operator== (const ColourScheme& other) const noexcept
  35. {
  36. for (auto i = 0; i < numColours; ++i)
  37. if (palette[i] != other.palette[i])
  38. return false;
  39. return true;
  40. }
  41. bool LookAndFeel_V4::ColourScheme::operator!= (const ColourScheme& other) const noexcept
  42. {
  43. return ! operator== (other);
  44. }
  45. //==============================================================================
  46. LookAndFeel_V4::LookAndFeel_V4() : currentColourScheme (getDarkColourScheme())
  47. {
  48. initialiseColours();
  49. }
  50. LookAndFeel_V4::LookAndFeel_V4 (ColourScheme scheme) : currentColourScheme (scheme)
  51. {
  52. initialiseColours();
  53. }
  54. LookAndFeel_V4::~LookAndFeel_V4() {}
  55. //==============================================================================
  56. void LookAndFeel_V4::setColourScheme (ColourScheme newColourScheme)
  57. {
  58. currentColourScheme = newColourScheme;
  59. initialiseColours();
  60. }
  61. LookAndFeel_V4::ColourScheme LookAndFeel_V4::getDarkColourScheme()
  62. {
  63. return { 0xff323e44, 0xff263238, 0xff323e44,
  64. 0xff8e989b, 0xffffffff, 0xff42a2c8,
  65. 0xffffffff, 0xff181f22, 0xffffffff };
  66. }
  67. LookAndFeel_V4::ColourScheme LookAndFeel_V4::getMidnightColourScheme()
  68. {
  69. return { 0xff2f2f3a, 0xff191926, 0xffd0d0d0,
  70. 0xff66667c, 0xc8ffffff, 0xffd8d8d8,
  71. 0xffffffff, 0xff606073, 0xff000000 };
  72. }
  73. LookAndFeel_V4::ColourScheme LookAndFeel_V4::getGreyColourScheme()
  74. {
  75. return { 0xff505050, 0xff424242, 0xff606060,
  76. 0xffa6a6a6, 0xffffffff, 0xff21ba90,
  77. 0xff000000, 0xffffffff, 0xffffffff };
  78. }
  79. LookAndFeel_V4::ColourScheme LookAndFeel_V4::getLightColourScheme()
  80. {
  81. return { 0xffefefef, 0xffffffff, 0xffffffff,
  82. 0xffdddddd, 0xff000000, 0xffa9a9a9,
  83. 0xffffffff, 0xff42a2c8, 0xff000000 };
  84. }
  85. //==============================================================================
  86. class LookAndFeel_V4_DocumentWindowButton : public Button
  87. {
  88. public:
  89. LookAndFeel_V4_DocumentWindowButton (const String& name, Colour c, const Path& normal, const Path& toggled)
  90. : Button (name), colour (c), normalShape (normal), toggledShape (toggled)
  91. {
  92. }
  93. void paintButton (Graphics& g, bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override
  94. {
  95. auto background = Colours::grey;
  96. if (auto* rw = findParentComponentOfClass<ResizableWindow>())
  97. if (auto lf = dynamic_cast<LookAndFeel_V4*> (&rw->getLookAndFeel()))
  98. background = lf->getCurrentColourScheme().getUIColour (LookAndFeel_V4::ColourScheme::widgetBackground);
  99. g.fillAll (background);
  100. g.setColour ((! isEnabled() || shouldDrawButtonAsDown) ? colour.withAlpha (0.6f)
  101. : colour);
  102. if (shouldDrawButtonAsHighlighted)
  103. {
  104. g.fillAll();
  105. g.setColour (background);
  106. }
  107. auto& p = getToggleState() ? toggledShape : normalShape;
  108. auto reducedRect = Justification (Justification::centred)
  109. .appliedToRectangle (Rectangle<int> (getHeight(), getHeight()), getLocalBounds())
  110. .toFloat()
  111. .reduced ((float) getHeight() * 0.3f);
  112. g.fillPath (p, p.getTransformToScaleToFit (reducedRect, true));
  113. }
  114. private:
  115. Colour colour;
  116. Path normalShape, toggledShape;
  117. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LookAndFeel_V4_DocumentWindowButton)
  118. };
  119. Button* LookAndFeel_V4::createDocumentWindowButton (int buttonType)
  120. {
  121. Path shape;
  122. auto crossThickness = 0.15f;
  123. if (buttonType == DocumentWindow::closeButton)
  124. {
  125. shape.addLineSegment ({ 0.0f, 0.0f, 1.0f, 1.0f }, crossThickness);
  126. shape.addLineSegment ({ 1.0f, 0.0f, 0.0f, 1.0f }, crossThickness);
  127. return new LookAndFeel_V4_DocumentWindowButton ("close", Colour (0xff9A131D), shape, shape);
  128. }
  129. if (buttonType == DocumentWindow::minimiseButton)
  130. {
  131. shape.addLineSegment ({ 0.0f, 0.5f, 1.0f, 0.5f }, crossThickness);
  132. return new LookAndFeel_V4_DocumentWindowButton ("minimise", Colour (0xffaa8811), shape, shape);
  133. }
  134. if (buttonType == DocumentWindow::maximiseButton)
  135. {
  136. shape.addLineSegment ({ 0.5f, 0.0f, 0.5f, 1.0f }, crossThickness);
  137. shape.addLineSegment ({ 0.0f, 0.5f, 1.0f, 0.5f }, crossThickness);
  138. Path fullscreenShape;
  139. fullscreenShape.startNewSubPath (45.0f, 100.0f);
  140. fullscreenShape.lineTo (0.0f, 100.0f);
  141. fullscreenShape.lineTo (0.0f, 0.0f);
  142. fullscreenShape.lineTo (100.0f, 0.0f);
  143. fullscreenShape.lineTo (100.0f, 45.0f);
  144. fullscreenShape.addRectangle (45.0f, 45.0f, 100.0f, 100.0f);
  145. PathStrokeType (30.0f).createStrokedPath (fullscreenShape, fullscreenShape);
  146. return new LookAndFeel_V4_DocumentWindowButton ("maximise", Colour (0xff0A830A), shape, fullscreenShape);
  147. }
  148. jassertfalse;
  149. return nullptr;
  150. }
  151. void LookAndFeel_V4::positionDocumentWindowButtons (DocumentWindow&,
  152. int titleBarX, int titleBarY,
  153. int titleBarW, int titleBarH,
  154. Button* minimiseButton,
  155. Button* maximiseButton,
  156. Button* closeButton,
  157. bool positionTitleBarButtonsOnLeft)
  158. {
  159. auto buttonW = static_cast<int> (titleBarH * 1.2);
  160. auto x = positionTitleBarButtonsOnLeft ? titleBarX
  161. : titleBarX + titleBarW - buttonW;
  162. if (closeButton != nullptr)
  163. {
  164. closeButton->setBounds (x, titleBarY, buttonW, titleBarH);
  165. x += positionTitleBarButtonsOnLeft ? buttonW : -buttonW;
  166. }
  167. if (positionTitleBarButtonsOnLeft)
  168. std::swap (minimiseButton, maximiseButton);
  169. if (maximiseButton != nullptr)
  170. {
  171. maximiseButton->setBounds (x, titleBarY, buttonW, titleBarH);
  172. x += positionTitleBarButtonsOnLeft ? buttonW : -buttonW;
  173. }
  174. if (minimiseButton != nullptr)
  175. minimiseButton->setBounds (x, titleBarY, buttonW, titleBarH);
  176. }
  177. void LookAndFeel_V4::drawDocumentWindowTitleBar (DocumentWindow& window, Graphics& g,
  178. int w, int h, int titleSpaceX, int titleSpaceW,
  179. const Image* icon, bool drawTitleTextOnLeft)
  180. {
  181. if (w * h == 0)
  182. return;
  183. auto isActive = window.isActiveWindow();
  184. g.setColour (getCurrentColourScheme().getUIColour (ColourScheme::widgetBackground));
  185. g.fillAll();
  186. Font font ((float) h * 0.65f, Font::plain);
  187. g.setFont (font);
  188. auto textW = font.getStringWidth (window.getName());
  189. auto iconW = 0;
  190. auto iconH = 0;
  191. if (icon != nullptr)
  192. {
  193. iconH = static_cast<int> (font.getHeight());
  194. iconW = icon->getWidth() * iconH / icon->getHeight() + 4;
  195. }
  196. textW = jmin (titleSpaceW, textW + iconW);
  197. auto textX = drawTitleTextOnLeft ? titleSpaceX
  198. : jmax (titleSpaceX, (w - textW) / 2);
  199. if (textX + textW > titleSpaceX + titleSpaceW)
  200. textX = titleSpaceX + titleSpaceW - textW;
  201. if (icon != nullptr)
  202. {
  203. g.setOpacity (isActive ? 1.0f : 0.6f);
  204. g.drawImageWithin (*icon, textX, (h - iconH) / 2, iconW, iconH,
  205. RectanglePlacement::centred, false);
  206. textX += iconW;
  207. textW -= iconW;
  208. }
  209. if (window.isColourSpecified (DocumentWindow::textColourId) || isColourSpecified (DocumentWindow::textColourId))
  210. g.setColour (window.findColour (DocumentWindow::textColourId));
  211. else
  212. g.setColour (getCurrentColourScheme().getUIColour (ColourScheme::defaultText));
  213. g.drawText (window.getName(), textX, 0, textW, h, Justification::centredLeft, true);
  214. }
  215. //==============================================================================
  216. Font LookAndFeel_V4::getTextButtonFont (TextButton&, int buttonHeight)
  217. {
  218. return { jmin (16.0f, (float) buttonHeight * 0.6f) };
  219. }
  220. void LookAndFeel_V4::drawButtonBackground (Graphics& g,
  221. Button& button,
  222. const Colour& backgroundColour,
  223. bool shouldDrawButtonAsHighlighted,
  224. bool shouldDrawButtonAsDown)
  225. {
  226. auto cornerSize = 6.0f;
  227. auto bounds = button.getLocalBounds().toFloat().reduced (0.5f, 0.5f);
  228. auto baseColour = backgroundColour.withMultipliedSaturation (button.hasKeyboardFocus (true) ? 1.3f : 0.9f)
  229. .withMultipliedAlpha (button.isEnabled() ? 1.0f : 0.5f);
  230. if (shouldDrawButtonAsDown || shouldDrawButtonAsHighlighted)
  231. baseColour = baseColour.contrasting (shouldDrawButtonAsDown ? 0.2f : 0.05f);
  232. g.setColour (baseColour);
  233. auto flatOnLeft = button.isConnectedOnLeft();
  234. auto flatOnRight = button.isConnectedOnRight();
  235. auto flatOnTop = button.isConnectedOnTop();
  236. auto flatOnBottom = button.isConnectedOnBottom();
  237. if (flatOnLeft || flatOnRight || flatOnTop || flatOnBottom)
  238. {
  239. Path path;
  240. path.addRoundedRectangle (bounds.getX(), bounds.getY(),
  241. bounds.getWidth(), bounds.getHeight(),
  242. cornerSize, cornerSize,
  243. ! (flatOnLeft || flatOnTop),
  244. ! (flatOnRight || flatOnTop),
  245. ! (flatOnLeft || flatOnBottom),
  246. ! (flatOnRight || flatOnBottom));
  247. g.fillPath (path);
  248. g.setColour (button.findColour (ComboBox::outlineColourId));
  249. g.strokePath (path, PathStrokeType (1.0f));
  250. }
  251. else
  252. {
  253. g.fillRoundedRectangle (bounds, cornerSize);
  254. g.setColour (button.findColour (ComboBox::outlineColourId));
  255. g.drawRoundedRectangle (bounds, cornerSize, 1.0f);
  256. }
  257. }
  258. void LookAndFeel_V4::drawToggleButton (Graphics& g, ToggleButton& button,
  259. bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown)
  260. {
  261. auto fontSize = jmin (15.0f, (float) button.getHeight() * 0.75f);
  262. auto tickWidth = fontSize * 1.1f;
  263. drawTickBox (g, button, 4.0f, ((float) button.getHeight() - tickWidth) * 0.5f,
  264. tickWidth, tickWidth,
  265. button.getToggleState(),
  266. button.isEnabled(),
  267. shouldDrawButtonAsHighlighted,
  268. shouldDrawButtonAsDown);
  269. g.setColour (button.findColour (ToggleButton::textColourId));
  270. g.setFont (fontSize);
  271. if (! button.isEnabled())
  272. g.setOpacity (0.5f);
  273. g.drawFittedText (button.getButtonText(),
  274. button.getLocalBounds().withTrimmedLeft (roundToInt (tickWidth) + 10)
  275. .withTrimmedRight (2),
  276. Justification::centredLeft, 10);
  277. }
  278. void LookAndFeel_V4::drawTickBox (Graphics& g, Component& component,
  279. float x, float y, float w, float h,
  280. const bool ticked,
  281. const bool isEnabled,
  282. const bool shouldDrawButtonAsHighlighted,
  283. const bool shouldDrawButtonAsDown)
  284. {
  285. ignoreUnused (isEnabled, shouldDrawButtonAsHighlighted, shouldDrawButtonAsDown);
  286. Rectangle<float> tickBounds (x, y, w, h);
  287. g.setColour (component.findColour (ToggleButton::tickDisabledColourId));
  288. g.drawRoundedRectangle (tickBounds, 4.0f, 1.0f);
  289. if (ticked)
  290. {
  291. g.setColour (component.findColour (ToggleButton::tickColourId));
  292. auto tick = getTickShape (0.75f);
  293. g.fillPath (tick, tick.getTransformToScaleToFit (tickBounds.reduced (4, 5).toFloat(), false));
  294. }
  295. }
  296. void LookAndFeel_V4::changeToggleButtonWidthToFitText (ToggleButton& button)
  297. {
  298. auto fontSize = jmin (15.0f, (float) button.getHeight() * 0.75f);
  299. auto tickWidth = fontSize * 1.1f;
  300. Font font (fontSize);
  301. button.setSize (font.getStringWidth (button.getButtonText()) + roundToInt (tickWidth) + 14, button.getHeight());
  302. }
  303. //==============================================================================
  304. AlertWindow* LookAndFeel_V4::createAlertWindow (const String& title, const String& message,
  305. const String& button1, const String& button2, const String& button3,
  306. MessageBoxIconType iconType,
  307. int numButtons, Component* associatedComponent)
  308. {
  309. auto boundsOffset = 50;
  310. auto* aw = LookAndFeel_V2::createAlertWindow (title, message, button1, button2, button3,
  311. iconType, numButtons, associatedComponent);
  312. auto bounds = aw->getBounds();
  313. bounds = bounds.withSizeKeepingCentre (bounds.getWidth() + boundsOffset, bounds.getHeight() + boundsOffset);
  314. aw->setBounds (bounds);
  315. for (auto* child : aw->getChildren())
  316. if (auto* button = dynamic_cast<TextButton*> (child))
  317. button->setBounds (button->getBounds() + Point<int> (25, 40));
  318. return aw;
  319. }
  320. void LookAndFeel_V4::drawAlertBox (Graphics& g, AlertWindow& alert,
  321. const Rectangle<int>& textArea, TextLayout& textLayout)
  322. {
  323. auto cornerSize = 4.0f;
  324. g.setColour (alert.findColour (AlertWindow::outlineColourId));
  325. g.drawRoundedRectangle (alert.getLocalBounds().toFloat(), cornerSize, 2.0f);
  326. auto bounds = alert.getLocalBounds().reduced (1);
  327. g.reduceClipRegion (bounds);
  328. g.setColour (alert.findColour (AlertWindow::backgroundColourId));
  329. g.fillRoundedRectangle (bounds.toFloat(), cornerSize);
  330. auto iconSpaceUsed = 0;
  331. auto iconWidth = 80;
  332. auto iconSize = jmin (iconWidth + 50, bounds.getHeight() + 20);
  333. if (alert.containsAnyExtraComponents() || alert.getNumButtons() > 2)
  334. iconSize = jmin (iconSize, textArea.getHeight() + 50);
  335. Rectangle<int> iconRect (iconSize / -10, iconSize / -10,
  336. iconSize, iconSize);
  337. if (alert.getAlertType() != MessageBoxIconType::NoIcon)
  338. {
  339. Path icon;
  340. char character;
  341. uint32 colour;
  342. if (alert.getAlertType() == MessageBoxIconType::WarningIcon)
  343. {
  344. character = '!';
  345. icon.addTriangle ((float) iconRect.getX() + (float) iconRect.getWidth() * 0.5f, (float) iconRect.getY(),
  346. static_cast<float> (iconRect.getRight()), static_cast<float> (iconRect.getBottom()),
  347. static_cast<float> (iconRect.getX()), static_cast<float> (iconRect.getBottom()));
  348. icon = icon.createPathWithRoundedCorners (5.0f);
  349. colour = 0x66ff2a00;
  350. }
  351. else
  352. {
  353. colour = Colour (0xff00b0b9).withAlpha (0.4f).getARGB();
  354. character = alert.getAlertType() == MessageBoxIconType::InfoIcon ? 'i' : '?';
  355. icon.addEllipse (iconRect.toFloat());
  356. }
  357. GlyphArrangement ga;
  358. ga.addFittedText ({ (float) iconRect.getHeight() * 0.9f, Font::bold },
  359. String::charToString ((juce_wchar) (uint8) character),
  360. static_cast<float> (iconRect.getX()), static_cast<float> (iconRect.getY()),
  361. static_cast<float> (iconRect.getWidth()), static_cast<float> (iconRect.getHeight()),
  362. Justification::centred, false);
  363. ga.createPath (icon);
  364. icon.setUsingNonZeroWinding (false);
  365. g.setColour (Colour (colour));
  366. g.fillPath (icon);
  367. iconSpaceUsed = iconWidth;
  368. }
  369. g.setColour (alert.findColour (AlertWindow::textColourId));
  370. Rectangle<int> alertBounds (bounds.getX() + iconSpaceUsed, 30,
  371. bounds.getWidth(), bounds.getHeight() - getAlertWindowButtonHeight() - 20);
  372. textLayout.draw (g, alertBounds.toFloat());
  373. }
  374. int LookAndFeel_V4::getAlertWindowButtonHeight() { return 40; }
  375. Font LookAndFeel_V4::getAlertWindowTitleFont() { return { 18.0f, Font::bold }; }
  376. Font LookAndFeel_V4::getAlertWindowMessageFont() { return { 16.0f }; }
  377. Font LookAndFeel_V4::getAlertWindowFont() { return { 14.0f }; }
  378. //==============================================================================
  379. void LookAndFeel_V4::drawProgressBar (Graphics& g, ProgressBar& progressBar,
  380. int width, int height, double progress, const String& textToShow)
  381. {
  382. if (width == height)
  383. drawCircularProgressBar (g, progressBar, textToShow);
  384. else
  385. drawLinearProgressBar (g, progressBar, width, height, progress, textToShow);
  386. }
  387. void LookAndFeel_V4::drawLinearProgressBar (Graphics& g, ProgressBar& progressBar,
  388. int width, int height,
  389. double progress, const String& textToShow)
  390. {
  391. auto background = progressBar.findColour (ProgressBar::backgroundColourId);
  392. auto foreground = progressBar.findColour (ProgressBar::foregroundColourId);
  393. auto barBounds = progressBar.getLocalBounds().toFloat();
  394. g.setColour (background);
  395. g.fillRoundedRectangle (barBounds, (float) progressBar.getHeight() * 0.5f);
  396. if (progress >= 0.0f && progress <= 1.0f)
  397. {
  398. Path p;
  399. p.addRoundedRectangle (barBounds, (float) progressBar.getHeight() * 0.5f);
  400. g.reduceClipRegion (p);
  401. barBounds.setWidth (barBounds.getWidth() * (float) progress);
  402. g.setColour (foreground);
  403. g.fillRoundedRectangle (barBounds, (float) progressBar.getHeight() * 0.5f);
  404. }
  405. else
  406. {
  407. // spinning bar..
  408. g.setColour (background);
  409. auto stripeWidth = height * 2;
  410. auto position = static_cast<int> (Time::getMillisecondCounter() / 15) % stripeWidth;
  411. Path p;
  412. for (auto x = static_cast<float> (-position); x < (float) (width + stripeWidth); x += (float) stripeWidth)
  413. p.addQuadrilateral (x, 0.0f,
  414. x + (float) stripeWidth * 0.5f, 0.0f,
  415. x, static_cast<float> (height),
  416. x - (float) stripeWidth * 0.5f, static_cast<float> (height));
  417. Image im (Image::ARGB, width, height, true);
  418. {
  419. Graphics g2 (im);
  420. g2.setColour (foreground);
  421. g2.fillRoundedRectangle (barBounds, (float) progressBar.getHeight() * 0.5f);
  422. }
  423. g.setTiledImageFill (im, 0, 0, 0.85f);
  424. g.fillPath (p);
  425. }
  426. if (textToShow.isNotEmpty())
  427. {
  428. g.setColour (Colour::contrasting (background, foreground));
  429. g.setFont ((float) height * 0.6f);
  430. g.drawText (textToShow, 0, 0, width, height, Justification::centred, false);
  431. }
  432. }
  433. void LookAndFeel_V4::drawCircularProgressBar (Graphics& g, ProgressBar& progressBar, const String& progressText)
  434. {
  435. auto background = progressBar.findColour (ProgressBar::backgroundColourId);
  436. auto foreground = progressBar.findColour (ProgressBar::foregroundColourId);
  437. auto barBounds = progressBar.getLocalBounds().reduced (2, 2).toFloat();
  438. auto rotationInDegrees = static_cast<float> ((Time::getMillisecondCounter() / 10) % 360);
  439. auto normalisedRotation = rotationInDegrees / 360.0f;
  440. auto rotationOffset = 22.5f;
  441. auto maxRotation = 315.0f;
  442. auto startInDegrees = rotationInDegrees;
  443. auto endInDegrees = startInDegrees + rotationOffset;
  444. if (normalisedRotation >= 0.25f && normalisedRotation < 0.5f)
  445. {
  446. auto rescaledRotation = (normalisedRotation * 4.0f) - 1.0f;
  447. endInDegrees = startInDegrees + rotationOffset + (maxRotation * rescaledRotation);
  448. }
  449. else if (normalisedRotation >= 0.5f && normalisedRotation <= 1.0f)
  450. {
  451. endInDegrees = startInDegrees + rotationOffset + maxRotation;
  452. auto rescaledRotation = 1.0f - ((normalisedRotation * 2.0f) - 1.0f);
  453. startInDegrees = endInDegrees - rotationOffset - (maxRotation * rescaledRotation);
  454. }
  455. g.setColour (background);
  456. Path arcPath2;
  457. arcPath2.addCentredArc (barBounds.getCentreX(),
  458. barBounds.getCentreY(),
  459. barBounds.getWidth() * 0.5f,
  460. barBounds.getHeight() * 0.5f, 0.0f,
  461. 0.0f,
  462. MathConstants<float>::twoPi,
  463. true);
  464. g.strokePath (arcPath2, PathStrokeType (4.0f));
  465. g.setColour (foreground);
  466. Path arcPath;
  467. arcPath.addCentredArc (barBounds.getCentreX(),
  468. barBounds.getCentreY(),
  469. barBounds.getWidth() * 0.5f,
  470. barBounds.getHeight() * 0.5f,
  471. 0.0f,
  472. degreesToRadians (startInDegrees),
  473. degreesToRadians (endInDegrees),
  474. true);
  475. arcPath.applyTransform (AffineTransform::rotation (normalisedRotation * MathConstants<float>::pi * 2.25f, barBounds.getCentreX(), barBounds.getCentreY()));
  476. g.strokePath (arcPath, PathStrokeType (4.0f));
  477. if (progressText.isNotEmpty())
  478. {
  479. g.setColour (progressBar.findColour (TextButton::textColourOffId));
  480. g.setFont ({ 12.0f, Font::italic });
  481. g.drawText (progressText, barBounds, Justification::centred, false);
  482. }
  483. }
  484. //==============================================================================
  485. int LookAndFeel_V4::getDefaultScrollbarWidth()
  486. {
  487. return 8;
  488. }
  489. void LookAndFeel_V4::drawScrollbar (Graphics& g, ScrollBar& scrollbar, int x, int y, int width, int height,
  490. bool isScrollbarVertical, int thumbStartPosition, int thumbSize, bool isMouseOver, bool isMouseDown)
  491. {
  492. ignoreUnused (isMouseDown);
  493. Rectangle<int> thumbBounds;
  494. if (isScrollbarVertical)
  495. thumbBounds = { x, thumbStartPosition, width, thumbSize };
  496. else
  497. thumbBounds = { thumbStartPosition, y, thumbSize, height };
  498. auto c = scrollbar.findColour (ScrollBar::ColourIds::thumbColourId);
  499. g.setColour (isMouseOver ? c.brighter (0.25f) : c);
  500. g.fillRoundedRectangle (thumbBounds.reduced (1).toFloat(), 4.0f);
  501. }
  502. //==============================================================================
  503. Path LookAndFeel_V4::getTickShape (float height)
  504. {
  505. 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,
  506. 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 };
  507. Path path;
  508. path.loadPathFromData (pathData, sizeof (pathData));
  509. path.scaleToFit (0, 0, height * 2.0f, height, true);
  510. return path;
  511. }
  512. Path LookAndFeel_V4::getCrossShape (float height)
  513. {
  514. 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,
  515. 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,
  516. 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 };
  517. Path path;
  518. path.loadPathFromData (pathData, sizeof (pathData));
  519. path.scaleToFit (0, 0, height * 2.0f, height, true);
  520. return path;
  521. }
  522. //==============================================================================
  523. void LookAndFeel_V4::fillTextEditorBackground (Graphics& g, int width, int height, TextEditor& textEditor)
  524. {
  525. if (dynamic_cast<AlertWindow*> (textEditor.getParentComponent()) != nullptr)
  526. {
  527. g.setColour (textEditor.findColour (TextEditor::backgroundColourId));
  528. g.fillRect (0, 0, width, height);
  529. g.setColour (textEditor.findColour (TextEditor::outlineColourId));
  530. g.drawHorizontalLine (height - 1, 0.0f, static_cast<float> (width));
  531. }
  532. else
  533. {
  534. LookAndFeel_V2::fillTextEditorBackground (g, width, height, textEditor);
  535. }
  536. }
  537. void LookAndFeel_V4::drawTextEditorOutline (Graphics& g, int width, int height, TextEditor& textEditor)
  538. {
  539. if (dynamic_cast<AlertWindow*> (textEditor.getParentComponent()) == nullptr)
  540. {
  541. if (textEditor.isEnabled())
  542. {
  543. if (textEditor.hasKeyboardFocus (true) && ! textEditor.isReadOnly())
  544. {
  545. g.setColour (textEditor.findColour (TextEditor::focusedOutlineColourId));
  546. g.drawRect (0, 0, width, height, 2);
  547. }
  548. else
  549. {
  550. g.setColour (textEditor.findColour (TextEditor::outlineColourId));
  551. g.drawRect (0, 0, width, height);
  552. }
  553. }
  554. }
  555. }
  556. //==============================================================================
  557. Button* LookAndFeel_V4::createFileBrowserGoUpButton()
  558. {
  559. auto* goUpButton = new DrawableButton ("up", DrawableButton::ImageOnButtonBackground);
  560. Path arrowPath;
  561. arrowPath.addArrow ({ 50.0f, 100.0f, 50.0f, 0.0f }, 40.0f, 100.0f, 50.0f);
  562. DrawablePath arrowImage;
  563. arrowImage.setFill (goUpButton->findColour (TextButton::textColourOffId));
  564. arrowImage.setPath (arrowPath);
  565. goUpButton->setImages (&arrowImage);
  566. return goUpButton;
  567. }
  568. void LookAndFeel_V4::layoutFileBrowserComponent (FileBrowserComponent& browserComp,
  569. DirectoryContentsDisplayComponent* fileListComponent,
  570. FilePreviewComponent* previewComp,
  571. ComboBox* currentPathBox,
  572. TextEditor* filenameBox,
  573. Button* goUpButton)
  574. {
  575. auto sectionHeight = 22;
  576. auto buttonWidth = 50;
  577. auto b = browserComp.getLocalBounds().reduced (20, 5);
  578. auto topSlice = b.removeFromTop (sectionHeight);
  579. auto bottomSlice = b.removeFromBottom (sectionHeight);
  580. currentPathBox->setBounds (topSlice.removeFromLeft (topSlice.getWidth() - buttonWidth));
  581. topSlice.removeFromLeft (6);
  582. goUpButton->setBounds (topSlice);
  583. bottomSlice.removeFromLeft (20);
  584. filenameBox->setBounds (bottomSlice);
  585. if (previewComp != nullptr)
  586. previewComp->setBounds (b.removeFromRight (b.getWidth() / 3));
  587. if (auto* listAsComp = dynamic_cast<Component*> (fileListComponent))
  588. listAsComp->setBounds (b.reduced (0, 10));
  589. }
  590. void LookAndFeel_V4::drawFileBrowserRow (Graphics& g, int width, int height,
  591. const File& file, const String& filename, Image* icon,
  592. const String& fileSizeDescription,
  593. const String& fileTimeDescription,
  594. bool isDirectory, bool isItemSelected,
  595. int itemIndex, DirectoryContentsDisplayComponent& dcc)
  596. {
  597. LookAndFeel_V2::drawFileBrowserRow (g, width, height, file, filename, icon,
  598. fileSizeDescription, fileTimeDescription,
  599. isDirectory, isItemSelected, itemIndex, dcc);
  600. }
  601. //==============================================================================
  602. void LookAndFeel_V4::drawPopupMenuItem (Graphics& g, const Rectangle<int>& area,
  603. const bool isSeparator, const bool isActive,
  604. const bool isHighlighted, const bool isTicked,
  605. const bool hasSubMenu, const String& text,
  606. const String& shortcutKeyText,
  607. const Drawable* icon, const Colour* const textColourToUse)
  608. {
  609. if (isSeparator)
  610. {
  611. auto r = area.reduced (5, 0);
  612. r.removeFromTop (roundToInt (((float) r.getHeight() * 0.5f) - 0.5f));
  613. g.setColour (findColour (PopupMenu::textColourId).withAlpha (0.3f));
  614. g.fillRect (r.removeFromTop (1));
  615. }
  616. else
  617. {
  618. auto textColour = (textColourToUse == nullptr ? findColour (PopupMenu::textColourId)
  619. : *textColourToUse);
  620. auto r = area.reduced (1);
  621. if (isHighlighted && isActive)
  622. {
  623. g.setColour (findColour (PopupMenu::highlightedBackgroundColourId));
  624. g.fillRect (r);
  625. g.setColour (findColour (PopupMenu::highlightedTextColourId));
  626. }
  627. else
  628. {
  629. g.setColour (textColour.withMultipliedAlpha (isActive ? 1.0f : 0.5f));
  630. }
  631. r.reduce (jmin (5, area.getWidth() / 20), 0);
  632. auto font = getPopupMenuFont();
  633. auto maxFontHeight = (float) r.getHeight() / 1.3f;
  634. if (font.getHeight() > maxFontHeight)
  635. font.setHeight (maxFontHeight);
  636. g.setFont (font);
  637. auto iconArea = r.removeFromLeft (roundToInt (maxFontHeight)).toFloat();
  638. if (icon != nullptr)
  639. {
  640. icon->drawWithin (g, iconArea, RectanglePlacement::centred | RectanglePlacement::onlyReduceInSize, 1.0f);
  641. r.removeFromLeft (roundToInt (maxFontHeight * 0.5f));
  642. }
  643. else if (isTicked)
  644. {
  645. auto tick = getTickShape (1.0f);
  646. g.fillPath (tick, tick.getTransformToScaleToFit (iconArea.reduced (iconArea.getWidth() / 5, 0).toFloat(), true));
  647. }
  648. if (hasSubMenu)
  649. {
  650. auto arrowH = 0.6f * getPopupMenuFont().getAscent();
  651. auto x = static_cast<float> (r.removeFromRight ((int) arrowH).getX());
  652. auto halfH = static_cast<float> (r.getCentreY());
  653. Path path;
  654. path.startNewSubPath (x, halfH - arrowH * 0.5f);
  655. path.lineTo (x + arrowH * 0.6f, halfH);
  656. path.lineTo (x, halfH + arrowH * 0.5f);
  657. g.strokePath (path, PathStrokeType (2.0f));
  658. }
  659. r.removeFromRight (3);
  660. g.drawFittedText (text, r, Justification::centredLeft, 1);
  661. if (shortcutKeyText.isNotEmpty())
  662. {
  663. auto f2 = font;
  664. f2.setHeight (f2.getHeight() * 0.75f);
  665. f2.setHorizontalScale (0.95f);
  666. g.setFont (f2);
  667. g.drawText (shortcutKeyText, r, Justification::centredRight, true);
  668. }
  669. }
  670. }
  671. void LookAndFeel_V4::getIdealPopupMenuItemSize (const String& text, const bool isSeparator,
  672. int standardMenuItemHeight, int& idealWidth, int& idealHeight)
  673. {
  674. if (isSeparator)
  675. {
  676. idealWidth = 50;
  677. idealHeight = standardMenuItemHeight > 0 ? standardMenuItemHeight / 10 : 10;
  678. }
  679. else
  680. {
  681. auto font = getPopupMenuFont();
  682. if (standardMenuItemHeight > 0 && font.getHeight() > (float) standardMenuItemHeight / 1.3f)
  683. font.setHeight ((float) standardMenuItemHeight / 1.3f);
  684. idealHeight = standardMenuItemHeight > 0 ? standardMenuItemHeight : roundToInt (font.getHeight() * 1.3f);
  685. idealWidth = font.getStringWidth (text) + idealHeight * 2;
  686. }
  687. }
  688. void LookAndFeel_V4::drawMenuBarBackground (Graphics& g, int width, int height,
  689. bool, MenuBarComponent& menuBar)
  690. {
  691. auto colour = menuBar.findColour (TextButton::buttonColourId).withAlpha (0.4f);
  692. Rectangle<int> r (width, height);
  693. g.setColour (colour.contrasting (0.15f));
  694. g.fillRect (r.removeFromTop (1));
  695. g.fillRect (r.removeFromBottom (1));
  696. g.setGradientFill (ColourGradient::vertical (colour, 0, colour.darker (0.2f), (float) height));
  697. g.fillRect (r);
  698. }
  699. void LookAndFeel_V4::drawMenuBarItem (Graphics& g, int width, int height,
  700. int itemIndex, const String& itemText,
  701. bool isMouseOverItem, bool isMenuOpen,
  702. bool /*isMouseOverBar*/, MenuBarComponent& menuBar)
  703. {
  704. if (! menuBar.isEnabled())
  705. {
  706. g.setColour (menuBar.findColour (TextButton::textColourOffId)
  707. .withMultipliedAlpha (0.5f));
  708. }
  709. else if (isMenuOpen || isMouseOverItem)
  710. {
  711. g.fillAll (menuBar.findColour (TextButton::buttonOnColourId));
  712. g.setColour (menuBar.findColour (TextButton::textColourOnId));
  713. }
  714. else
  715. {
  716. g.setColour (menuBar.findColour (TextButton::textColourOffId));
  717. }
  718. g.setFont (getMenuBarFont (menuBar, itemIndex, itemText));
  719. g.drawFittedText (itemText, 0, 0, width, height, Justification::centred, 1);
  720. }
  721. //==============================================================================
  722. void LookAndFeel_V4::drawComboBox (Graphics& g, int width, int height, bool,
  723. int, int, int, int, ComboBox& box)
  724. {
  725. auto cornerSize = box.findParentComponentOfClass<ChoicePropertyComponent>() != nullptr ? 0.0f : 3.0f;
  726. Rectangle<int> boxBounds (0, 0, width, height);
  727. g.setColour (box.findColour (ComboBox::backgroundColourId));
  728. g.fillRoundedRectangle (boxBounds.toFloat(), cornerSize);
  729. g.setColour (box.findColour (ComboBox::outlineColourId));
  730. g.drawRoundedRectangle (boxBounds.toFloat().reduced (0.5f, 0.5f), cornerSize, 1.0f);
  731. Rectangle<int> arrowZone (width - 30, 0, 20, height);
  732. Path path;
  733. path.startNewSubPath ((float) arrowZone.getX() + 3.0f, (float) arrowZone.getCentreY() - 2.0f);
  734. path.lineTo ((float) arrowZone.getCentreX(), (float) arrowZone.getCentreY() + 3.0f);
  735. path.lineTo ((float) arrowZone.getRight() - 3.0f, (float) arrowZone.getCentreY() - 2.0f);
  736. g.setColour (box.findColour (ComboBox::arrowColourId).withAlpha ((box.isEnabled() ? 0.9f : 0.2f)));
  737. g.strokePath (path, PathStrokeType (2.0f));
  738. }
  739. Font LookAndFeel_V4::getComboBoxFont (ComboBox& box)
  740. {
  741. return { jmin (16.0f, (float) box.getHeight() * 0.85f) };
  742. }
  743. void LookAndFeel_V4::positionComboBoxText (ComboBox& box, Label& label)
  744. {
  745. label.setBounds (1, 1,
  746. box.getWidth() - 30,
  747. box.getHeight() - 2);
  748. label.setFont (getComboBoxFont (box));
  749. }
  750. //==============================================================================
  751. int LookAndFeel_V4::getSliderThumbRadius (Slider& slider)
  752. {
  753. return jmin (12, slider.isHorizontal() ? static_cast<int> ((float) slider.getHeight() * 0.5f)
  754. : static_cast<int> ((float) slider.getWidth() * 0.5f));
  755. }
  756. void LookAndFeel_V4::drawLinearSlider (Graphics& g, int x, int y, int width, int height,
  757. float sliderPos,
  758. float minSliderPos,
  759. float maxSliderPos,
  760. const Slider::SliderStyle style, Slider& slider)
  761. {
  762. if (slider.isBar())
  763. {
  764. g.setColour (slider.findColour (Slider::trackColourId));
  765. g.fillRect (slider.isHorizontal() ? Rectangle<float> (static_cast<float> (x), (float) y + 0.5f, sliderPos - (float) x, (float) height - 1.0f)
  766. : Rectangle<float> ((float) x + 0.5f, sliderPos, (float) width - 1.0f, (float) y + ((float) height - sliderPos)));
  767. }
  768. else
  769. {
  770. auto isTwoVal = (style == Slider::SliderStyle::TwoValueVertical || style == Slider::SliderStyle::TwoValueHorizontal);
  771. auto isThreeVal = (style == Slider::SliderStyle::ThreeValueVertical || style == Slider::SliderStyle::ThreeValueHorizontal);
  772. auto trackWidth = jmin (6.0f, slider.isHorizontal() ? (float) height * 0.25f : (float) width * 0.25f);
  773. Point<float> startPoint (slider.isHorizontal() ? (float) x : (float) x + (float) width * 0.5f,
  774. slider.isHorizontal() ? (float) y + (float) height * 0.5f : (float) (height + y));
  775. Point<float> endPoint (slider.isHorizontal() ? (float) (width + x) : startPoint.x,
  776. slider.isHorizontal() ? startPoint.y : (float) y);
  777. Path backgroundTrack;
  778. backgroundTrack.startNewSubPath (startPoint);
  779. backgroundTrack.lineTo (endPoint);
  780. g.setColour (slider.findColour (Slider::backgroundColourId));
  781. g.strokePath (backgroundTrack, { trackWidth, PathStrokeType::curved, PathStrokeType::rounded });
  782. Path valueTrack;
  783. Point<float> minPoint, maxPoint, thumbPoint;
  784. if (isTwoVal || isThreeVal)
  785. {
  786. minPoint = { slider.isHorizontal() ? minSliderPos : (float) width * 0.5f,
  787. slider.isHorizontal() ? (float) height * 0.5f : minSliderPos };
  788. if (isThreeVal)
  789. thumbPoint = { slider.isHorizontal() ? sliderPos : (float) width * 0.5f,
  790. slider.isHorizontal() ? (float) height * 0.5f : sliderPos };
  791. maxPoint = { slider.isHorizontal() ? maxSliderPos : (float) width * 0.5f,
  792. slider.isHorizontal() ? (float) height * 0.5f : maxSliderPos };
  793. }
  794. else
  795. {
  796. auto kx = slider.isHorizontal() ? sliderPos : ((float) x + (float) width * 0.5f);
  797. auto ky = slider.isHorizontal() ? ((float) y + (float) height * 0.5f) : sliderPos;
  798. minPoint = startPoint;
  799. maxPoint = { kx, ky };
  800. }
  801. auto thumbWidth = getSliderThumbRadius (slider);
  802. valueTrack.startNewSubPath (minPoint);
  803. valueTrack.lineTo (isThreeVal ? thumbPoint : maxPoint);
  804. g.setColour (slider.findColour (Slider::trackColourId));
  805. g.strokePath (valueTrack, { trackWidth, PathStrokeType::curved, PathStrokeType::rounded });
  806. if (! isTwoVal)
  807. {
  808. g.setColour (slider.findColour (Slider::thumbColourId));
  809. g.fillEllipse (Rectangle<float> (static_cast<float> (thumbWidth), static_cast<float> (thumbWidth)).withCentre (isThreeVal ? thumbPoint : maxPoint));
  810. }
  811. if (isTwoVal || isThreeVal)
  812. {
  813. auto sr = jmin (trackWidth, (slider.isHorizontal() ? (float) height : (float) width) * 0.4f);
  814. auto pointerColour = slider.findColour (Slider::thumbColourId);
  815. if (slider.isHorizontal())
  816. {
  817. drawPointer (g, minSliderPos - sr,
  818. jmax (0.0f, (float) y + (float) height * 0.5f - trackWidth * 2.0f),
  819. trackWidth * 2.0f, pointerColour, 2);
  820. drawPointer (g, maxSliderPos - trackWidth,
  821. jmin ((float) (y + height) - trackWidth * 2.0f, (float) y + (float) height * 0.5f),
  822. trackWidth * 2.0f, pointerColour, 4);
  823. }
  824. else
  825. {
  826. drawPointer (g, jmax (0.0f, (float) x + (float) width * 0.5f - trackWidth * 2.0f),
  827. minSliderPos - trackWidth,
  828. trackWidth * 2.0f, pointerColour, 1);
  829. drawPointer (g, jmin ((float) (x + width) - trackWidth * 2.0f, (float) x + (float) width * 0.5f), maxSliderPos - sr,
  830. trackWidth * 2.0f, pointerColour, 3);
  831. }
  832. }
  833. }
  834. }
  835. void LookAndFeel_V4::drawRotarySlider (Graphics& g, int x, int y, int width, int height, float sliderPos,
  836. const float rotaryStartAngle, const float rotaryEndAngle, Slider& slider)
  837. {
  838. auto outline = slider.findColour (Slider::rotarySliderOutlineColourId);
  839. auto fill = slider.findColour (Slider::rotarySliderFillColourId);
  840. auto bounds = Rectangle<int> (x, y, width, height).toFloat().reduced (10);
  841. auto radius = jmin (bounds.getWidth(), bounds.getHeight()) / 2.0f;
  842. auto toAngle = rotaryStartAngle + sliderPos * (rotaryEndAngle - rotaryStartAngle);
  843. auto lineW = jmin (8.0f, radius * 0.5f);
  844. auto arcRadius = radius - lineW * 0.5f;
  845. Path backgroundArc;
  846. backgroundArc.addCentredArc (bounds.getCentreX(),
  847. bounds.getCentreY(),
  848. arcRadius,
  849. arcRadius,
  850. 0.0f,
  851. rotaryStartAngle,
  852. rotaryEndAngle,
  853. true);
  854. g.setColour (outline);
  855. g.strokePath (backgroundArc, PathStrokeType (lineW, PathStrokeType::curved, PathStrokeType::rounded));
  856. if (slider.isEnabled())
  857. {
  858. Path valueArc;
  859. valueArc.addCentredArc (bounds.getCentreX(),
  860. bounds.getCentreY(),
  861. arcRadius,
  862. arcRadius,
  863. 0.0f,
  864. rotaryStartAngle,
  865. toAngle,
  866. true);
  867. g.setColour (fill);
  868. g.strokePath (valueArc, PathStrokeType (lineW, PathStrokeType::curved, PathStrokeType::rounded));
  869. }
  870. auto thumbWidth = lineW * 2.0f;
  871. Point<float> thumbPoint (bounds.getCentreX() + arcRadius * std::cos (toAngle - MathConstants<float>::halfPi),
  872. bounds.getCentreY() + arcRadius * std::sin (toAngle - MathConstants<float>::halfPi));
  873. g.setColour (slider.findColour (Slider::thumbColourId));
  874. g.fillEllipse (Rectangle<float> (thumbWidth, thumbWidth).withCentre (thumbPoint));
  875. }
  876. void LookAndFeel_V4::drawPointer (Graphics& g, const float x, const float y, const float diameter,
  877. const Colour& colour, const int direction) noexcept
  878. {
  879. Path p;
  880. p.startNewSubPath (x + diameter * 0.5f, y);
  881. p.lineTo (x + diameter, y + diameter * 0.6f);
  882. p.lineTo (x + diameter, y + diameter);
  883. p.lineTo (x, y + diameter);
  884. p.lineTo (x, y + diameter * 0.6f);
  885. p.closeSubPath();
  886. p.applyTransform (AffineTransform::rotation ((float) direction * MathConstants<float>::halfPi,
  887. x + diameter * 0.5f, y + diameter * 0.5f));
  888. g.setColour (colour);
  889. g.fillPath (p);
  890. }
  891. Label* LookAndFeel_V4::createSliderTextBox (Slider& slider)
  892. {
  893. auto* l = LookAndFeel_V2::createSliderTextBox (slider);
  894. if (getCurrentColourScheme() == LookAndFeel_V4::getGreyColourScheme() && (slider.getSliderStyle() == Slider::LinearBar
  895. || slider.getSliderStyle() == Slider::LinearBarVertical))
  896. {
  897. l->setColour (Label::textColourId, Colours::black.withAlpha (0.7f));
  898. }
  899. return l;
  900. }
  901. //==============================================================================
  902. void LookAndFeel_V4::drawTooltip (Graphics& g, const String& text, int width, int height)
  903. {
  904. Rectangle<int> bounds (width, height);
  905. auto cornerSize = 5.0f;
  906. g.setColour (findColour (TooltipWindow::backgroundColourId));
  907. g.fillRoundedRectangle (bounds.toFloat(), cornerSize);
  908. g.setColour (findColour (TooltipWindow::outlineColourId));
  909. g.drawRoundedRectangle (bounds.toFloat().reduced (0.5f, 0.5f), cornerSize, 1.0f);
  910. LookAndFeelHelpers::layoutTooltipText (text, findColour (TooltipWindow::textColourId))
  911. .draw (g, { static_cast<float> (width), static_cast<float> (height) });
  912. }
  913. //==============================================================================
  914. void LookAndFeel_V4::drawConcertinaPanelHeader (Graphics& g, const Rectangle<int>& area,
  915. bool isMouseOver, bool /*isMouseDown*/,
  916. ConcertinaPanel& concertina, Component& panel)
  917. {
  918. auto bounds = area.toFloat().reduced (0.5f);
  919. auto cornerSize = 4.0f;
  920. auto isTopPanel = (concertina.getPanel (0) == &panel);
  921. Path p;
  922. p.addRoundedRectangle (bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight(),
  923. cornerSize, cornerSize, isTopPanel, isTopPanel, false, false);
  924. g.setGradientFill (ColourGradient::vertical (Colours::white.withAlpha (isMouseOver ? 0.4f : 0.2f), static_cast<float> (area.getY()),
  925. Colours::darkgrey.withAlpha (0.1f), static_cast<float> (area.getBottom())));
  926. g.fillPath (p);
  927. }
  928. //==============================================================================
  929. void LookAndFeel_V4::drawLevelMeter (Graphics& g, int width, int height, float level)
  930. {
  931. auto outerCornerSize = 3.0f;
  932. auto outerBorderWidth = 2.0f;
  933. auto totalBlocks = 7;
  934. auto spacingFraction = 0.03f;
  935. g.setColour (findColour (ResizableWindow::backgroundColourId));
  936. g.fillRoundedRectangle (0.0f, 0.0f, static_cast<float> (width), static_cast<float> (height), outerCornerSize);
  937. auto doubleOuterBorderWidth = 2.0f * outerBorderWidth;
  938. auto numBlocks = roundToInt ((float) totalBlocks * level);
  939. auto blockWidth = ((float) width - doubleOuterBorderWidth) / static_cast<float> (totalBlocks);
  940. auto blockHeight = (float) height - doubleOuterBorderWidth;
  941. auto blockRectWidth = (1.0f - 2.0f * spacingFraction) * blockWidth;
  942. auto blockRectSpacing = spacingFraction * blockWidth;
  943. auto blockCornerSize = 0.1f * blockWidth;
  944. auto c = findColour (Slider::thumbColourId);
  945. for (auto i = 0; i < totalBlocks; ++i)
  946. {
  947. if (i >= numBlocks)
  948. g.setColour (c.withAlpha (0.5f));
  949. else
  950. g.setColour (i < totalBlocks - 1 ? c : Colours::red);
  951. g.fillRoundedRectangle (outerBorderWidth + ((float) i * blockWidth) + blockRectSpacing,
  952. outerBorderWidth,
  953. blockRectWidth,
  954. blockHeight,
  955. blockCornerSize);
  956. }
  957. }
  958. //==============================================================================
  959. void LookAndFeel_V4::paintToolbarBackground (Graphics& g, int w, int h, Toolbar& toolbar)
  960. {
  961. auto background = toolbar.findColour (Toolbar::backgroundColourId);
  962. g.setGradientFill ({ background, 0.0f, 0.0f,
  963. background.darker (0.2f),
  964. toolbar.isVertical() ? (float) w - 1.0f : 0.0f,
  965. toolbar.isVertical() ? 0.0f : (float) h - 1.0f,
  966. false });
  967. g.fillAll();
  968. }
  969. void LookAndFeel_V4::paintToolbarButtonLabel (Graphics& g, int x, int y, int width, int height,
  970. const String& text, ToolbarItemComponent& component)
  971. {
  972. auto baseTextColour = component.findParentComponentOfClass<PopupMenu::CustomComponent>() != nullptr
  973. ? component.findColour (PopupMenu::textColourId)
  974. : component.findColour (Toolbar::labelTextColourId);
  975. g.setColour (baseTextColour.withAlpha (component.isEnabled() ? 1.0f : 0.25f));
  976. auto fontHeight = jmin (14.0f, (float) height * 0.85f);
  977. g.setFont (fontHeight);
  978. g.drawFittedText (text,
  979. x, y, width, height,
  980. Justification::centred,
  981. jmax (1, height / (int) fontHeight));
  982. }
  983. //==============================================================================
  984. void LookAndFeel_V4::drawPropertyPanelSectionHeader (Graphics& g, const String& name,
  985. bool isOpen, int width, int height)
  986. {
  987. auto buttonSize = (float) height * 0.75f;
  988. auto buttonIndent = ((float) height - buttonSize) * 0.5f;
  989. drawTreeviewPlusMinusBox (g, { buttonIndent, buttonIndent, buttonSize, buttonSize },
  990. findColour (ResizableWindow::backgroundColourId), isOpen, false);
  991. auto textX = static_cast<int> ((buttonIndent * 2.0f + buttonSize + 2.0f));
  992. g.setColour (findColour (PropertyComponent::labelTextColourId));
  993. g.setFont ({ (float) height * 0.7f, Font::bold });
  994. g.drawText (name, textX, 0, width - textX - 4, height, Justification::centredLeft, true);
  995. }
  996. void LookAndFeel_V4::drawPropertyComponentBackground (Graphics& g, int width, int height, PropertyComponent& component)
  997. {
  998. g.setColour (component.findColour (PropertyComponent::backgroundColourId));
  999. g.fillRect (0, 0, width, height - 1);
  1000. }
  1001. void LookAndFeel_V4::drawPropertyComponentLabel (Graphics& g, int width, int height, PropertyComponent& component)
  1002. {
  1003. ignoreUnused (width);
  1004. auto indent = getPropertyComponentIndent (component);
  1005. g.setColour (component.findColour (PropertyComponent::labelTextColourId)
  1006. .withMultipliedAlpha (component.isEnabled() ? 1.0f : 0.6f));
  1007. g.setFont ((float) jmin (height, 24) * 0.65f);
  1008. auto r = getPropertyComponentContentPosition (component);
  1009. g.drawFittedText (component.getName(),
  1010. indent, r.getY(), r.getX() - 5, r.getHeight(),
  1011. Justification::centredLeft, 2);
  1012. }
  1013. int LookAndFeel_V4::getPropertyComponentIndent (PropertyComponent& component)
  1014. {
  1015. return jmin (10, component.getWidth() / 10);
  1016. }
  1017. Rectangle<int> LookAndFeel_V4::getPropertyComponentContentPosition (PropertyComponent& component)
  1018. {
  1019. auto textW = jmin (200, component.getWidth() / 2);
  1020. return { textW, 0, component.getWidth() - textW, component.getHeight() - 1 };
  1021. }
  1022. //==============================================================================
  1023. void LookAndFeel_V4::drawCallOutBoxBackground (CallOutBox& box, Graphics& g,
  1024. const Path& path, Image& cachedImage)
  1025. {
  1026. if (cachedImage.isNull())
  1027. {
  1028. cachedImage = { Image::ARGB, box.getWidth(), box.getHeight(), true };
  1029. Graphics g2 (cachedImage);
  1030. DropShadow (Colours::black.withAlpha (0.7f), 8, { 0, 2 }).drawForPath (g2, path);
  1031. }
  1032. g.setColour (Colours::black);
  1033. g.drawImageAt (cachedImage, 0, 0);
  1034. g.setColour (currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).withAlpha (0.8f));
  1035. g.fillPath (path);
  1036. g.setColour (currentColourScheme.getUIColour (ColourScheme::UIColour::outline).withAlpha (0.8f));
  1037. g.strokePath (path, PathStrokeType (2.0f));
  1038. }
  1039. //==============================================================================
  1040. void LookAndFeel_V4::drawStretchableLayoutResizerBar (Graphics& g, int /*w*/, int /*h*/, bool /*isVerticalBar*/,
  1041. bool isMouseOver, bool isMouseDragging)
  1042. {
  1043. if (isMouseOver || isMouseDragging)
  1044. g.fillAll (currentColourScheme.getUIColour (ColourScheme::UIColour::defaultFill).withAlpha (0.5f));
  1045. }
  1046. //==============================================================================
  1047. void LookAndFeel_V4::initialiseColours()
  1048. {
  1049. const uint32 transparent = 0x00000000;
  1050. const uint32 coloursToUse[] =
  1051. {
  1052. TextButton::buttonColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
  1053. TextButton::buttonOnColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::highlightedFill).getARGB(),
  1054. TextButton::textColourOnId, currentColourScheme.getUIColour (ColourScheme::UIColour::highlightedText).getARGB(),
  1055. TextButton::textColourOffId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
  1056. ToggleButton::textColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
  1057. ToggleButton::tickColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
  1058. ToggleButton::tickDisabledColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).withAlpha (0.5f).getARGB(),
  1059. TextEditor::backgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
  1060. TextEditor::textColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
  1061. TextEditor::highlightColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultFill).withAlpha (0.4f).getARGB(),
  1062. TextEditor::highlightedTextColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::highlightedText).getARGB(),
  1063. TextEditor::outlineColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
  1064. TextEditor::focusedOutlineColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
  1065. TextEditor::shadowColourId, transparent,
  1066. CaretComponent::caretColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultFill).getARGB(),
  1067. Label::backgroundColourId, transparent,
  1068. Label::textColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
  1069. Label::outlineColourId, transparent,
  1070. Label::textWhenEditingColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
  1071. ScrollBar::backgroundColourId, transparent,
  1072. ScrollBar::thumbColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultFill).getARGB(),
  1073. ScrollBar::trackColourId, transparent,
  1074. TreeView::linesColourId, transparent,
  1075. TreeView::backgroundColourId, transparent,
  1076. TreeView::dragAndDropIndicatorColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
  1077. TreeView::selectedItemBackgroundColourId, transparent,
  1078. TreeView::oddItemsColourId, transparent,
  1079. TreeView::evenItemsColourId, transparent,
  1080. PopupMenu::backgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::menuBackground).getARGB(),
  1081. PopupMenu::textColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::menuText).getARGB(),
  1082. PopupMenu::headerTextColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::menuText).getARGB(),
  1083. PopupMenu::highlightedTextColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::highlightedText).getARGB(),
  1084. PopupMenu::highlightedBackgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::highlightedFill).getARGB(),
  1085. ComboBox::buttonColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
  1086. ComboBox::outlineColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
  1087. ComboBox::textColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
  1088. ComboBox::backgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
  1089. ComboBox::arrowColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
  1090. ComboBox::focusedOutlineColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
  1091. PropertyComponent::backgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
  1092. PropertyComponent::labelTextColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
  1093. TextPropertyComponent::backgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
  1094. TextPropertyComponent::textColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
  1095. TextPropertyComponent::outlineColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
  1096. BooleanPropertyComponent::backgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
  1097. BooleanPropertyComponent::outlineColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
  1098. ListBox::backgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
  1099. ListBox::outlineColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
  1100. ListBox::textColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
  1101. Slider::backgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
  1102. Slider::thumbColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultFill).getARGB(),
  1103. Slider::trackColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::highlightedFill).getARGB(),
  1104. Slider::rotarySliderFillColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::highlightedFill).getARGB(),
  1105. Slider::rotarySliderOutlineColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
  1106. Slider::textBoxTextColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
  1107. Slider::textBoxBackgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).withAlpha (0.0f).getARGB(),
  1108. Slider::textBoxHighlightColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultFill).withAlpha (0.4f).getARGB(),
  1109. Slider::textBoxOutlineColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
  1110. ResizableWindow::backgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::windowBackground).getARGB(),
  1111. DocumentWindow::textColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
  1112. AlertWindow::backgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
  1113. AlertWindow::textColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
  1114. AlertWindow::outlineColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
  1115. ProgressBar::backgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
  1116. ProgressBar::foregroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::highlightedFill).getARGB(),
  1117. TooltipWindow::backgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::highlightedFill).getARGB(),
  1118. TooltipWindow::textColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::highlightedText).getARGB(),
  1119. TooltipWindow::outlineColourId, transparent,
  1120. TabbedComponent::backgroundColourId, transparent,
  1121. TabbedComponent::outlineColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
  1122. TabbedButtonBar::tabOutlineColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).withAlpha (0.5f).getARGB(),
  1123. TabbedButtonBar::frontOutlineColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
  1124. Toolbar::backgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).withAlpha (0.4f).getARGB(),
  1125. Toolbar::separatorColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
  1126. Toolbar::buttonMouseOverBackgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).contrasting (0.2f).getARGB(),
  1127. Toolbar::buttonMouseDownBackgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).contrasting (0.5f).getARGB(),
  1128. Toolbar::labelTextColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
  1129. Toolbar::editingModeOutlineColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
  1130. DrawableButton::textColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
  1131. DrawableButton::textColourOnId, currentColourScheme.getUIColour (ColourScheme::UIColour::highlightedText).getARGB(),
  1132. DrawableButton::backgroundColourId, transparent,
  1133. DrawableButton::backgroundOnColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::highlightedFill).getARGB(),
  1134. HyperlinkButton::textColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).interpolatedWith (Colours::blue, 0.4f).getARGB(),
  1135. GroupComponent::outlineColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
  1136. GroupComponent::textColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
  1137. BubbleComponent::backgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
  1138. BubbleComponent::outlineColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
  1139. DirectoryContentsDisplayComponent::highlightColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::highlightedFill).getARGB(),
  1140. DirectoryContentsDisplayComponent::textColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::menuText).getARGB(),
  1141. DirectoryContentsDisplayComponent::highlightedTextColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::highlightedText).getARGB(),
  1142. 0x1000440, /*LassoComponent::lassoFillColourId*/ currentColourScheme.getUIColour (ColourScheme::UIColour::defaultFill).getARGB(),
  1143. 0x1000441, /*LassoComponent::lassoOutlineColourId*/ currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
  1144. 0x1004000, /*KeyboardComponentBase::upDownButtonBackgroundColourId*/ 0xffd3d3d3,
  1145. 0x1004001, /*KeyboardComponentBase::upDownButtonArrowColourId*/ 0xff000000,
  1146. 0x1005000, /*MidiKeyboardComponent::whiteNoteColourId*/ 0xffffffff,
  1147. 0x1005001, /*MidiKeyboardComponent::blackNoteColourId*/ 0xff000000,
  1148. 0x1005002, /*MidiKeyboardComponent::keySeparatorLineColourId*/ 0x66000000,
  1149. 0x1005003, /*MidiKeyboardComponent::mouseOverKeyOverlayColourId*/ 0x80ffff00,
  1150. 0x1005004, /*MidiKeyboardComponent::keyDownOverlayColourId*/ 0xffb6b600,
  1151. 0x1005005, /*MidiKeyboardComponent::textLabelColourId*/ 0xff000000,
  1152. 0x1005006, /*MidiKeyboardComponent::shadowColourId*/ 0x4c000000,
  1153. 0x1006000, /*MPEKeyboardComponent::whiteNoteColourId*/ 0xff1a1c27,
  1154. 0x1006001, /*MPEKeyboardComponent::blackNoteColourId*/ 0x99f1f1f1,
  1155. 0x1006002, /*MPEKeyboardComponent::textLabelColourId*/ 0xfff1f1f1,
  1156. 0x1006003, /*MPEKeyboardComponent::noteCircleFillColourId*/ 0x99ba00ff,
  1157. 0x1006004, /*MPEKeyboardComponent::noteCircleOutlineColourId*/ 0xfff1f1f1,
  1158. 0x1004500, /*CodeEditorComponent::backgroundColourId*/ currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
  1159. 0x1004502, /*CodeEditorComponent::highlightColourId*/ currentColourScheme.getUIColour (ColourScheme::UIColour::defaultFill).withAlpha (0.4f).getARGB(),
  1160. 0x1004503, /*CodeEditorComponent::defaultTextColourId*/ currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
  1161. 0x1004504, /*CodeEditorComponent::lineNumberBackgroundId*/ currentColourScheme.getUIColour (ColourScheme::UIColour::highlightedFill).withAlpha (0.5f).getARGB(),
  1162. 0x1004505, /*CodeEditorComponent::lineNumberTextId*/ currentColourScheme.getUIColour (ColourScheme::UIColour::defaultFill).getARGB(),
  1163. 0x1007000, /*ColourSelector::backgroundColourId*/ currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
  1164. 0x1007001, /*ColourSelector::labelTextColourId*/ currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
  1165. 0x100ad00, /*KeyMappingEditorComponent::backgroundColourId*/ currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
  1166. 0x100ad01, /*KeyMappingEditorComponent::textColourId*/ currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
  1167. FileSearchPathListComponent::backgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::menuBackground).getARGB(),
  1168. FileChooserDialogBox::titleTextColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
  1169. SidePanel::backgroundColour, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
  1170. SidePanel::titleTextColour, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultText).getARGB(),
  1171. SidePanel::shadowBaseColour, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).darker().getARGB(),
  1172. SidePanel::dismissButtonNormalColour, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultFill).getARGB(),
  1173. SidePanel::dismissButtonOverColour, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultFill).darker().getARGB(),
  1174. SidePanel::dismissButtonDownColour, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultFill).brighter().getARGB(),
  1175. FileBrowserComponent::currentPathBoxBackgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::menuBackground).getARGB(),
  1176. FileBrowserComponent::currentPathBoxTextColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::menuText).getARGB(),
  1177. FileBrowserComponent::currentPathBoxArrowColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::menuText).getARGB(),
  1178. FileBrowserComponent::filenameBoxBackgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::menuBackground).getARGB(),
  1179. FileBrowserComponent::filenameBoxTextColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::menuText).getARGB(),
  1180. };
  1181. for (int i = 0; i < numElementsInArray (coloursToUse); i += 2)
  1182. setColour ((int) coloursToUse [i], Colour ((uint32) coloursToUse [i + 1]));
  1183. }
  1184. } // namespace juce