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.

79 lines
2.4KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE 6 technical preview.
  4. Copyright (c) 2017 - ROLI Ltd.
  5. You may use this code under the terms of the GPL v3
  6. (see www.gnu.org/licenses).
  7. For this technical preview, this file is not subject to commercial licensing.
  8. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  9. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  10. DISCLAIMED.
  11. ==============================================================================
  12. */
  13. #pragma once
  14. //==============================================================================
  15. struct Icon
  16. {
  17. Icon() : path (nullptr) {}
  18. Icon (const Path& p, Colour c) : path (&p), colour (c) {}
  19. Icon (const Path* p, Colour c) : path (p), colour (c) {}
  20. void draw (Graphics& g, const juce::Rectangle<float>& area, bool isCrossedOut) const
  21. {
  22. if (path != nullptr)
  23. {
  24. g.setColour (colour);
  25. const RectanglePlacement placement (RectanglePlacement::centred | RectanglePlacement::onlyReduceInSize);
  26. g.fillPath (*path, placement.getTransformToFit (path->getBounds(), area));
  27. if (isCrossedOut)
  28. {
  29. g.setColour (Colours::red.withAlpha (0.8f));
  30. g.drawLine ((float) area.getX(), area.getY() + area.getHeight() * 0.2f,
  31. (float) area.getRight(), area.getY() + area.getHeight() * 0.8f, 3.0f);
  32. }
  33. }
  34. }
  35. Icon withContrastingColourTo (Colour background) const
  36. {
  37. return Icon (path, background.contrasting (colour, 0.6f));
  38. }
  39. Icon withColour (Colour newColour)
  40. {
  41. return Icon (path, newColour);
  42. }
  43. const Path* path;
  44. Colour colour;
  45. };
  46. //==============================================================================
  47. class Icons
  48. {
  49. public:
  50. Icons();
  51. Path folder, document, imageDoc, config, juceLogo, graph, jigsaw, info, warning, bug,
  52. code, box, mainJuceLogo, user, closedFolder, exporter, fileExplorer, file, buildTab,
  53. modules, openFolder, play, settings, singleModule, edit, plus, android, codeBlocks,
  54. linux, xcode, visualStudio, clion;
  55. private:
  56. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Icons)
  57. };
  58. #ifndef BUILDING_JUCE_COMPILEENGINE
  59. const Icons& getIcons();
  60. #endif