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.

88 lines
3.2KB

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