mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-15 03:03:50 +00:00
Add default button style
This commit is contained in:
1 parent
0c63a5aba4
commit
acb1929b49
9 files changed
+40
-1
No files matched your search
@@ -431,6 +431,20 @@ var _CPButtonClassName = nil,
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setDefaultButton:(BOOL)shouldBeDefaultButton
|
||||
{
|
||||
if ((!!(_controlState & CPControlStateDefault)) === shouldBeDefaultButton)
|
||||
return;
|
||||
|
||||
if (shouldBeDefaultButton)
|
||||
_controlState |= CPControlStateDefault;
|
||||
else
|
||||
_controlState &= ~CPControlStateDefault;
|
||||
|
||||
[self setNeedsLayout];
|
||||
[self setNeedsDisplay:YES];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation CPButton (NS)
|
||||
|
||||
@@ -1721,7 +1721,11 @@ CPTexturedBackgroundWindowMask
|
||||
|
||||
- (void)setDefaultButton:(CPButton)aButton
|
||||
{
|
||||
[_defaultButton setDefaultButton:NO];
|
||||
|
||||
_defaultButton = aButton;
|
||||
|
||||
[_defaultButton setDefaultButton:YES];
|
||||
}
|
||||
|
||||
- (CPButton)defaultButton
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 151 B |
Binary file not shown.
|
After Width: | Height: | Size: 150 B |
Binary file not shown.
|
After Width: | Height: | Size: 250 B |
Binary file not shown.
|
After Width: | Height: | Size: 261 B |
Binary file not shown.
|
After Width: | Height: | Size: 260 B |
Binary file not shown.
|
After Width: | Height: | Size: 260 B |
@@ -173,7 +173,7 @@
|
||||
[_CPCibCustomResource imageResourceWithName:"button-bezel-center.png" size:CGSizeMake(1.0, 24.0)],
|
||||
[_CPCibCustomResource imageResourceWithName:"button-bezel-right.png" size:CGSizeMake(4.0, 24.0)]
|
||||
]
|
||||
isVertical:NO]];
|
||||
isVertical:NO]],
|
||||
|
||||
highlightedBezelColor = [CPColor colorWithPatternImage:[[CPThreePartImage alloc] initWithImageSlices:
|
||||
[
|
||||
@@ -181,7 +181,24 @@
|
||||
[_CPCibCustomResource imageResourceWithName:"button-bezel-highlighted-center.png" size:CGSizeMake(1.0, 24.0)],
|
||||
[_CPCibCustomResource imageResourceWithName:"button-bezel-highlighted-right.png" size:CGSizeMake(4.0, 24.0)]
|
||||
]
|
||||
isVertical:NO]],
|
||||
|
||||
defaultBezelColor = [CPColor colorWithPatternImage:[[CPThreePartImage alloc] initWithImageSlices:
|
||||
[
|
||||
[_CPCibCustomResource imageResourceWithName:"default-button-bezel-left.png" size:CGSizeMake(4.0, 24.0)],
|
||||
[_CPCibCustomResource imageResourceWithName:"default-button-bezel-center.png" size:CGSizeMake(1.0, 24.0)],
|
||||
[_CPCibCustomResource imageResourceWithName:"default-button-bezel-right.png" size:CGSizeMake(4.0, 24.0)]
|
||||
]
|
||||
isVertical:NO]],
|
||||
|
||||
defaultHighlightedBezelColor = [CPColor colorWithPatternImage:[[CPThreePartImage alloc] initWithImageSlices:
|
||||
[
|
||||
[_CPCibCustomResource imageResourceWithName:"default-button-bezel-highlighted-left.png" size:CGSizeMake(4.0, 24.0)],
|
||||
[_CPCibCustomResource imageResourceWithName:"default-button-bezel-highlighted-center.png" size:CGSizeMake(1.0, 24.0)],
|
||||
[_CPCibCustomResource imageResourceWithName:"default-button-bezel-highlighted-right.png" size:CGSizeMake(4.0, 24.0)]
|
||||
]
|
||||
isVertical:NO]];
|
||||
|
||||
|
||||
[button setTitle:@"Cancel"];
|
||||
|
||||
@@ -195,6 +212,10 @@
|
||||
[button setValue:highlightedBezelColor forThemedAttributeName:@"bezel-color" inControlState:CPControlStateBordered|CPControlStateHighlighted];
|
||||
[button setValue:CGInsetMake(0.0, 5.0, 0.0, 5.0) forThemedAttributeName:@"content-inset" inControlState:CPControlStateBordered];
|
||||
|
||||
[button setValue:defaultBezelColor forThemedAttributeName:@"bezel-color" inControlState:CPControlStateBordered|CPControlStateDefault];
|
||||
[button setValue:defaultHighlightedBezelColor forThemedAttributeName:@"bezel-color" inControlState:CPControlStateBordered|CPControlStateHighlighted|CPControlStateDefault];
|
||||
[button setValue:[CPColor colorWithCalibratedRed:13.0/255.0 green:51.0/255.0 blue:70.0/255.0 alpha:1.0] forThemedAttributeName:@"text-color" inControlState:CPControlStateDefault];
|
||||
|
||||
[button setValue:24.0 forThemedAttributeName:@"default-height"];
|
||||
|
||||
return button;
|
||||
|
||||
Reference in new issue
Block a user