Add NSScrubber forward declarations
This commit is contained in:
parent
cfb3798703
commit
634bd7b17f
3 changed files with 57 additions and 7 deletions
|
@ -10,6 +10,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "atom/browser/ui/cocoa/touch_bar_forward_declarations.h"
|
||||||
#include "native_mate/persistent_dictionary.h"
|
#include "native_mate/persistent_dictionary.h"
|
||||||
|
|
||||||
@interface AtomScrubberDataSource : NSObject<NSScrubberDataSource> {
|
@interface AtomScrubberDataSource : NSObject<NSScrubberDataSource> {
|
||||||
|
|
|
@ -509,10 +509,10 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
|
||||||
int height = 30;
|
int height = 30;
|
||||||
settings.Get("frameWidth", &width);
|
settings.Get("frameWidth", &width);
|
||||||
settings.Get("frameHeight", &height);
|
settings.Get("frameHeight", &height);
|
||||||
NSScrubber* scrubber = [[NSScrubber alloc] initWithFrame:NSMakeRect(0, 0, width, height)];
|
NSScrubber* scrubber = [[NSClassFromString(@"NSScrubber") alloc] initWithFrame:NSMakeRect(0, 0, width, height)];
|
||||||
|
|
||||||
[scrubber registerClass:[NSScrubberTextItemView class] forItemIdentifier:TextScrubberItemIdentifier];
|
[scrubber registerClass:NSClassFromString(@"NSScrubberTextItemView") forItemIdentifier:TextScrubberItemIdentifier];
|
||||||
[scrubber registerClass:[NSScrubberImageItemView class] forItemIdentifier:ImageScrubberItemIdentifier];
|
[scrubber registerClass:NSClassFromString(@"NSScrubberImageItemView") forItemIdentifier:ImageScrubberItemIdentifier];
|
||||||
|
|
||||||
scrubber.delegate = self;
|
scrubber.delegate = self;
|
||||||
scrubber.identifier = id;
|
scrubber.identifier = id;
|
||||||
|
|
|
@ -14,13 +14,19 @@
|
||||||
#pragma clang assume_nonnull begin
|
#pragma clang assume_nonnull begin
|
||||||
|
|
||||||
@class NSTouchBar, NSTouchBarItem;
|
@class NSTouchBar, NSTouchBarItem;
|
||||||
@protocol NSTouchBarDelegate;
|
@class NSScrubber, NSScrubberItemView, NSScrubberArrangedView, NSScrubberTextItemView, NSScrubberImageItemView;
|
||||||
|
@protocol NSTouchBarDelegate, NSScrubberDelegate, NSScrubberDataSource;
|
||||||
|
|
||||||
typedef float NSTouchBarItemPriority;
|
typedef float NSTouchBarItemPriority;
|
||||||
static const NSTouchBarItemPriority NSTouchBarItemPriorityHigh = 1000;
|
static const NSTouchBarItemPriority NSTouchBarItemPriorityHigh = 1000;
|
||||||
static const NSTouchBarItemPriority NSTouchBarItemPriorityNormal = 0;
|
static const NSTouchBarItemPriority NSTouchBarItemPriorityNormal = 0;
|
||||||
static const NSTouchBarItemPriority NSTouchBarItemPriorityLow = -1000;
|
static const NSTouchBarItemPriority NSTouchBarItemPriorityLow = -1000;
|
||||||
|
|
||||||
|
enum NSScrubberMode {
|
||||||
|
NSScrubberModeFixed = 0,
|
||||||
|
NSScrubberModeFree
|
||||||
|
};
|
||||||
|
|
||||||
typedef NSString* NSTouchBarItemIdentifier;
|
typedef NSString* NSTouchBarItemIdentifier;
|
||||||
typedef NSString* NSTouchBarCustomizationIdentifier;
|
typedef NSString* NSTouchBarCustomizationIdentifier;
|
||||||
|
|
||||||
|
@ -123,6 +129,41 @@ static const NSTouchBarItemIdentifier NSTouchBarItemIdentifierOtherItemsProxy =
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@interface NSScrubber : NSView
|
||||||
|
|
||||||
|
@property(weak) id<NSScrubberDelegate> delegate;
|
||||||
|
@property(weak) id<NSScrubberDataSource> dataSource;
|
||||||
|
@property NSScrubberMode mode;
|
||||||
|
|
||||||
|
- (void)registerClass:(Class)itemViewClass
|
||||||
|
forItemIdentifier:(NSString*)itemIdentifier;
|
||||||
|
|
||||||
|
- (__kindof NSScrubberItemView*)makeItemWithIdentifier:(NSString*)itemIdentifier
|
||||||
|
owner:(id)owner;
|
||||||
|
- (void)reloadData;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface NSScrubberArrangedView : NSView
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface NSScrubberItemView : NSScrubberArrangedView
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface NSScrubberTextItemView : NSScrubberItemView
|
||||||
|
|
||||||
|
@property(copy) NSString* title;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface NSScrubberImageItemView : NSScrubberItemView
|
||||||
|
|
||||||
|
@property(copy) NSImage* image;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
@interface NSWindow (TouchBarSDK)
|
@interface NSWindow (TouchBarSDK)
|
||||||
|
|
||||||
@property(strong, readwrite, nullable) NSTouchBar* touchBar;
|
@property(strong, readwrite, nullable) NSTouchBar* touchBar;
|
||||||
|
@ -160,6 +201,14 @@ static const NSTouchBarItemIdentifier NSTouchBarItemIdentifierOtherItemsProxy =
|
||||||
makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier;
|
makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@protocol NSScrubberDelegate<NSObject>
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@protocol NSScrubberDataSource<NSObject>
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
#pragma clang assume_nonnull end
|
#pragma clang assume_nonnull end
|
||||||
|
|
||||||
#elif MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12_1
|
#elif MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12_1
|
||||||
|
|
Loading…
Add table
Reference in a new issue