Add focus rings for CPTextFields
@@ -684,8 +684,8 @@ CPTextFieldStatePlaceholder = 1 << 13;
|
||||
- (CGRect)bezelRectForBounds:(CFRect)bounds
|
||||
{
|
||||
var bezelInset = [self currentValueForThemedAttributeName:@"bezel-inset"];
|
||||
|
||||
if (!_CGInsetIsEmpty(bezelInset))
|
||||
|
||||
if (_CGInsetIsEmpty(bezelInset))
|
||||
return bounds;
|
||||
|
||||
bounds.origin.x += bezelInset.left;
|
||||
|
||||
|
After Width: | Height: | Size: 163 B |
|
After Width: | Height: | Size: 804 B |
|
After Width: | Height: | Size: 853 B |
|
After Width: | Height: | Size: 204 B |
|
After Width: | Height: | Size: 136 B |
|
After Width: | Height: | Size: 223 B |
|
After Width: | Height: | Size: 127 B |
|
After Width: | Height: | Size: 109 B |
|
After Width: | Height: | Size: 126 B |
|
After Width: | Height: | Size: 191 B |
|
After Width: | Height: | Size: 126 B |
|
After Width: | Height: | Size: 184 B |
@@ -110,7 +110,7 @@
|
||||
|
||||
+ (CPTextField)themedStandardTextField
|
||||
{
|
||||
var textfield = [[CPTextField alloc] initWithFrame:CGRectMake(0.0, 0.0, 60.0, 22.0)],
|
||||
var textfield = [[CPTextField alloc] initWithFrame:CGRectMake(0.0, 0.0, 60.0, 29.0)],
|
||||
bezelColor = [CPColor colorWithPatternImage:[[CPNinePartImage alloc] initWithImageSlices:
|
||||
[
|
||||
[_CPCibCustomResource imageResourceWithName:"textfield-bezel-square-0.png" size:CGSizeMake(2.0, 3.0)],
|
||||
@@ -122,15 +122,35 @@
|
||||
[_CPCibCustomResource imageResourceWithName:"textfield-bezel-square-6.png" size:CGSizeMake(2.0, 2.0)],
|
||||
[_CPCibCustomResource imageResourceWithName:"textfield-bezel-square-7.png" size:CGSizeMake(1.0, 2.0)],
|
||||
[_CPCibCustomResource imageResourceWithName:"textfield-bezel-square-8.png" size:CGSizeMake(2.0, 2.0)]
|
||||
]]],
|
||||
|
||||
bezelFocusedColor = [CPColor colorWithPatternImage:[[CPNinePartImage alloc] initWithImageSlices:
|
||||
[
|
||||
[_CPCibCustomResource imageResourceWithName:"textfield-bezel-square-focused-0.png" size:CGSizeMake(6.0, 7.0)],
|
||||
[_CPCibCustomResource imageResourceWithName:"textfield-bezel-square-focused-1.png" size:CGSizeMake(1.0, 7.0)],
|
||||
[_CPCibCustomResource imageResourceWithName:"textfield-bezel-square-focused-2.png" size:CGSizeMake(6.0, 7.0)],
|
||||
[_CPCibCustomResource imageResourceWithName:"textfield-bezel-square-focused-3.png" size:CGSizeMake(6.0, 1.0)],
|
||||
[_CPCibCustomResource imageResourceWithName:"textfield-bezel-square-focused-4.png" size:CGSizeMake(1.0, 1.0)],
|
||||
[_CPCibCustomResource imageResourceWithName:"textfield-bezel-square-focused-5.png" size:CGSizeMake(6.0, 1.0)],
|
||||
[_CPCibCustomResource imageResourceWithName:"textfield-bezel-square-focused-6.png" size:CGSizeMake(6.0, 5.0)],
|
||||
[_CPCibCustomResource imageResourceWithName:"textfield-bezel-square-focused-7.png" size:CGSizeMake(1.0, 5.0)],
|
||||
[_CPCibCustomResource imageResourceWithName:"textfield-bezel-square-focused-8.png" size:CGSizeMake(6.0, 5.0)]
|
||||
]]];
|
||||
|
||||
[textfield setBezeled:YES];
|
||||
|
||||
[textfield setValue:bezelColor forThemedAttributeName:@"bezel-color" inControlState:CPControlStateBezeled];
|
||||
[textfield setValue:bezelFocusedColor forThemedAttributeName:@"bezel-color" inControlState:CPControlStateBezeled|CPControlStateEditing];
|
||||
|
||||
[textfield setValue:[CPFont systemFontOfSize:12.0] forThemedAttributeName:@"font"];
|
||||
[textfield setValue:CGInsetMake(5.0, 4.0, 2.0, 3.0) forThemedAttributeName:@"content-inset" inControlState:CPControlStateBezeled];
|
||||
|
||||
|
||||
[textfield setValue:CGInsetMake(9.0, 8.0, 5.0, 7.0) forThemedAttributeName:@"content-inset" inControlState:CPControlStateBezeled];
|
||||
|
||||
[textfield setValue:CGInsetMake(4.0, 4.0, 3.0, 4.0) forThemedAttributeName:@"bezel-inset" inControlState:CPControlStateBezeled];
|
||||
[textfield setValue:CGInsetMake(0.0, 0.0, 0.0, 0.0) forThemedAttributeName:@"bezel-inset" inControlState:CPControlStateBezeled|CPControlStateEditing];
|
||||
|
||||
[textfield setValue:[CPColor colorWithCalibratedRed:189.0 / 255.0 green:199.0 / 255.0 blue:211.0 / 255.0 alpha:1.0] forThemedAttributeName:@"text-color" inControlState:CPTextFieldStatePlaceholder];
|
||||
|
||||
|
||||
[textfield setPlaceholderString:"cheese cheese"];
|
||||
[textfield setStringValue:""];
|
||||
[textfield setEditable:YES];
|
||||
@@ -140,22 +160,35 @@
|
||||
|
||||
+ (CPTextField)themedRoundedTextField
|
||||
{
|
||||
var textfield = [[CPTextField alloc] initWithFrame:CGRectMake(0.0, 0.0, 60.0, 22.0)],
|
||||
var textfield = [[CPTextField alloc] initWithFrame:CGRectMake(0.0, 0.0, 60.0, 30.0)],
|
||||
bezelColor = [CPColor colorWithPatternImage:[[CPThreePartImage alloc] initWithImageSlices:
|
||||
[
|
||||
[_CPCibCustomResource imageResourceWithName:"textfield-bezel-rounded-left.png" size:CGSizeMake(13.0, 22.0)],
|
||||
[_CPCibCustomResource imageResourceWithName:"textfield-bezel-rounded-center.png" size:CGSizeMake(1.0, 22.0)],
|
||||
[_CPCibCustomResource imageResourceWithName:"textfield-bezel-rounded-right.png" size:CGSizeMake(13.0, 22.0)]
|
||||
] isVertical:NO]],
|
||||
|
||||
bezelFocusedColor = [CPColor colorWithPatternImage:[[CPThreePartImage alloc] initWithImageSlices:
|
||||
[
|
||||
[_CPCibCustomResource imageResourceWithName:"textfield-bezel-rounded-focused-left.png" size:CGSizeMake(17.0, 30.0)],
|
||||
[_CPCibCustomResource imageResourceWithName:"textfield-bezel-rounded-focused-center.png" size:CGSizeMake(1.0, 30.0)],
|
||||
[_CPCibCustomResource imageResourceWithName:"textfield-bezel-rounded-focused-right.png" size:CGSizeMake(17.0, 30.0)]
|
||||
] isVertical:NO]];
|
||||
|
||||
[textfield setBezeled:YES];
|
||||
[textfield setBezelStyle:CPTextFieldRoundedBezel];
|
||||
|
||||
[textfield setValue:bezelColor forThemedAttributeName:@"bezel-color" inControlState:CPControlStateBezeled | CPTextFieldStateRounded];
|
||||
[textfield setValue:bezelFocusedColor forThemedAttributeName:@"bezel-color" inControlState:CPControlStateBezeled | CPTextFieldStateRounded | CPControlStateEditing];
|
||||
|
||||
[textfield setValue:[CPFont systemFontOfSize:12.0] forThemedAttributeName:@"font"];
|
||||
[textfield setValue:CGInsetMake(5.0, 10.0, 2.0, 10.0) forThemedAttributeName:@"content-inset" inControlState:CPControlStateBezeled | CPTextFieldStateRounded];
|
||||
|
||||
[textfield setValue:CGInsetMake(9.0, 14.0, 6.0, 14.0) forThemedAttributeName:@"content-inset" inControlState:CPControlStateBezeled | CPTextFieldStateRounded];
|
||||
|
||||
[textfield setValue:CGInsetMake(4.0, 4.0, 4.0, 4.0) forThemedAttributeName:@"bezel-inset" inControlState:CPControlStateBezeled|CPTextFieldStateRounded];
|
||||
[textfield setValue:CGInsetMake(0.0, 0.0, 0.0, 0.0) forThemedAttributeName:@"bezel-inset" inControlState:CPControlStateBezeled|CPTextFieldStateRounded|CPControlStateEditing];
|
||||
|
||||
[textfield setValue:[CPColor colorWithCalibratedRed:189.0 / 255.0 green:199.0 / 255.0 blue:211.0 / 255.0 alpha:1.0] forThemedAttributeName:@"text-color" inControlState:CPTextFieldStatePlaceholder];
|
||||
|
||||
|
||||
[textfield setPlaceholderString:"cheese cheese"];
|
||||
[textfield setStringValue:""];
|
||||
[textfield setEditable:YES];
|
||||
|
||||