mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 04:57:03 +00:00
New: Adds a new theme parameter "menu-offset" to CPPopUpButton instead of hard coded value (#2923)
This commit is contained in:
+11
-2
@@ -45,6 +45,13 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
|
||||
return "popup-button";
|
||||
}
|
||||
|
||||
+ (CPDictionary)themeAttributes
|
||||
{
|
||||
return @{
|
||||
@"menu-offset": CGSizeMake(0, 0)
|
||||
};
|
||||
}
|
||||
|
||||
+ (CPSet)keyPathsForValuesAffectingSelectedIndex
|
||||
{
|
||||
return [CPSet setWithObject:@"objectValue"];
|
||||
@@ -685,14 +692,16 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
|
||||
if ([self pullsDown])
|
||||
{
|
||||
var positionedItem = nil,
|
||||
location = CGPointMake(0.0, CGRectGetMaxY(bounds) - 1);
|
||||
menuOffset = [self currentValueForThemeAttribute:@"menu-offset"],
|
||||
location = CGPointMake(menuOffset.width, CGRectGetMaxY(bounds) + menuOffset.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
var contentRect = [self contentRectForBounds:bounds],
|
||||
positionedItem = [self selectedItem],
|
||||
standardLeftMargin = [_CPMenuWindow _standardLeftMargin] + [_CPMenuItemStandardView _standardLeftMargin],
|
||||
location = CGPointMake(CGRectGetMinX(contentRect) - standardLeftMargin, 0.0);
|
||||
menuOffset = [self currentValueForThemeAttribute:@"menu-offset"],
|
||||
location = CGPointMake(CGRectGetMinX(contentRect) - standardLeftMargin + menuOffset.width, menuOffset.height);
|
||||
|
||||
minimumWidth += standardLeftMargin;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user