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.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE 6 technical preview.
  4. Copyright (c) 2020 - Raw Material Software Limited
  5. You may use this code under the terms of the GPL v3
  6. (see www.gnu.org/licenses).
  7. For this technical preview, this file is not subject to commercial licensing.
  8. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  9. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  10. DISCLAIMED.
  11. ==============================================================================
  12. */
  13. namespace juce
  14. {
  15. //==============================================================================
  16. /**
  17. Adds a drop-shadow to a component.
  18. This object creates and manages a set of components which sit around a
  19. component, creating a gaussian shadow around it. The components will track
  20. the position of the component and if it's brought to the front they'll also
  21. follow this.
  22. For desktop windows you don't need to use this class directly - just
  23. set the Component::windowHasDropShadow flag when calling
  24. Component::addToDesktop(), and the system will create one of these if it's
  25. needed (which it obviously isn't on the Mac, for example).
  26. @tags{GUI}
  27. */
  28. class JUCE_API DropShadower : private ComponentListener
  29. {
  30. public:
  31. //==============================================================================
  32. /** Creates a DropShadower. */
  33. DropShadower (const DropShadow& shadowType);
  34. /** Destructor. */
  35. ~DropShadower() override;
  36. /** Attaches the DropShadower to the component you want to shadow. */
  37. void setOwner (Component* componentToFollow);
  38. private:
  39. //==============================================================================
  40. class ShadowWindow;
  41. Component* owner;
  42. OwnedArray<Component> shadowWindows;
  43. DropShadow shadow;
  44. bool reentrant;
  45. WeakReference<Component> lastParentComp;
  46. void componentMovedOrResized (Component&, bool, bool) override;
  47. void componentBroughtToFront (Component&) override;
  48. void componentChildrenChanged (Component&) override;
  49. void componentParentHierarchyChanged (Component&) override;
  50. void componentVisibilityChanged (Component&) override;
  51. void updateParent();
  52. void updateShadows();
  53. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DropShadower)
  54. };
  55. } // namespace juce