diff options
Diffstat (limited to 'widget/cocoa/VibrancyManager.h')
-rw-r--r-- | widget/cocoa/VibrancyManager.h | 46 |
1 files changed, 15 insertions, 31 deletions
diff --git a/widget/cocoa/VibrancyManager.h b/widget/cocoa/VibrancyManager.h index c70ec60a3b..43adace794 100644 --- a/widget/cocoa/VibrancyManager.h +++ b/widget/cocoa/VibrancyManager.h @@ -7,24 +7,24 @@ #ifndef VibrancyManager_h #define VibrancyManager_h -#include "mozilla/Assertions.h" -#include "nsClassHashtable.h" -#include "nsRegion.h" -#include "nsTArray.h" -#include "ViewRegion.h" +#include "mozilla/EnumeratedArray.h" +#include "Units.h" -#import <Foundation/NSGeometry.h> - -@class NSColor; @class NSView; class nsChildView; namespace mozilla { +class ViewRegion; + enum class VibrancyType { - TOOLTIP, - MENU, - TITLEBAR, + // Add new values here, or update MaxEnumValue below if you add them after. + Titlebar, +}; + +template <> +struct MaxContiguousEnumValue<VibrancyType> { + static constexpr auto value = VibrancyType::Titlebar; }; /** @@ -51,9 +51,9 @@ class VibrancyManager { * NSVisualEffectViews which will be created for vibrant regions. */ VibrancyManager(const nsChildView& aCoordinateConverter, - NSView* aContainerView) - : mCoordinateConverter(aCoordinateConverter), - mContainerView(aContainerView) {} + NSView* aContainerView); + + ~VibrancyManager(); /** * Update the placement of the NSVisualEffectViews inside the container @@ -66,26 +66,10 @@ class VibrancyManager { bool UpdateVibrantRegion(VibrancyType aType, const LayoutDeviceIntRegion& aRegion); - bool HasVibrantRegions() { return !mVibrantRegions.IsEmpty(); } - - LayoutDeviceIntRegion GetUnionOfVibrantRegions() const; - - /** - * Create an NSVisualEffectView for the specified vibrancy type. The return - * value is not autoreleased. We return an object of type NSView* because we - * compile with an SDK that does not contain a definition for - * NSVisualEffectView. - * @param aIsContainer Whether this NSView will have child views. This value - * affects hit testing: Container views will pass through - * hit testing requests to their children, and leaf views - * will be transparent to hit testing. - */ - static NSView* CreateEffectView(VibrancyType aType, BOOL aIsContainer = NO); - protected: const nsChildView& mCoordinateConverter; NSView* mContainerView; - nsClassHashtable<nsUint32HashKey, ViewRegion> mVibrantRegions; + EnumeratedArray<VibrancyType, UniquePtr<ViewRegion>> mVibrantRegions; }; } // namespace mozilla |