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.

82 lines
2.5KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2013 - Raw Material Software 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. #ifndef __JUCER_ICONS_JUCEHEADER__
  18. #define __JUCER_ICONS_JUCEHEADER__
  19. //==============================================================================
  20. struct Icon
  21. {
  22. Icon() : path (nullptr) {}
  23. Icon (const Path& p, Colour c) : path (&p), colour (c) {}
  24. Icon (const Path* p, Colour c) : path (p), colour (c) {}
  25. void draw (Graphics& g, const Rectangle<float>& area, bool isCrossedOut) const
  26. {
  27. if (path != nullptr)
  28. {
  29. g.setColour (colour);
  30. const RectanglePlacement placement (RectanglePlacement::centred | RectanglePlacement::onlyReduceInSize);
  31. g.fillPath (*path, placement.getTransformToFit (path->getBounds(), area));
  32. if (isCrossedOut)
  33. {
  34. g.setColour (Colours::red.withAlpha (0.8f));
  35. g.drawLine ((float) area.getX(), area.getY() + area.getHeight() * 0.2f,
  36. (float) area.getRight(), area.getY() + area.getHeight() * 0.8f, 3.0f);
  37. }
  38. }
  39. }
  40. Icon withContrastingColourTo (Colour background) const
  41. {
  42. return Icon (path, background.contrasting (colour, 0.6f));
  43. }
  44. const Path* path;
  45. Colour colour;
  46. };
  47. //==============================================================================
  48. class Icons
  49. {
  50. public:
  51. Icons();
  52. Path folder, document, imageDoc,
  53. config, exporter, juceLogo,
  54. graph, jigsaw, info, warning,
  55. bug, mainJuceLogo;
  56. private:
  57. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Icons)
  58. };
  59. const Icons& getIcons();
  60. #endif // __JUCER_ICONS_JUCEHEADER__