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.

87 lines
3.0KB

  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_COMPONENTLAYOUTEDITOR_JUCEHEADER__
  18. #define __JUCER_COMPONENTLAYOUTEDITOR_JUCEHEADER__
  19. #include "jucer_ComponentOverlayComponent.h"
  20. #include "../jucer_JucerDocument.h"
  21. #include "jucer_SnapGridPainter.h"
  22. //==============================================================================
  23. /**
  24. */
  25. class ComponentLayoutEditor : public Component,
  26. public ChangeListener,
  27. public FileDragAndDropTarget,
  28. public LassoSource <Component*>
  29. {
  30. public:
  31. //==============================================================================
  32. ComponentLayoutEditor (JucerDocument& document, ComponentLayout& layout);
  33. ~ComponentLayoutEditor();
  34. //==============================================================================
  35. void paint (Graphics& g);
  36. void resized();
  37. void visibilityChanged();
  38. void changeListenerCallback (ChangeBroadcaster*);
  39. void mouseDown (const MouseEvent& e);
  40. void mouseDrag (const MouseEvent& e);
  41. void mouseUp (const MouseEvent& e);
  42. bool keyPressed (const KeyPress& key);
  43. bool isInterestedInFileDrag (const StringArray& files);
  44. void filesDropped (const StringArray& filenames, int x, int y);
  45. ComponentLayout& getLayout() const noexcept { return layout; }
  46. void findLassoItemsInArea (Array <Component*>& results, const Rectangle<int>& area);
  47. SelectedItemSet <Component*>& getLassoSelection();
  48. //==============================================================================
  49. void refreshAllComponents();
  50. void updateOverlayPositions();
  51. ComponentOverlayComponent* getOverlayCompFor (Component*) const;
  52. Rectangle<int> getComponentArea() const;
  53. Image createComponentLayerSnapshot() const;
  54. private:
  55. JucerDocument& document;
  56. ComponentLayout& layout;
  57. Component* subCompHolder;
  58. LassoComponent <Component*> lassoComp;
  59. SnapGridPainter grid;
  60. bool firstResize;
  61. };
  62. #endif // __JUCER_COMPONENTLAYOUTEDITOR_JUCEHEADER__