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.

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