Add support for spacer items
This commit is contained in:
parent
f153d08297
commit
61aa9bbff4
3 changed files with 21 additions and 2 deletions
|
@ -61,6 +61,16 @@ static NSTouchBarItemIdentifier SliderIdentifier = @"com.electron.touchbar.slide
|
||||||
[identifiers addObject:[NSString stringWithFormat:@"%@%@", PopOverIdentifier, base::SysUTF8ToNSString(item_id)]];
|
[identifiers addObject:[NSString stringWithFormat:@"%@%@", PopOverIdentifier, base::SysUTF8ToNSString(item_id)]];
|
||||||
} else if (type == "group") {
|
} else if (type == "group") {
|
||||||
[identifiers addObject:[NSString stringWithFormat:@"%@%@", GroupIdentifier, base::SysUTF8ToNSString(item_id)]];
|
[identifiers addObject:[NSString stringWithFormat:@"%@%@", GroupIdentifier, base::SysUTF8ToNSString(item_id)]];
|
||||||
|
} else if (type == "spacer") {
|
||||||
|
std::string size;
|
||||||
|
item.Get("size", &size);
|
||||||
|
if (size == "large") {
|
||||||
|
[identifiers addObject:NSTouchBarItemIdentifierFixedSpaceLarge];
|
||||||
|
} else if (size == "flexible") {
|
||||||
|
[identifiers addObject:NSTouchBarItemIdentifierFlexibleSpace];
|
||||||
|
} else {
|
||||||
|
[identifiers addObject:NSTouchBarItemIdentifierFixedSpaceSmall];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -270,8 +280,6 @@ static NSTouchBarItemIdentifier SliderIdentifier = @"com.electron.touchbar.slide
|
||||||
item.colorList = color_list;
|
item.colorList = color_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
item.showsAlpha = NO;
|
|
||||||
|
|
||||||
[self updateColorPicker:item withSettings:settings];
|
[self updateColorPicker:item withSettings:settings];
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,9 @@ typedef NSString* NSTouchBarCustomizationIdentifier;
|
||||||
static const NSTouchBarItemIdentifier NSTouchBarItemIdentifierFixedSpaceSmall =
|
static const NSTouchBarItemIdentifier NSTouchBarItemIdentifierFixedSpaceSmall =
|
||||||
@"NSTouchBarItemIdentifierFixedSpaceSmall";
|
@"NSTouchBarItemIdentifierFixedSpaceSmall";
|
||||||
|
|
||||||
|
static const NSTouchBarItemIdentifier NSTouchBarItemIdentifierFixedSpaceLarge =
|
||||||
|
@"NSTouchBarItemIdentifierFixedSpaceLarge";
|
||||||
|
|
||||||
static const NSTouchBarItemIdentifier NSTouchBarItemIdentifierFlexibleSpace =
|
static const NSTouchBarItemIdentifier NSTouchBarItemIdentifierFlexibleSpace =
|
||||||
@"NSTouchBarItemIdentifierFlexibleSpace";
|
@"NSTouchBarItemIdentifierFlexibleSpace";
|
||||||
|
|
||||||
|
|
|
@ -153,6 +153,14 @@ TouchBar.Label = class TouchBarLabel extends TouchBarItem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TouchBar.Spacer = class TouchBarSpacer extends TouchBarItem {
|
||||||
|
constructor (config) {
|
||||||
|
super(config)
|
||||||
|
this.type = 'spacer'
|
||||||
|
this.size = config.size
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TouchBar.Popover = class TouchBarPopover extends TouchBarItem {
|
TouchBar.Popover = class TouchBarPopover extends TouchBarItem {
|
||||||
constructor (config) {
|
constructor (config) {
|
||||||
super(config)
|
super(config)
|
||||||
|
|
Loading…
Reference in a new issue