/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef nsTouchBarInput_h_ #define nsTouchBarInput_h_ #import #include "nsITouchBarInput.h" #include "nsCOMPtr.h" using namespace mozilla::dom; enum class TouchBarInputBaseType : uint8_t { kButton, kLabel, kMainButton, kPopover, kScrollView, kScrubber }; class nsTouchBarInputIcon; /** * NSObject representation of nsITouchBarInput. */ @interface TouchBarInput : NSObject { nsCOMPtr mImageURI; RefPtr mIcon; TouchBarInputBaseType mBaseType; NSString* mType; nsCOMPtr mCallback; NSMutableArray* mChildren; } @property(strong) NSString* key; @property(strong) NSString* type; @property(strong) NSString* title; @property(strong) NSColor* color; @property(nonatomic, getter=isDisabled) BOOL disabled; - (nsCOMPtr)imageURI; - (RefPtr)icon; - (TouchBarInputBaseType)baseType; - (NSTouchBarItemIdentifier)nativeIdentifier; - (nsCOMPtr)callback; - (NSMutableArray*)children; - (void)setImageURI:(nsCOMPtr)aImageURI; - (void)setIcon:(RefPtr)aIcon; - (void)setCallback:(nsCOMPtr)aCallback; - (void)setChildren:(NSMutableArray*)aChildren; - (id)initWithKey:(NSString*)aKey title:(NSString*)aTitle imageURI:(nsCOMPtr)aImageURI type:(NSString*)aType callback:(nsCOMPtr)aCallback color:(uint32_t)aColor disabled:(BOOL)aDisabled children:(nsCOMPtr)aChildren; - (TouchBarInput*)initWithXPCOM:(nsCOMPtr)aInput; - (void)releaseJSObjects; - (void)dealloc; /** * We make these helper methods static so that other classes can query a * TouchBarInput's nativeIdentifier (e.g. nsTouchBarUpdater looking up a * popover in mappedLayoutItems). */ + (NSTouchBarItemIdentifier)nativeIdentifierWithType:(NSString*)aType withKey:(NSString*)aKey; + (NSTouchBarItemIdentifier)nativeIdentifierWithXPCOM: (nsCOMPtr)aInput; // Non-JS scrubber implemention for the Share Scrubber, // since it is defined by an Apple API. + (NSTouchBarItemIdentifier)shareScrubberIdentifier; // The search popover needs to show/hide depending on if the Urlbar is focused // when it is created. We keep track of its identifier to accommodate this // special handling. + (NSTouchBarItemIdentifier)searchPopoverIdentifier; @end #endif // nsTouchBarInput_h_