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.

85 lines
3.1KB

  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_COLOUREDELEMENT_JUCEHEADER__
  18. #define __JUCER_COLOUREDELEMENT_JUCEHEADER__
  19. #include "../jucer_PaintRoutine.h"
  20. #include "../jucer_JucerDocument.h"
  21. #include "jucer_StrokeType.h"
  22. //==============================================================================
  23. /**
  24. Base class for paint elements that have a fill colour and stroke.
  25. */
  26. class ColouredElement : public PaintElement
  27. {
  28. public:
  29. ColouredElement (PaintRoutine* owner,
  30. const String& name,
  31. const bool showOutline_,
  32. const bool showJointAndEnd_);
  33. ~ColouredElement();
  34. //==============================================================================
  35. void getEditableProperties (Array<PropertyComponent*>& props);
  36. void getColourSpecificProperties (Array<PropertyComponent*>& props);
  37. //==============================================================================
  38. const JucerFillType& getFillType() noexcept;
  39. void setFillType (const JucerFillType& newType, const bool undoable);
  40. bool isStrokeEnabled() const noexcept;
  41. void enableStroke (bool enable, const bool undoable);
  42. const StrokeType& getStrokeType() noexcept;
  43. void setStrokeType (const PathStrokeType& newType, const bool undoable);
  44. void setStrokeFill (const JucerFillType& newType, const bool undoable);
  45. //==============================================================================
  46. Rectangle<int> getCurrentBounds (const Rectangle<int>& parentArea) const;
  47. void setCurrentBounds (const Rectangle<int>& newBounds, const Rectangle<int>& parentArea, const bool undoable);
  48. void createSiblingComponents();
  49. //==============================================================================
  50. void addColourAttributes (XmlElement* const e) const;
  51. bool loadColourAttributes (const XmlElement& xml);
  52. protected:
  53. JucerFillType fillType;
  54. bool isStrokePresent;
  55. const bool showOutline, showJointAndEnd;
  56. StrokeType strokeType;
  57. void convertToNewPathElement (const Path& path);
  58. };
  59. #endif // __JUCER_COLOUREDELEMENT_JUCEHEADER__