89 CPToolbarDisplayMode _displayMode;
90 BOOL _showsBaselineSeparator;
91 BOOL _allowsUserCustomization;
93 CPToolbarSizeMode _sizeMode;
98 CPArray _itemIdentifiers;
101 CPArray _defaultItems;
102 CPArray _allowedItems;
103 CPArray _selectableItems;
106 CPArray _itemsSortedByVisibilityPriority;
125 var toolbarsSharingIdentifier = [CPToolbarsByIdentifier objectForKey:identifier];
127 if (!toolbarsSharingIdentifier)
129 toolbarsSharingIdentifier = []
130 [CPToolbarsByIdentifier setObject:toolbarsSharingIdentifier forKey:identifier];
133 [toolbarsSharingIdentifier addObject:toolbar];
154 _identifier = anIdentifier;
159 [
CPToolbar _addToolbar:self forIdentifier:_identifier];
193 - (void)setVisible:(BOOL)aFlag
195 if (_isVisible === aFlag)
200 [_window _noteToolbarChanged];
203 - (void)setSizeMode:(CPToolbarSizeMode)aSize
205 if (aSize === _sizeMode)
209 [[
self _toolbarView] setFrame:[
self _toolbarViewFrame]];
210 [_window _noteToolbarChanged];
218 - (void)_setWindow:(
CPWindow)aWindow
233 - (void)setDelegate:(
id)aDelegate
235 if (_delegate === aDelegate)
238 _delegate = aDelegate;
240 [
self _reloadToolbarItems];
243 - (void)setDisplayMode:(CPToolbarDisplayMode)aDisplayMode
245 if (_displayMode === aDisplayMode)
247 _displayMode = aDisplayMode;
249 [
self _reloadToolbarItems];
253 - (void)_loadConfiguration
258 - (CGRect)_toolbarViewFrame
260 var height = _desiredHeight || (_sizeMode !=
CPToolbarSizeModeSmall ? [_toolbarView valueForThemeAttribute:@"regular-size-height"] : [_toolbarView valueForThemeAttribute:@"small-size-height"]);
261 return CGRectMake(0.0, 0.0, 1200.0, height);
269 _toolbarView = [[_CPToolbarView alloc] initWithFrame:[
self _toolbarViewFrame]];
271 [_toolbarView setToolbar:self];
272 [_toolbarView setAutoresizingMask:CPViewWidthSizable];
273 [_toolbarView reloadToolbarItems];
280 - (void)_reloadToolbarItems
287 _itemIdentifiers = [_defaultItems valueForKey:@"itemIdentifier"] || [];
289 if ([_delegate respondsToSelector:
@selector(toolbarDefaultItemIdentifiers:)])
291 var itemIdentifiersFromDelegate = [_delegate toolbarDefaultItemIdentifiers:self];
295 if (itemIdentifiersFromDelegate)
296 _itemIdentifiers = [itemIdentifiersFromDelegate arrayByAddingObjectsFromArray:_itemIdentifiers];
302 count = [_itemIdentifiers count];
306 for (; index < count; ++index)
308 var identifier = _itemIdentifiers[index],
309 item = [CPToolbarItem _standardItemWithItemIdentifier:identifier];
313 item = [_identifiedItems objectForKey:identifier];
315 if (!item && _delegate)
316 item = [_delegate toolbar:
self itemForItemIdentifier:identifier willBeInsertedIntoToolbar:YES];
322 reason:
@"Toolbar delegate " + _delegate +
" returned nil toolbar item for identifier \"" + identifier +
"\""];
324 item._toolbar =
self;
326 [_items addObject:item];
334 _itemsSortedByVisibilityPriority = [_items sortedArrayUsingFunction:_CPToolbarItemVisibilityPriorityCompare context:NULL];
336 [_toolbarView reloadToolbarItems];
350 - (CPArray)visibleItems
352 return [_toolbarView visibleItems];
358 - (CPArray)itemsSortedByVisibilityPriority
360 return _itemsSortedByVisibilityPriority;
367 - (void)validateVisibleItems
369 [
self _validateVisibleItems:NO]
372 - (void)_autoValidateVisibleItems
374 [
self _validateVisibleItems:YES]
377 - (void)_validateVisibleItems:(BOOL)isAutovalidation
379 var toolbarItems = [
self visibleItems],
380 count = [toolbarItems count];
384 var item = [toolbarItems objectAtIndex:count];
385 if (!isAutovalidation || [item autovalidates])
391 - (id)_itemForItemIdentifier:(
CPString)identifier willBeInsertedIntoToolbar:(BOOL)toolbar
393 var item = [_identifiedItems objectForKey:identifier];
396 item = [CPToolbarItem _standardItemWithItemIdentifier:identifier];
397 if (_delegate && !item)
399 item = [[_delegate toolbar:self itemForItemIdentifier:identifier willBeInsertedIntoToolbar:toolbar] copy];
402 reason:
@"Toolbar delegate " + _delegate +
" returned nil toolbar item for identifier " + identifier];
405 [_identifiedItems setObject:item forKey:identifier];
412 - (id)_itemsWithIdentifiers:(CPArray)identifiers
415 for (var i = 0; i < identifiers.length; i++)
416 [items addObject:[self _itemForItemIdentifier:identifiers[i] willBeInsertedIntoToolbar:NO]];
422 - (id)_defaultToolbarItems
424 if (!_defaultItems && [_delegate respondsToSelector:
@selector(toolbarDefaultItemIdentifiers:)])
428 var identifiers = [_delegate toolbarDefaultItemIdentifiers:self],
430 count = [identifiers count];
432 for (; index < count; ++index)
433 [_defaultItems addObject:[self _itemForItemIdentifier:identifiers[index] willBeInsertedIntoToolbar:NO]];
436 return _defaultItems;
443 - (void)toolbarItemDidChange:(CPToolbarItem)anItem
445 if ([_identifiedItems objectForKey:[anItem itemIdentifier]])
446 [_identifiedItems setObject:anItem forKey:[anItem itemIdentifier]];
449 count = [_items count];
451 for (; index <= count; ++index)
453 var item = _items[index];
455 if ([item itemIdentifier] === [anItem itemIdentifier])
457 _items[index] = anItem;
458 _itemsSortedByVisibilityPriority = [_items sortedArrayUsingFunction:_CPToolbarItemVisibilityPriorityCompare context:NULL];
460 [_toolbarView reloadToolbarItems];
492 _identifier = [aCoder decodeObjectForKey:CPToolbarIdentifierKey];
493 _displayMode = [aCoder decodeIntForKey:CPToolbarDisplayModeKey];
494 _showsBaselineSeparator = [aCoder decodeBoolForKey:CPToolbarShowsBaselineSeparatorKey];
495 _allowsUserCustomization = [aCoder decodeBoolForKey:CPToolbarAllowsUserCustomizationKey];
496 _isVisible = [aCoder decodeBoolForKey:CPToolbarIsVisibleKey];
497 _sizeMode = [aCoder decodeIntForKey:CPToolbarSizeModeKey];
499 _identifiedItems = [aCoder decodeObjectForKey:CPToolbarIdentifiedItemsKey];
500 _defaultItems = [aCoder decodeObjectForKey:CPToolbarDefaultItemsKey];
501 _allowedItems = [aCoder decodeObjectForKey:CPToolbarAllowedItemsKey];
502 _selectableItems = [aCoder decodeObjectForKey:CPToolbarSelectableItemsKey];
504 [[_identifiedItems allValues] makeObjectsPerformSelector:@selector(_setToolbar:) withObject:self];
508 [
CPToolbar _addToolbar:self forIdentifier:_identifier];
511 [
self setDelegate:[aCoder decodeObjectForKey:CPToolbarDelegateKey]];
539 [aCoder encodeObject:_identifier forKey:CPToolbarIdentifierKey];
540 [aCoder encodeInt:_displayMode forKey:CPToolbarDisplayModeKey];
541 [aCoder encodeBool:_showsBaselineSeparator forKey:CPToolbarShowsBaselineSeparatorKey];
542 [aCoder encodeBool:_allowsUserCustomization forKey:CPToolbarAllowsUserCustomizationKey];
543 [aCoder encodeBool:_isVisible forKey:CPToolbarIsVisibleKey];
544 [aCoder encodeInt:_sizeMode forKey:CPToolbarSizeModeKey]
546 [aCoder encodeObject:_identifiedItems forKey:CPToolbarIdentifiedItemsKey];
547 [aCoder encodeObject:_defaultItems forKey:CPToolbarDefaultItemsKey];
548 [aCoder encodeObject:_allowedItems forKey:CPToolbarAllowedItemsKey];
549 [aCoder encodeObject:_selectableItems forKey:CPToolbarSelectableItemsKey];
551 [aCoder encodeConditionalObject:_delegate forKey:CPToolbarDelegateKey];
557 var _CPToolbarViewBackgroundColor = nil,
558 _CPToolbarViewExtraItemsImage = nil,
559 _CPToolbarViewExtraItemsAlternateImage = nil;
561 var _CPToolbarItemInfoMake =
function(anIndex, aView, aLabel, aMinWidth)
563 return { index:anIndex, view:aView,
label:aLabel, minWidth:aMinWidth };
567 @implementation _CPToolbarView :
CPView
575 JSObject _viewsForToolbarItems;
577 CPArray _visibleItems;
578 CPArray _invisibleItems;
591 return @"toolbar-view";
597 @"item-margin": 10.0,
598 @"extra-item-width": 20.0,
600 @"extra-item-extra-alternate-image": [
CPNull null],
601 @"content-inset": CGInsetMake(4.0, 4.0, 4.0, 10),
602 @"regular-size-height": 59.0,
603 @"small-size-height": 46.0,
605 @"image-item-separator-size": CGRectMake(0.0, 0.0, 2.0, 32.0),
609 - (id)initWithFrame:(CGRect)aFrame
611 self = [
super initWithFrame:aFrame];
620 _additionalItemsButton = [[
CPPopUpButton alloc] initWithFrame:CGRectMake(0.0, 0.0, 10.0, 15.0) pullsDown:YES];
621 [_additionalItemsButton setBordered:NO];
623 [_additionalItemsButton setImagePosition:CPImageOnly];
624 [[_additionalItemsButton menu] setShowsStateColumn:NO];
625 [[_additionalItemsButton menu] setAutoenablesItems:NO];
641 - (void)FIXME_setIsHUD:(BOOL)shouldBeHUD
643 if (_FIXME_isHUD === shouldBeHUD)
646 _FIXME_isHUD = shouldBeHUD;
648 var items = [_toolbar items],
649 count = [items count];
652 [[
self viewForItem:items[count]] FIXME_setIsHUD:shouldBeHUD];
656 - (void)resizeSubviewsWithOldSize:(CGSize)aSize
661 - (_CPToolbarItemView)viewForItem:(CPToolbarItem)anItem
663 return _viewsForToolbarItems[[anItem UID]] || nil;
669 var items = [_toolbar items],
670 itemsWidth = CGRectGetWidth([
self bounds]),
671 minWidth = _minWidth,
673 invisibleItemsSortedByPriority = [];
675 _visibleItems = items;
679 if (itemsWidth < minWidth)
681 itemsWidth -= [self valueForThemeAttribute:
@"extra-item-width"];
683 _visibleItems = [_visibleItems copy];
685 var itemsSortedByVisibilityPriority = [_toolbar itemsSortedByVisibilityPriority],
686 count = itemsSortedByVisibilityPriority.length;
692 while (minWidth > itemsWidth && count)
694 var item = itemsSortedByVisibilityPriority[--count],
695 view = [
self viewForItem:item];
697 minWidth -= [view minSize].
width + [self valueForThemeAttribute:
@"item-margin"];
699 [_visibleItems removeObjectIdenticalTo:item];
700 [invisibleItemsSortedByPriority addObject:item];
702 [view setHidden:YES];
703 [view FIXME_setIsHUD:_FIXME_isHUD];
708 var count = [items count],
713 var view = [
self viewForItem:items[count]],
714 minSize = [view minSize];
716 if (height < minSize.height)
717 height = minSize.height;
723 var contentInset = [
self valueForThemeAttribute:@"content-inset"],
724 newDesiredHeight = height ? height + contentInset.top + contentInset.bottom : 0;
726 if (newDesiredHeight != _toolbar._desiredHeight)
730 _toolbar._desiredHeight = newDesiredHeight;
732 [
self setFrame:[_toolbar _toolbarViewFrame]];
733 [_toolbar._window _noteToolbarChanged];
740 var count = _visibleItems.length,
745 var item = _visibleItems[count],
746 view = [
self viewForItem:item],
747 minSize = [view minSize];
749 if (minSize.width !== [view maxSize].width)
750 [flexibleItemIndexes addIndex:count];
757 [view setFrameSize:CGSizeMake(minSize.width, height)];
762 var remainingSpace = itemsWidth - minWidth,
768 while (remainingSpace && [flexibleItemIndexes count])
771 proportionate += remainingSpace / [flexibleItemIndexes count];
774 remainingSpace = 0.0;
778 while ((index = [flexibleItemIndexes indexGreaterThanIndex:index]) !==
CPNotFound)
780 var item = _visibleItems[index],
781 view = [
self viewForItem:item],
782 proposedWidth = [view minSize].width + proportionate,
783 constrainedWidth = MIN(proposedWidth, [view maxSize].
width);
785 if (constrainedWidth < proposedWidth)
787 [flexibleItemIndexes removeIndex:index];
789 remainingSpace += proposedWidth - constrainedWidth;
792 [view setFrameSize:CGSizeMake(constrainedWidth, height)];
798 count = _visibleItems.length,
799 x = contentInset.left,
800 contentInset = [
self valueForThemeAttribute:@"content-inset"],
801 y = contentInset.top;
803 for (; index < count; ++index)
805 var view = [
self viewForItem:_visibleItems[index]],
806 viewWidth = CGRectGetWidth([view
frame]);
808 [view setFrame:CGRectMake(x, y, viewWidth, height)];
810 x += viewWidth + [self valueForThemeAttribute:
@"item-margin"];
813 var needsAdditionalItemsButton = NO;
815 if ([invisibleItemsSortedByPriority count])
818 count = [items count];
820 _invisibleItems = [];
822 for (; index < count; ++index)
824 var item = items[index];
826 if ([invisibleItemsSortedByPriority indexOfObjectIdenticalTo:item] !==
CPNotFound)
828 [_invisibleItems addObject:item];
830 var identifier = [item itemIdentifier];
832 if (identifier !== CPToolbarSpaceItemIdentifier &&
833 identifier !== CPToolbarFlexibleSpaceItemIdentifier &&
834 identifier !== CPToolbarSeparatorItemIdentifier)
835 needsAdditionalItemsButton = YES;
840 if (needsAdditionalItemsButton)
842 [_additionalItemsButton setFrameOrigin:CGPointMake(itemsWidth + 5.0, (CGRectGetHeight([
self bounds]) - CGRectGetHeight([_additionalItemsButton frame])) / 2.0)];
844 [
self addSubview:_additionalItemsButton];
846 [_additionalItemsButton removeAllItems];
848 [_additionalItemsButton addItemWithTitle:@"Additional Items"];
849 [[_additionalItemsButton itemArray][0] setImage:[
self valueForThemeAttribute:@"extra-item-extra-image"]];
852 count = [_invisibleItems count],
853 hasNonSeparatorItem = NO;
855 for (; index < count; ++index)
857 var item = _invisibleItems[index],
858 identifier = [item itemIdentifier];
860 if (identifier === CPToolbarSpaceItemIdentifier ||
861 identifier === CPToolbarFlexibleSpaceItemIdentifier)
864 if (identifier === CPToolbarSeparatorItemIdentifier)
866 if (hasNonSeparatorItem)
867 [_additionalItemsButton addItem:[
CPMenuItem separatorItem]];
872 hasNonSeparatorItem = YES;
874 var menuItem = [[
CPMenuItem alloc] initWithTitle:[item label] action:@selector(didSelectMenuItem:) keyEquivalent:nil];
876 [menuItem setRepresentedObject:item];
877 [menuItem setImage:[item image]];
878 [menuItem setTarget:self];
879 [menuItem setEnabled:[item isEnabled]];
881 [_additionalItemsButton addItem:menuItem];
885 [_additionalItemsButton removeFromSuperview];
893 - (void)didSelectMenuItem:(
id)aSender
895 var toolbarItem = [aSender representedObject];
897 [CPApp sendAction:[toolbarItem action] to:[toolbarItem target] from:toolbarItem];
900 - (void)reloadToolbarItems
903 var subviews = [
self subviews],
904 count = subviews.length;
907 [subviews[count] removeFromSuperview];
910 var items = [_toolbar items],
913 count = items.length;
915 _minWidth = [
self valueForThemeAttribute:@"item-margin"];
916 _viewsForToolbarItems = { };
918 for (; index < count; ++index)
920 var item = items[index],
921 view = [[_CPToolbarItemView alloc] initWithToolbarItem:item toolbar:self];
923 _viewsForToolbarItems[[item UID]] = view;
925 if ([item toolTip] && [view respondsToSelector:
@selector(setToolTip:)])
926 [view setToolTip:[item toolTip]];
928 [
self addSubview:view];
930 _minWidth += [view minSize].
width + [self valueForThemeAttribute:
@"item-margin"];
936 - (void)layoutSubviews
938 [_additionalItemsButton setAlternateImage:[
self valueForThemeAttribute:@"extra-item-extra-alternate-image"]];
944 var _CPToolbarItemVisibilityPriorityCompare =
function(lhs, rhs)
946 var lhsVisibilityPriority = [lhs visibilityPriority],
947 rhsVisibilityPriority = [rhs visibilityPriority];
949 if (lhsVisibilityPriority == rhsVisibilityPriority)
952 if (lhsVisibilityPriority > rhsVisibilityPriority)
960 @implementation _CPToolbarItemView :
CPControl
966 CPToolbarItem _toolbarItem;
977 - (id)initWithToolbarItem:(CPToolbarItem)aToolbarItem toolbar:(
CPToolbar)aToolbar
983 _toolbarItem = aToolbarItem;
985 _labelField = [[
CPTextField alloc] initWithFrame:CGRectMakeZero()];
988 [_labelField setTextColor:[
self FIXME_labelColor]];
989 [_labelField setTextShadowColor:[
self FIXME_labelShadowColor]];
990 [_labelField setTextShadowOffset:CGSizeMake(0.0, 1.0)];
991 [_labelField setAutoresizingMask:CPViewWidthSizable | CPViewMinXMargin];
993 [
self addSubview:_labelField];
995 [
self updateFromItem];
999 var keyPaths = [@"label", @"image", @"alternateImage", @"minSize", @"maxSize", @"target", @"action", @"enabled"],
1001 count = [keyPaths count];
1003 for (; index < count; ++index)
1006 forKeyPath:keyPaths[index]
1014 - (void)FIXME_setIsHUD:(BOOL)shouldBeHUD
1016 _FIXME_isHUD = shouldBeHUD;
1017 [_labelField setTextColor:[
self FIXME_labelColor]];
1018 [_labelField setTextShadowColor:[
self FIXME_labelShadowColor]];
1021 - (void)updateFromItem
1023 var identifier = [_toolbarItem itemIdentifier];
1025 if (identifier === CPToolbarSpaceItemIdentifier ||
1026 identifier === CPToolbarFlexibleSpaceItemIdentifier ||
1027 identifier === CPToolbarSeparatorItemIdentifier)
1029 [_view removeFromSuperview];
1030 [_imageView removeFromSuperview];
1032 _minSize = [_toolbarItem minSize];
1033 _maxSize = [_toolbarItem maxSize];
1035 if (identifier === CPToolbarSeparatorItemIdentifier)
1037 _view = [[
CPView alloc] initWithFrame:CGRectMakeZero()];
1038 [
self addSubview:_view];
1044 [
self setTarget:[_toolbarItem target]];
1045 [
self setAction:[_toolbarItem action]];
1047 var view = [_toolbarItem view] || nil;
1052 [_view removeFromSuperview];
1056 [
self addSubview:view];
1057 [_imageView removeFromSuperview];
1067 _imageView = [[
CPImageView alloc] initWithFrame:[
self bounds]];
1069 [_imageView setImageScaling:CPImageScaleProportionallyDown];
1071 [
self addSubview:_imageView];
1074 [_imageView setImage:[_toolbarItem image]];
1077 var minSize = [_toolbarItem minSize],
1078 maxSize = [_toolbarItem maxSize];
1080 [_labelField setStringValue:[_toolbarItem label]];
1081 [_labelField sizeToFit];
1083 [
self setEnabled:[_toolbarItem isEnabled]];
1085 _labelSize = [_labelField frame].size;
1089 [_labelField setHidden:iconOnly];
1090 [_view setHidden:labelOnly];
1092 _minSize = CGSizeMake(MAX(_labelSize.width, minSize.width), (labelOnly ? 0 : minSize.height) + (iconOnly ? 0 : _labelSize.height + LABEL_MARGIN));
1093 _maxSize = CGSizeMake(MAX(_labelSize.width, maxSize.width), 100000000.0);
1098 - (void)layoutSubviews
1100 var identifier = [_toolbarItem itemIdentifier];
1102 if (identifier === CPToolbarSpaceItemIdentifier ||
1103 identifier === CPToolbarFlexibleSpaceItemIdentifier)
1106 var bounds = [
self bounds],
1107 width = CGRectGetWidth(bounds);
1109 if (identifier === CPToolbarSeparatorItemIdentifier)
1111 var itemSeparatorColor = [_toolbar valueForThemeAttribute:@"image-item-separator-color"],
1112 itemSeparatorSize = [_toolbar valueForThemeAttribute:@"image-item-separator-size"];
1114 [_view setFrame:CGRectMake(ROUND((width - itemSeparatorSize.size.width) / 2.0), 0.0, itemSeparatorSize.size.width, CGRectGetHeight(bounds))];
1115 [_view setBackgroundColor:itemSeparatorColor];
1121 var view = _view || _imageView,
1122 itemMaxSize = [_toolbarItem maxSize],
1124 height = CGRectGetHeight(bounds) - (iconOnly ? 0 : _labelSize.height),
1126 viewHeight = MIN(itemMaxSize.height, height);
1128 [view setFrame:CGRectMake(ROUND((width - viewWidth) / 2.0),
1129 ROUND((height - viewHeight) / 2.0),
1134 [_labelField setFrameOrigin:CGPointMake(ROUND((width - _labelSize.width) / 2.0), CGRectGetHeight(bounds) - _labelSize.height)];
1137 - (void)mouseDown:(
CPEvent)anEvent
1139 if ([_toolbarItem view])
1140 return [[
self nextResponder] mouseDown:anEvent];
1142 var identifier = [_toolbarItem itemIdentifier];
1144 if (identifier === CPToolbarSpaceItemIdentifier ||
1145 identifier === CPToolbarFlexibleSpaceItemIdentifier ||
1146 identifier === CPToolbarSeparatorItemIdentifier)
1147 return [[
self nextResponder] mouseDown:anEvent];
1149 [
super mouseDown:anEvent];
1152 - (void)setEnabled:(BOOL)shouldBeEnabled
1155 if ([
self isEnabled] === shouldBeEnabled)
1158 [
super setEnabled:shouldBeEnabled];
1160 if (shouldBeEnabled)
1162 [_imageView setAlphaValue:1.0];
1163 [_labelField setAlphaValue:1.0];
1167 [_imageView setAlphaValue:0.5];
1168 [_labelField setAlphaValue:0.5];
1182 - (
CPColor)FIXME_labelShadowColor
1190 - (void)setHighlighted:(BOOL)shouldBeHighlighted
1192 [
super setHighlighted:shouldBeHighlighted];
1194 if (shouldBeHighlighted)
1196 var alternateImage = [_toolbarItem alternateImage];
1199 [_imageView setImage:alternateImage];
1201 [_labelField setTextShadowOffset:CGSizeMakeZero()];
1205 var image = [_toolbarItem image];
1208 [_imageView setImage:image];
1210 [_labelField setTextShadowOffset:CGSizeMake(0.0, 1.0)];
1213 [_labelField setTextShadowColor:[
self FIXME_labelShadowColor]];
1216 - (BOOL)sendAction:(
SEL)anAction to:(
id)aSender
1218 [CPApp sendAction:anAction to:aSender from:_toolbarItem];
1221 - (void)observeValueForKeyPath:(
CPString)aKeyPath
1222 ofObject:(
id)anObject
1224 context:(
id)aContext
1226 if (aKeyPath ===
"enabled")
1227 [
self setEnabled:[anObject isEnabled]];
1229 else if (aKeyPath ===
@"target")
1230 [
self setTarget:[anObject target]];
1232 else if (aKeyPath ===
@"action")
1233 [
self setAction:[anObject action]];
1236 [
self updateFromItem];
1246 - (CPToolbarDisplayMode)displayMode
1248 return _displayMode;
1254 - (void)setDisplayMode:(CPToolbarDisplayMode)aValue
1256 _displayMode = aValue;
1262 - (CPToolbarSizeMode)sizeMode
1270 - (void)setSizeMode:(CPToolbarSizeMode)aValue