mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 13:07:02 +00:00
Fix for properly positioning pop up button menus.
Reviewed by me.
This commit is contained in:
@@ -58,6 +58,11 @@ var SUBMENU_INDICATOR_COLOR = nil,
|
||||
return [[self alloc] init];
|
||||
}
|
||||
|
||||
+ (float)_standardLeftMargin
|
||||
{
|
||||
return LEFT_MARGIN + STATE_COLUMN_WIDTH;
|
||||
}
|
||||
|
||||
- (id)initWithFrame:(CGRect)aFrame
|
||||
{
|
||||
self = [super initWithFrame:aFrame];
|
||||
|
||||
@@ -641,7 +641,8 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
|
||||
|
||||
[self highlight:YES];
|
||||
|
||||
var bounds = [self bounds];
|
||||
var bounds = [self bounds],
|
||||
minimumWidth = CGRectGetWidth(bounds);
|
||||
|
||||
if ([self pullsDown])
|
||||
{
|
||||
@@ -650,11 +651,15 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
|
||||
}
|
||||
else
|
||||
{
|
||||
var positionedItem = [self selectedItem],
|
||||
location = CGPointMake(0.0, 0.0);
|
||||
var contentRect = [self contentRectForBounds:bounds],
|
||||
positionedItem = [self selectedItem],
|
||||
standardLeftMargin = [_CPMenuItemStandardView _standardLeftMargin],
|
||||
location = CGPointMake(CGRectGetMinX(contentRect) - standardLeftMargin, 0.0);
|
||||
|
||||
minimumWidth += standardLeftMargin;
|
||||
}
|
||||
|
||||
[[self menu] setMinimumWidth:CGRectGetWidth(bounds)];
|
||||
[[self menu] setMinimumWidth:minimumWidth];
|
||||
|
||||
[[self menu]
|
||||
popUpMenuPositioningItem:positionedItem
|
||||
|
||||
@@ -177,8 +177,8 @@ var BKLearnMoreToolbarItemIdentifier = @"BKLearnMoreToolbarItemId
|
||||
|
||||
var width = CGRectGetWidth([popUpButton frame]);
|
||||
|
||||
[toolbarItem setMinSize:CGSizeMake(width + 20.0, 32.0)];
|
||||
[toolbarItem setMaxSize:CGSizeMake(width + 20.0, 32.0)];
|
||||
[toolbarItem setMinSize:CGSizeMake(width + 20.0, 24.0)];
|
||||
[toolbarItem setMaxSize:CGSizeMake(width + 20.0, 24.0)];
|
||||
}
|
||||
|
||||
else if (anItemIdentifier === BKBackgroundColorToolbarItemIdentifier)
|
||||
@@ -206,8 +206,8 @@ var BKLearnMoreToolbarItemIdentifier = @"BKLearnMoreToolbarItemId
|
||||
|
||||
var width = CGRectGetWidth([popUpButton frame]);
|
||||
|
||||
[toolbarItem setMinSize:CGSizeMake(width, 32.0)];
|
||||
[toolbarItem setMaxSize:CGSizeMake(width, 32.0)];
|
||||
[toolbarItem setMinSize:CGSizeMake(width, 24.0)];
|
||||
[toolbarItem setMaxSize:CGSizeMake(width, 24.0)];
|
||||
}
|
||||
else if (anItemIdentifier === BKLearnMoreToolbarItemIdentifier)
|
||||
{
|
||||
@@ -227,8 +227,8 @@ var BKLearnMoreToolbarItemIdentifier = @"BKLearnMoreToolbarItemId
|
||||
|
||||
var width = CGRectGetWidth([button frame]);
|
||||
|
||||
[toolbarItem setMinSize:CGSizeMake(width, 32.0)];
|
||||
[toolbarItem setMaxSize:CGSizeMake(width, 32.0)];
|
||||
[toolbarItem setMinSize:CGSizeMake(width, 24.0)];
|
||||
[toolbarItem setMaxSize:CGSizeMake(width, 24.0)];
|
||||
}
|
||||
|
||||
return toolbarItem;
|
||||
|
||||
Reference in New Issue
Block a user