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.

93 lines
3.3KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-11 by Raw Material Software Ltd.
  5. ------------------------------------------------------------------------------
  6. JUCE can be redistributed and/or modified under the terms of the GNU General
  7. Public License (Version 2), as published by the Free Software Foundation.
  8. A copy of the license is included in the JUCE distribution, or can be found
  9. online at www.gnu.org/licenses.
  10. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13. ------------------------------------------------------------------------------
  14. To release a closed-source product which uses JUCE, commercial licenses are
  15. available: visit www.rawmaterialsoftware.com/juce for more information.
  16. ==============================================================================
  17. */
  18. #ifndef __JUCER_COMPONENTOVERLAYCOMPONENT_JUCEHEADER__
  19. #define __JUCER_COMPONENTOVERLAYCOMPONENT_JUCEHEADER__
  20. #include "../jucer_JucerDocument.h"
  21. //==============================================================================
  22. /**
  23. */
  24. class ComponentOverlayComponent : public Component,
  25. public ComponentListener,
  26. public ChangeListener,
  27. public ComponentBoundsConstrainer
  28. {
  29. public:
  30. //==============================================================================
  31. ComponentOverlayComponent (Component* const targetComponent,
  32. ComponentLayout& layout);
  33. ~ComponentOverlayComponent();
  34. //==============================================================================
  35. virtual void showPopupMenu();
  36. //==============================================================================
  37. void paint (Graphics& g);
  38. void resized();
  39. void mouseDown (const MouseEvent& e);
  40. void mouseDrag (const MouseEvent& e);
  41. void mouseUp (const MouseEvent& e);
  42. void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
  43. void changeListenerCallback (ChangeBroadcaster*);
  44. void resizeStart();
  45. void resizeEnd();
  46. void updateBoundsToMatchTarget();
  47. void checkBounds (Rectangle<int>& bounds,
  48. const Rectangle<int>& previousBounds,
  49. const Rectangle<int>& limits,
  50. bool isStretchingTop,
  51. bool isStretchingLeft,
  52. bool isStretchingBottom,
  53. bool isStretchingRight);
  54. void applyBoundsToComponent (Component* component, const Rectangle<int>& bounds);
  55. //==============================================================================
  56. Component::SafePointer<Component> target;
  57. const int borderThickness;
  58. private:
  59. ScopedPointer<ResizableBorderComponent> border;
  60. ComponentLayout& layout;
  61. bool selected, dragging, mouseDownSelectStatus;
  62. double originalAspectRatio;
  63. };
  64. #endif // __JUCER_COMPONENTOVERLAYCOMPONENT_JUCEHEADER__