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.

78 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_JucerDocument.h"
  15. //==============================================================================
  16. class ComponentOverlayComponent : public Component,
  17. public ComponentListener,
  18. public ChangeListener,
  19. public ComponentBoundsConstrainer
  20. {
  21. public:
  22. //==============================================================================
  23. ComponentOverlayComponent (Component* const targetComponent,
  24. ComponentLayout& layout);
  25. ~ComponentOverlayComponent() override;
  26. //==============================================================================
  27. virtual void showPopupMenu();
  28. //==============================================================================
  29. void paint (Graphics&) override;
  30. void resized() override;
  31. void mouseDown (const MouseEvent&) override;
  32. void mouseDrag (const MouseEvent&) override;
  33. void mouseUp (const MouseEvent&) override;
  34. void componentMovedOrResized (Component&, bool wasMoved, bool wasResized) override;
  35. void changeListenerCallback (ChangeBroadcaster*) override;
  36. void resizeStart() override;
  37. void resizeEnd() override;
  38. void updateBoundsToMatchTarget();
  39. void checkBounds (Rectangle<int>& bounds,
  40. const Rectangle<int>& previousBounds,
  41. const Rectangle<int>& limits,
  42. bool isStretchingTop,
  43. bool isStretchingLeft,
  44. bool isStretchingBottom,
  45. bool isStretchingRight) override;
  46. void applyBoundsToComponent (Component&, Rectangle<int>) override;
  47. //==============================================================================
  48. Component::SafePointer<Component> target;
  49. const int borderThickness;
  50. private:
  51. std::unique_ptr<ResizableBorderComponent> border;
  52. ComponentLayout& layout;
  53. bool selected, dragging, mouseDownSelectStatus;
  54. double originalAspectRatio;
  55. };