mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-07 17:38:02 +00:00
Added -setMinimumWidth/minimumWidth to CPMenu.
Reviewed by me.
This commit is contained in:
1 parent
a7010e7598
commit
b82c307007
3 files changed
+24
-2
No files matched your search
@@ -253,6 +253,8 @@ var _CPMenuBarVisible = NO,
|
||||
|
||||
_autoenablesItems = YES;
|
||||
_showsStateColumn = YES;
|
||||
|
||||
[self setMinimumWidth:0];
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -649,6 +651,16 @@ var _CPMenuBarVisible = NO,
|
||||
return _title;
|
||||
}
|
||||
|
||||
- (void)setMinimumWidth:(float)aMinimumWidth
|
||||
{
|
||||
_minimumWidth = aMinimumWidth;
|
||||
}
|
||||
|
||||
- (float)minimumWidth
|
||||
{
|
||||
return _minimumWidth;
|
||||
}
|
||||
|
||||
//
|
||||
- (void)popUpMenuPositioningItem:(CPMenuItem)anItem atLocation:(CGPoint)aLocation inView:(CPView)aView callback:(Function)aCallback
|
||||
{
|
||||
@@ -965,6 +977,8 @@ var CPMenuTitleKey = @"CPMenuTitleKey",
|
||||
[self _setMenuName:[aCoder decodeObjectForKey:CPMenuNameKey]];
|
||||
|
||||
_showsStateColumn = ![aCoder containsValueForKey:CPMenuShowsStateColumnKey] || [aCoder decodeBoolForKey:CPMenuShowsStateColumnKey];
|
||||
|
||||
[self setMinimumWidth:0];
|
||||
}
|
||||
|
||||
return self;
|
||||
|
||||
@@ -63,6 +63,7 @@ var STICKY_TIME_INTERVAL = 500,
|
||||
|
||||
[menuWindow setFont:aFont];
|
||||
[menuWindow setMenu:aMenu];
|
||||
[menuWindow setMinWidth:[aMenu minimumWidth]];
|
||||
|
||||
return menuWindow;
|
||||
}
|
||||
@@ -210,8 +211,8 @@ var STICKY_TIME_INTERVAL = 500,
|
||||
|
||||
- (void)setMinWidth:(float)aWidth
|
||||
{
|
||||
var size = [self frame].size;
|
||||
|
||||
var size = [self unconstrainedFrame].size;
|
||||
|
||||
[self setFrameSize:CGSizeMake(MAX(size.width, aWidth), size.height)];
|
||||
}
|
||||
|
||||
@@ -276,6 +277,11 @@ var STICKY_TIME_INTERVAL = 500,
|
||||
[super setFrame:_CGRectMake(aPoint.x, aPoint.y, _CGRectGetWidth(_unconstrainedFrame), _CGRectGetHeight(_unconstrainedFrame))];
|
||||
}
|
||||
|
||||
- (void)setFrameSize:(CGSize)aSize
|
||||
{
|
||||
[super setFrame:_CGRectMake(_CGRectGetMinX(_unconstrainedFrame), _CGRectGetMinY(_unconstrainedFrame), aSize.width, aSize.height)];
|
||||
}
|
||||
|
||||
- (void)setFrame:(CGRect)aFrame display:(BOOL)shouldDisplay animate:(BOOL)shouldAnimate
|
||||
{
|
||||
// FIXME: There are integral window issues with platform windows.
|
||||
|
||||
@@ -654,6 +654,8 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
|
||||
location = CGPointMake(0.0, 0.0);
|
||||
}
|
||||
|
||||
[[self menu] setMinimumWidth:CGRectGetWidth(bounds)];
|
||||
|
||||
[[self menu]
|
||||
popUpMenuPositioningItem:positionedItem
|
||||
atLocation:location
|
||||
|
||||
Reference in new issue
Block a user