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.

92 lines
3.2KB

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