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.

74 lines
2.7KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE 6 technical preview.
  4. Copyright (c) 2020 - Raw Material Software Limited
  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. #include "../jucer_PaintRoutine.h"
  15. #include "../jucer_JucerDocument.h"
  16. #include "jucer_StrokeType.h"
  17. //==============================================================================
  18. /**
  19. Base class for paint elements that have a fill colour and stroke.
  20. */
  21. class ColouredElement : public PaintElement
  22. {
  23. public:
  24. ColouredElement (PaintRoutine* owner,
  25. const String& name,
  26. const bool showOutline_,
  27. const bool showJointAndEnd_);
  28. ~ColouredElement() override;
  29. //==============================================================================
  30. void getEditableProperties (Array<PropertyComponent*>& props, bool multipleSelected) override;
  31. void getColourSpecificProperties (Array<PropertyComponent*>& props);
  32. //==============================================================================
  33. const JucerFillType& getFillType() noexcept;
  34. void setFillType (const JucerFillType& newType, const bool undoable);
  35. bool isStrokeEnabled() const noexcept;
  36. void enableStroke (bool enable, const bool undoable);
  37. const StrokeType& getStrokeType() noexcept;
  38. void setStrokeType (const PathStrokeType& newType, const bool undoable);
  39. void setStrokeFill (const JucerFillType& newType, const bool undoable);
  40. //==============================================================================
  41. Rectangle<int> getCurrentBounds (const Rectangle<int>& parentArea) const override;
  42. void setCurrentBounds (const Rectangle<int>& newBounds, const Rectangle<int>& parentArea, const bool undoable) override;
  43. void createSiblingComponents() override;
  44. //==============================================================================
  45. void addColourAttributes (XmlElement* const e) const;
  46. bool loadColourAttributes (const XmlElement& xml);
  47. protected:
  48. JucerFillType fillType;
  49. bool isStrokePresent;
  50. const bool showOutline, showJointAndEnd;
  51. StrokeType strokeType;
  52. void convertToNewPathElement (const Path& path);
  53. };