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.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_COMPONENTOVERLAYCOMPONENT_JUCEHEADER__
  18. #define __JUCER_COMPONENTOVERLAYCOMPONENT_JUCEHEADER__
  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& g);
  37. void resized();
  38. void mouseDown (const MouseEvent& e);
  39. void mouseDrag (const MouseEvent& e);
  40. void mouseUp (const MouseEvent& e);
  41. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  42. void changeListenerCallback (ChangeBroadcaster*);
  43. void resizeStart();
  44. void resizeEnd();
  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);
  53. void applyBoundsToComponent (Component* component, const Rectangle<int>& bounds);
  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_JUCEHEADER__