Improvements on rounded textviews. Indentation seems broken

This commit is contained in:
michael starke
2013-06-02 19:12:09 +02:00
parent 4052c5b306
commit 8c4383b4d1
5 changed files with 43 additions and 82 deletions

View File

@@ -107,6 +107,7 @@
<string key="NSCellIdentifier">_NS:9</string>
<reference key="NSControlView" ref="290763686"/>
<bool key="NSDrawsBackground">YES</bool>
<int key="NSTextBezelStyle">1</int>
<object class="NSColor" key="NSBackgroundColor" id="955209345">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
@@ -295,7 +296,6 @@
<string key="NSFrame">{{199, 289}, {32, 25}}</string>
<reference key="NSSuperview" ref="87082330"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:22</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="353877023">
@@ -1553,6 +1553,7 @@
<string key="493.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="494.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="495.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="496.CustomClassName">MPRoundedTextFieldCell</string>
<string key="496.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="497.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="498.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -1680,6 +1681,14 @@
<string key="minorKey">./Classes/MPPopupImageView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">MPRoundedTextFieldCell</string>
<string key="superclassName">NSTextFieldCell</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/MPRoundedTextFieldCell.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">MPSeparator</string>
<string key="superclassName">NSView</string>

View File

@@ -8,20 +8,44 @@
#import "MPRoundedTextFieldCell.h"
#define CORNER_RADIUS 10.0
#define CORNER_RADIUS 3.0
@implementation MPRoundedTextFieldCell
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:cellFrame xRadius:CORNER_RADIUS yRadius:CORNER_RADIUS];
[[NSColor clearColor] set];
NSRectFill(cellFrame);
[[NSColor blackColor] setStroke];
NSRect pathRect = NSInsetRect(cellFrame, 0.5, 0.5);
NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:pathRect xRadius:CORNER_RADIUS yRadius:CORNER_RADIUS];
[([self isEnabled] ? [NSColor colorWithCalibratedWhite:0.55 alpha:1] : [NSColor colorWithCalibratedWhite:0.75 alpha:1]) setStroke];
[[NSColor whiteColor] setFill];
[path fill];
[path stroke];
//[super drawWithFrame:cellFrame inView:controlView];
[NSGraphicsContext saveGraphicsState];
NSShadow *shadow = [[NSShadow alloc] init];
[shadow setShadowColor:[NSColor colorWithCalibratedWhite:0.8 alpha:1]];
[shadow setShadowOffset:NSMakeSize(0, -1)];
[shadow setShadowBlurRadius:2];
[shadow set];
[path setClip];
[path stroke];
[shadow release];
[NSGraphicsContext restoreGraphicsState];
[path stroke];
//[shadow release];
[super drawInteriorWithFrame:cellFrame inView:controlView];
}
- (void)drawFocusRingMaskWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
NSLog(@"drawFocusRing");
//NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:cellFrame xRadius:CORNER_RADIUS yRadius:CORNER_RADIUS];
//[path stroke];
[super drawFocusRingMaskWithFrame:cellFrame inView:controlView];
}
- (NSRect)focusRingMaskBoundsForFrame:(NSRect)cellFrame inView:(NSView *)controlView {
return [controlView bounds];
}
@end

View File

@@ -11,7 +11,6 @@
@implementation MPSeparator
- (void)drawRect:(NSRect)dirtyRect {
NSRect bounds = [self bounds];
[[NSColor lightGrayColor] set];
NSRectFill(NSMakeRect(0, 1, NSWidth(bounds), 1));

View File

@@ -46,7 +46,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>796</string>
<string>7F1</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSHumanReadableCopyright</key>

View File

@@ -51,7 +51,6 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{96, 175}, {184, 17}}</string>
<reference key="NSSuperview" ref="1005"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="662046682"/>
<string key="NSReuseIdentifierKey">_NS:1535</string>
<bool key="NSEnabled">YES</bool>
@@ -100,7 +99,6 @@
</set>
<string key="NSFrame">{{157, 200}, {48, 48}}</string>
<reference key="NSSuperview" ref="1005"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="660673733"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
@@ -125,7 +123,6 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{127, 50}, {82, 32}}</string>
<reference key="NSSuperview" ref="1005"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="769513826"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
@@ -154,7 +151,6 @@
</set>
<string key="NSFrame">{{83, 94}, {197, 22}}</string>
<reference key="NSSuperview" ref="1005"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="132133585"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
@@ -179,7 +175,6 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{86, 123}, {191, 22}}</string>
<reference key="NSSuperview" ref="1005"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="333885704"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
@@ -217,7 +212,6 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{17, 126}, {64, 17}}</string>
<reference key="NSSuperview" ref="1005"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="219521947"/>
<string key="NSReuseIdentifierKey">_NS:1535</string>
<bool key="NSEnabled">YES</bool>
@@ -238,7 +232,6 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{35, 99}, {46, 17}}</string>
<reference key="NSSuperview" ref="1005"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="1034097047"/>
<string key="NSReuseIdentifierKey">_NS:1535</string>
<bool key="NSEnabled">YES</bool>
@@ -259,7 +252,6 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{209, 50}, {74, 32}}</string>
<reference key="NSSuperview" ref="1005"/>
<reference key="NSWindow"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<string key="NSHuggingPriority">{250, 250}</string>
<bool key="NSEnabled">YES</bool>
@@ -282,7 +274,6 @@
</array>
<string key="NSFrameSize">{362, 268}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="204058255"/>
<string key="NSAntiCompressionPriority">{751, 750}</string>
<string key="NSClassName">NSView</string>
@@ -1096,69 +1087,7 @@
<nil key="sourceID"/>
<int key="maxID">295</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">MPPasswordInputController</string>
<string key="superclassName">MPViewController</string>
<object class="NSMutableDictionary" key="actions">
<string key="NS.key.0">_decrypt:</string>
<string key="NS.object.0">id</string>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<string key="NS.key.0">_decrypt:</string>
<object class="IBActionInfo" key="NS.object.0">
<string key="name">_decrypt:</string>
<string key="candidateClassName">id</string>
</object>
</object>
<dictionary class="NSMutableDictionary" key="outlets">
<string key="errorImageView">NSImageView</string>
<string key="errorInfoTextField">NSTextField</string>
<string key="keyPathControl">NSPathControl</string>
<string key="passwordTextField">NSSecureTextField</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
<object class="IBToOneOutletInfo" key="errorImageView">
<string key="name">errorImageView</string>
<string key="candidateClassName">NSImageView</string>
</object>
<object class="IBToOneOutletInfo" key="errorInfoTextField">
<string key="name">errorInfoTextField</string>
<string key="candidateClassName">NSTextField</string>
</object>
<object class="IBToOneOutletInfo" key="keyPathControl">
<string key="name">keyPathControl</string>
<string key="candidateClassName">NSPathControl</string>
</object>
<object class="IBToOneOutletInfo" key="passwordTextField">
<string key="name">passwordTextField</string>
<string key="candidateClassName">NSSecureTextField</string>
</object>
</dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/MPPasswordInputController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">MPViewController</string>
<string key="superclassName">NSViewController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/MPViewController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSLayoutConstraint</string>
<string key="superclassName">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/NSLayoutConstraint.h</string>
</object>
</object>
</array>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes"/>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>