Skip to content

Commit

Permalink
Merge branch '0.7b-integration' into 0.7b
Browse files Browse the repository at this point in the history
  • Loading branch information
Francisco Tolmasky committed May 6, 2009
2 parents 864c62b + ae8fd0c commit 120768c
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 7 deletions.
16 changes: 14 additions & 2 deletions AppKit/CPButton.j
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ var _CPButtonClassName = nil,

+ (id)themedAttributes
{
return [CPDictionary dictionaryWithObjects:[_CGInsetMakeZero(), _CGInsetMakeZero(), nil]
forKeys:[@"bezel-inset", @"content-inset", @"bezel-color"]];
return [CPDictionary dictionaryWithObjects:[_CGInsetMakeZero(), _CGInsetMakeZero(), nil, 24.0]
forKeys:[@"bezel-inset", @"content-inset", @"bezel-color", @"default-height"]];
}

- (id)initWithFrame:(CGRect)aFrame
Expand Down Expand Up @@ -374,6 +374,18 @@ var _CPButtonClassName = nil,
return bounds;
}

/*!
Adjust the size of the button to fit the title and surrounding button image.
*/
- (void)sizeToFit
{
var size = [([self title] || " ") sizeWithFont:[self font]],
contentInset = [self currentValueForThemedAttributeName:@"content-inset"],
defaultHeight = [self currentValueForThemedAttributeName:@"default-height"];

[self setFrameSize:CGSizeMake(size.width + contentInset.left + contentInset.right, defaultHeight)];
}

- (CGRect)rectForEphemeralSubviewNamed:(CPString)aName
{
if (aName === "bezel-view")
Expand Down
16 changes: 11 additions & 5 deletions AppKit/CPMenu.j
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ var _CPMenuBarVisible = NO,

// Managing the Menu Bar

+ (void)initialize
{
[[self class] setMenuBarAttributes:[CPDictionary dictionary]];
}

+ (BOOL)menuBarVisible
{
return _CPMenuBarVisible;
Expand Down Expand Up @@ -137,6 +142,7 @@ var _CPMenuBarVisible = NO,
return _CPMenuBarImage;
}


+ (void)setMenuBarAttributes:(CPDictionary)attributes
{
if (_CPMenuBarAttributes == attributes)
Expand All @@ -160,8 +166,8 @@ var _CPMenuBarVisible = NO,

else if (!textColor && !titleColor)
{
[_CPMenuBarAttributes setObject:[CPColor blackColor] forKey:@"CPMenuBarTextColor"];
[_CPMenuBarAttributes setObject:[CPColor blackColor] forKey:@"CPMenuBarTitleColor"];
[_CPMenuBarAttributes setObject:[CPColor colorWithRed:0.051 green:0.2 blue:0.275 alpha:1.0] forKey:@"CPMenuBarTextColor"];
[_CPMenuBarAttributes setObject:[CPColor colorWithRed:0.051 green:0.2 blue:0.275 alpha:1.0] forKey:@"CPMenuBarTitleColor"];
}

if (!textShadowColor && titleShadowColor)
Expand All @@ -172,8 +178,8 @@ var _CPMenuBarVisible = NO,

else if (!textShadowColor && !titleShadowColor)
{
[_CPMenuBarAttributes setObject:[CPColor colorWithWhite:1.0 alpha:0.8] forKey:@"CPMenuBarTextShadowColor"];
[_CPMenuBarAttributes setObject:[CPColor colorWithWhite:1.0 alpha:0.8] forKey:@"CPMenuBarTitleShadowColor"];
[_CPMenuBarAttributes setObject:[CPColor whiteColor] forKey:@"CPMenuBarTextShadowColor"];
[_CPMenuBarAttributes setObject:[CPColor whiteColor] forKey:@"CPMenuBarTitleShadowColor"];
}

if (!highlightColor)
Expand Down Expand Up @@ -1813,7 +1819,7 @@ var _CPMenuBarWindowBackgroundColor = nil,
{
_highlightView = [[CPView alloc] initWithFrame:frame];

[_highlightView setBackgroundColor:_highlightColor];
[_highlightView setBackgroundColor:_highlightColor ? _highlightColor : [CPColor colorWithRed:95.0/255.0 green:131.0/255.0 blue:185.0/255.0 alpha:1.0]];
}
else
[_highlightView setFrame:frame];
Expand Down
6 changes: 6 additions & 0 deletions AppKit/CoreGraphics/CGGeometry.j
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,9 @@ function CGPointFromEvent(anEvent)
{
return _CGPointMake(anEvent.clientX, anEvent.clientY);
}

function CPStringFromInset(anInset)
{
return anInset.top+" "+anInset.left+" "+anInset.bottom+" "+anInset.right;
}

Binary file modified AppKit/Resources/_CPMenuBarWindow/_CPMenuBarWindowBackground.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified AppKit/Resources/_CPMenuWindow/_CPMenuWindow1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified AppKit/Resources/_CPMenuWindow/_CPMenuWindow4.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified AppKit/Resources/_CPMenuWindow/_CPMenuWindow5.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified AppKit/Resources/_CPMenuWindow/_CPMenuWindow7.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified AppKit/Resources/_CPMenuWindow/_CPMenuWindowRounded0.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified AppKit/Resources/_CPMenuWindow/_CPMenuWindowRounded2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified AppKit/Resources/_CPMenuWindow/_CPMenuWindowRounded6.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified AppKit/Resources/_CPMenuWindow/_CPMenuWindowRounded8.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 120768c

Please sign in to comment.