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.

107 lines
2.8KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCETICE project - Copyright 2009 by Lucio Asnaghi.
  4. JUCETICE is based around the JUCE library - "Jules' Utility Class Extensions"
  5. Copyright 2007 by Julian Storer.
  6. ------------------------------------------------------------------------------
  7. JUCE and JUCETICE can be redistributed and/or modified under the terms of
  8. the GNU General Public License, as published by the Free Software Foundation;
  9. either version 2 of the License, or (at your option) any later version.
  10. JUCE and JUCETICE are distributed in the hope that they will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with JUCE and JUCETICE; if not, visit www.gnu.org/licenses or write to
  16. Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  17. Boston, MA 02111-1307 USA
  18. ==============================================================================
  19. */
  20. /* TODO - move to juce_ComponentLayoutManager.h */
  21. #ifndef __JUCETICE_COMPONENTLAYOUTMANAGER_HEADER__
  22. #define __JUCETICE_COMPONENTLAYOUTMANAGER_HEADER__
  23. //=============================================================================
  24. class ChildAlias : public Component
  25. {
  26. public:
  27. ChildAlias (Component* targetChild);
  28. ~ChildAlias ();
  29. void resized ();
  30. void paint (Graphics& g);
  31. const Component* getTargetChild ();
  32. void updateFromTarget ();
  33. void applyToTarget ();
  34. virtual void userChangedBounds ();
  35. virtual void userStartedChangingBounds ();
  36. virtual void userStoppedChangingBounds ();
  37. bool boundsChangedSinceStart ();
  38. void mouseEnter (const MouseEvent& e);
  39. void mouseExit (const MouseEvent& e);
  40. void mouseDown (const MouseEvent& e);
  41. void mouseUp (const MouseEvent& e);
  42. void mouseDrag (const MouseEvent& e);
  43. private:
  44. CriticalSection bounds;
  45. ComponentDragger dragger;
  46. SafePointer<Component> target;
  47. bool interest;
  48. bool userAdjusting;
  49. Rectangle<int> startBounds;
  50. ResizableBorderComponent* resizer;
  51. };
  52. //=============================================================================
  53. class ComponentLayoutManager : public Component
  54. {
  55. public:
  56. enum ColourIds
  57. {
  58. aliasIdleColour,
  59. aliasHoverColour
  60. };
  61. ComponentLayoutManager ();
  62. ~ComponentLayoutManager ();
  63. void resized ();
  64. void paint (Graphics& g);
  65. void setTargetComponent (Component* target);
  66. void bindWithTarget ();
  67. void updateFrames ();
  68. void enablementChanged ();
  69. const Component* getTarget ();
  70. private:
  71. virtual ChildAlias* createAlias (Component* child);
  72. SafePointer<Component> target;
  73. OwnedArray<ChildAlias> frames;
  74. };
  75. #endif//_COMPONENTLAYOUTEDITOR_H_