1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef nsTouchBarInput_h_
6 #define nsTouchBarInput_h_
8 #import <Cocoa/Cocoa.h>
10 #include "nsITouchBarInput.h"
13 using namespace mozilla::dom
;
15 enum class TouchBarInputBaseType
: uint8_t {
24 class nsTouchBarInputIcon
;
27 * NSObject representation of nsITouchBarInput.
29 @interface TouchBarInput
: NSObject
{
30 nsCOMPtr
<nsIURI
> mImageURI
;
31 RefPtr
<nsTouchBarInputIcon
> mIcon
;
32 TouchBarInputBaseType mBaseType
;
34 nsCOMPtr
<nsITouchBarInputCallback
> mCallback
;
35 NSMutableArray
<TouchBarInput
*>* mChildren
;
38 @
property(strong
) NSString
* key
;
39 @
property(strong
) NSString
* type
;
40 @
property(strong
) NSString
* title
;
41 @
property(strong
) NSColor
* color
;
42 @
property(nonatomic
, getter
=isDisabled
) BOOL disabled
;
44 - (nsCOMPtr
<nsIURI
>)imageURI
;
45 - (RefPtr
<nsTouchBarInputIcon
>)icon
;
46 - (TouchBarInputBaseType
)baseType
;
47 - (NSTouchBarItemIdentifier
)nativeIdentifier
;
48 - (nsCOMPtr
<nsITouchBarInputCallback
>)callback
;
49 - (NSMutableArray
<TouchBarInput
*>*)children
;
50 - (void)setImageURI
:(nsCOMPtr
<nsIURI
>)aImageURI
;
51 - (void)setIcon
:(RefPtr
<nsTouchBarInputIcon
>)aIcon
;
52 - (void)setCallback
:(nsCOMPtr
<nsITouchBarInputCallback
>)aCallback
;
53 - (void)setChildren
:(NSMutableArray
<TouchBarInput
*>*)aChildren
;
55 - (id
)initWithKey
:(NSString
*)aKey
56 title
:(NSString
*)aTitle
57 imageURI
:(nsCOMPtr
<nsIURI
>)aImageURI
59 callback
:(nsCOMPtr
<nsITouchBarInputCallback
>)aCallback
60 color
:(uint32_t)aColor
61 disabled
:(BOOL
)aDisabled
62 children
:(nsCOMPtr
<nsIArray
>)aChildren
;
64 - (TouchBarInput
*)initWithXPCOM
:(nsCOMPtr
<nsITouchBarInput
>)aInput
;
66 - (void)releaseJSObjects
;
71 * We make these helper methods static so that other classes can query a
72 * TouchBarInput's nativeIdentifier (e.g. nsTouchBarUpdater looking up a
73 * popover in mappedLayoutItems).
75 + (NSTouchBarItemIdentifier
)nativeIdentifierWithType
:(NSString
*)aType
76 withKey
:(NSString
*)aKey
;
77 + (NSTouchBarItemIdentifier
)nativeIdentifierWithXPCOM
:
78 (nsCOMPtr
<nsITouchBarInput
>)aInput
;
80 // Non-JS scrubber implemention for the Share Scrubber,
81 // since it is defined by an Apple API.
82 + (NSTouchBarItemIdentifier
)shareScrubberIdentifier
;
84 // The search popover needs to show/hide depending on if the Urlbar is focused
85 // when it is created. We keep track of its identifier to accommodate this
87 + (NSTouchBarItemIdentifier
)searchPopoverIdentifier
;
91 #endif // nsTouchBarInput_h_