Used Bindings in outline view

This commit is contained in:
michael starke
2013-06-02 00:58:33 +02:00
parent b81ec2128b
commit 4052c5b306
5 changed files with 16 additions and 15 deletions

View File

@@ -295,6 +295,7 @@
<string key="NSFrame">{{199, 289}, {32, 25}}</string> <string key="NSFrame">{{199, 289}, {32, 25}}</string>
<reference key="NSSuperview" ref="87082330"/> <reference key="NSSuperview" ref="87082330"/>
<reference key="NSWindow"/> <reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:22</string> <string key="NSReuseIdentifierKey">_NS:22</string>
<bool key="NSEnabled">YES</bool> <bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="353877023"> <object class="NSButtonCell" key="NSCell" id="353877023">
@@ -1552,7 +1553,6 @@
<string key="493.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="493.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="494.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="495.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="496.CustomClassName">MPRoundedTextFieldCell</string>
<string key="496.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="496.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="497.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="497.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="498.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="498.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -1600,7 +1600,7 @@
<nil key="activeLocalization"/> <nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/> <dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/> <nil key="sourceID"/>
<int key="maxID">565</int> <int key="maxID">628</int>
</object> </object>
<object class="IBClassDescriber" key="IBDocument.Classes"> <object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions"> <array class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -1680,14 +1680,6 @@
<string key="minorKey">./Classes/MPPopupImageView.h</string> <string key="minorKey">./Classes/MPPopupImageView.h</string>
</object> </object>
</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"> <object class="IBPartialClassDescription">
<string key="className">MPSeparator</string> <string key="className">MPSeparator</string>
<string key="superclassName">NSView</string> <string key="superclassName">NSView</string>

View File

@@ -73,6 +73,7 @@
[self.outlineView setDelegate:self.outlineDelegate]; [self.outlineView setDelegate:self.outlineDelegate];
[self.outlineView setMenu:[self _contextMenu]]; [self.outlineView setMenu:[self _contextMenu]];
[self.outlineView setAllowsEmptySelection:YES]; [self.outlineView setAllowsEmptySelection:YES];
[self.outlineView setFloatsGroupRows:NO];
NSView *myView = [self view]; NSView *myView = [self view];
self.showConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:[myView(>=100,<=250)]" self.showConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:[myView(>=100,<=250)]"

View File

@@ -28,13 +28,13 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
NSTableCellView *view; NSTableCellView *view;
if(![group parent]) { if(![group parent]) {
view = [outlineView makeViewWithIdentifier:_MPOutlinveViewHeaderViewIdentifier owner:self]; view = [outlineView makeViewWithIdentifier:_MPOutlinveViewHeaderViewIdentifier owner:self];
[view.textField setStringValue:[group name]]; [view.textField bind:NSValueBinding toObject:group withKeyPath:@"name" options:nil];
} }
else { else {
view = [outlineView makeViewWithIdentifier:_MPOutlineViewDataViewIdentifier owner:self]; view = [outlineView makeViewWithIdentifier:_MPOutlineViewDataViewIdentifier owner:self];
NSImage *icon = [MPIconHelper icon:(MPIconType)[group image]]; NSImage *icon = [MPIconHelper icon:(MPIconType)[group image]];
[view.imageView setImage:icon]; [view.imageView setImage:icon];
[view.textField setStringValue:[group name]]; [view.textField bind:NSValueBinding toObject:group withKeyPath:@"name" options:nil];
} }

View File

@@ -8,12 +8,20 @@
#import "MPRoundedTextFieldCell.h" #import "MPRoundedTextFieldCell.h"
#define CORNER_RADIUS 5.0 #define CORNER_RADIUS 10.0
@implementation MPRoundedTextFieldCell @implementation MPRoundedTextFieldCell
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView { - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
[super drawWithFrame:cellFrame inView:controlView]; NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:cellFrame xRadius:CORNER_RADIUS yRadius:CORNER_RADIUS];
[[NSColor clearColor] set];
NSRectFill(cellFrame);
[[NSColor blackColor] setStroke];
[[NSColor whiteColor] setFill];
[path fill];
[path stroke];
//[super drawWithFrame:cellFrame inView:controlView];
} }
@end @end

View File

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