The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
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.

91 lines
2.9KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2015 - ROLI Ltd.
  5. Permission is granted to use this software under the terms of either:
  6. a) the GPL v2 (or any later version)
  7. b) the Affero GPL v3
  8. Details of these licenses can be found at: www.gnu.org/licenses
  9. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  11. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  12. ------------------------------------------------------------------------------
  13. To release a closed-source product which uses JUCE, commercial licenses are
  14. available: visit www.juce.com for more information.
  15. ==============================================================================
  16. */
  17. #pragma once
  18. //==============================================================================
  19. struct Icon
  20. {
  21. Icon() : path (nullptr) {}
  22. Icon (const Path& p, Colour c) : path (&p), colour (c) {}
  23. Icon (const Path* p, Colour c) : path (p), colour (c) {}
  24. void draw (Graphics& g, const juce::Rectangle<float>& area, bool isCrossedOut) const
  25. {
  26. if (path != nullptr)
  27. {
  28. g.setColour (colour);
  29. const RectanglePlacement placement (RectanglePlacement::centred | RectanglePlacement::onlyReduceInSize);
  30. g.fillPath (*path, placement.getTransformToFit (path->getBounds(), area));
  31. if (isCrossedOut)
  32. {
  33. g.setColour (Colours::red.withAlpha (0.8f));
  34. g.drawLine ((float) area.getX(), area.getY() + area.getHeight() * 0.2f,
  35. (float) area.getRight(), area.getY() + area.getHeight() * 0.8f, 3.0f);
  36. }
  37. }
  38. }
  39. Icon withContrastingColourTo (Colour background) const
  40. {
  41. return Icon (path, background.contrasting (colour, 0.6f));
  42. }
  43. Icon withColour (Colour newColour)
  44. {
  45. return Icon (path, newColour);
  46. }
  47. const Path* path;
  48. Colour colour;
  49. };
  50. //==============================================================================
  51. class Icons
  52. {
  53. public:
  54. Icons();
  55. Path folder, document, imageDoc,
  56. config, /*exporter,*/ juceLogo,
  57. graph, jigsaw, info, warning,
  58. bug, /*play,*/ code, box,
  59. mainJuceLogo;
  60. Path user, closedFolder, exporter, fileExplorer, file,
  61. buildTab, modules, openFolder, play, settings, singleModule,
  62. buildNow, continuousBuildStart, continuousBuildStop, edit, plus,
  63. android, codeBlocks, linux, xcode, visualStudio;
  64. private:
  65. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Icons)
  66. };
  67. #ifndef BUILDING_JUCE_COMPILEENGINE
  68. const Icons& getIcons();
  69. #endif