Audio plugin host https://kx.studio/carla
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.

juce_DropShadower.h 2.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 JUCE_DROPSHADOWER_H_INCLUDED
  18. #define JUCE_DROPSHADOWER_H_INCLUDED
  19. //==============================================================================
  20. /**
  21. Adds a drop-shadow to a component.
  22. This object creates and manages a set of components which sit around a
  23. component, creating a gaussian shadow around it. The components will track
  24. the position of the component and if it's brought to the front they'll also
  25. follow this.
  26. For desktop windows you don't need to use this class directly - just
  27. set the Component::windowHasDropShadow flag when calling
  28. Component::addToDesktop(), and the system will create one of these if it's
  29. needed (which it obviously isn't on the Mac, for example).
  30. */
  31. class JUCE_API DropShadower : private ComponentListener
  32. {
  33. public:
  34. //==============================================================================
  35. /** Creates a DropShadower. */
  36. DropShadower (const DropShadow& shadowType);
  37. /** Destructor. */
  38. ~DropShadower();
  39. /** Attaches the DropShadower to the component you want to shadow. */
  40. void setOwner (Component* componentToFollow);
  41. private:
  42. //==============================================================================
  43. class ShadowWindow;
  44. Component* owner;
  45. OwnedArray<Component> shadowWindows;
  46. DropShadow shadow;
  47. bool reentrant;
  48. WeakReference<Component> lastParentComp;
  49. void componentMovedOrResized (Component&, bool, bool) override;
  50. void componentBroughtToFront (Component&) override;
  51. void componentChildrenChanged (Component&) override;
  52. void componentParentHierarchyChanged (Component&) override;
  53. void componentVisibilityChanged (Component&) override;
  54. void updateParent();
  55. void updateShadows();
  56. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DropShadower)
  57. };
  58. #endif // JUCE_DROPSHADOWER_H_INCLUDED