Skip to content

Commit

Permalink
Allow toolbar size to be changed even after the toolbar has been crea…
Browse files Browse the repository at this point in the history
…ted.
  • Loading branch information
aljungberg committed Feb 24, 2012
1 parent 98e54d2 commit a16388b
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions AppKit/CPToolbar.j
Expand Up @@ -95,6 +95,7 @@ var TOOLBAR_REGULAR_HEIGHT = 59.0,
BOOL _showsBaselineSeparator;
BOOL _allowsUserCustomization;
BOOL _isVisible;
int _sizeMode @accessors(property=sizeMode);

id _delegate;

Expand All @@ -108,8 +109,6 @@ var TOOLBAR_REGULAR_HEIGHT = 59.0,
CPArray _items;
CPArray _itemsSortedByVisibilityPriority;

int _sizeMode @accessors(property=sizeMode);

CPView _toolbarView;
CPWindow _window;
}
Expand Down Expand Up @@ -213,6 +212,16 @@ var TOOLBAR_REGULAR_HEIGHT = 59.0,
[_window _noteToolbarChanged];
}

- (void)setSizeMode:(CPToolbarSizeMode)aSize
{
if (aSize === _sizeMode)
return;
_sizeMode = aSize;

[[self _toolbarView] setFrame:[self _toolbarViewFrame]];
[_window _noteToolbarChanged];
}

- (CPWindow)_window
{
return _window;
Expand Down Expand Up @@ -243,12 +252,17 @@ var TOOLBAR_REGULAR_HEIGHT = 59.0,

}

- (CGRect)_toolbarViewFrame
{
return CPRectMake(0.0, 0.0, 1200.0, _sizeMode != CPToolbarSizeModeSmall ? TOOLBAR_REGULAR_HEIGHT : TOOLBAR_SMALL_HEIGHT);
}

/* @ignore */
- (CPView)_toolbarView
{
if (!_toolbarView)
{
_toolbarView = [[_CPToolbarView alloc] initWithFrame:CPRectMake(0.0, 0.0, 1200.0, _sizeMode != CPToolbarSizeModeSmall ? TOOLBAR_REGULAR_HEIGHT : TOOLBAR_SMALL_HEIGHT)];
_toolbarView = [[_CPToolbarView alloc] initWithFrame:[self _toolbarViewFrame]];

[_toolbarView setToolbar:self];
[_toolbarView setAutoresizingMask:CPViewWidthSizable];
Expand Down

0 comments on commit a16388b

Please sign in to comment.