Introduced auto-expansion on Outlineview

This commit is contained in:
michael starke
2013-06-08 11:14:18 +02:00
parent fab145ce77
commit 2470f70391
5 changed files with 18 additions and 10 deletions

View File

@@ -348,7 +348,7 @@
<reference key="NSWindow"/> <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="736877784"/> <reference key="NSNextKeyView" ref="736877784"/>
<string key="NSReuseIdentifierKey">_NS:9</string> <string key="NSReuseIdentifierKey">_NS:9</string>
<int key="NSsFlags">154160</int> <int key="NSsFlags">133680</int>
<reference key="NSVScroller" ref="1037276411"/> <reference key="NSVScroller" ref="1037276411"/>
<reference key="NSHScroller" ref="802411427"/> <reference key="NSHScroller" ref="802411427"/>
<reference key="NSContentView" ref="262664416"/> <reference key="NSContentView" ref="262664416"/>

View File

@@ -76,6 +76,8 @@
[self.outlineView setMenu:[self _contextMenu]]; [self.outlineView setMenu:[self _contextMenu]];
[self.outlineView setAllowsEmptySelection:YES]; [self.outlineView setAllowsEmptySelection:YES];
[self.outlineView setFloatsGroupRows:NO]; [self.outlineView setFloatsGroupRows:NO];
[self.outlineView setDraggingSourceOperationMask:NSDragOperationEvery forLocal:YES];
NSView *myView = [self view]; NSView *myView = [self view];
self.showConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:[myView(>=100,<=250)]" self.showConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:[myView(>=100,<=250)]"
@@ -96,10 +98,8 @@
[_treeController setChildrenKeyPath:@"groups"]; [_treeController setChildrenKeyPath:@"groups"];
[_treeController bind:NSContentBinding toObject:document withKeyPath:@"root" options:nil]; [_treeController bind:NSContentBinding toObject:document withKeyPath:@"root" options:nil];
[_outlineView bind:NSContentBinding toObject:_treeController withKeyPath:@"arrangedObjects" options:nil]; [_outlineView bind:NSContentBinding toObject:_treeController withKeyPath:@"arrangedObjects" options:nil];
NSTreeNode *node = [_outlineView itemAtRow:0];
[self.outlineView reloadData]; [_outlineView expandItem:node expandChildren:NO];
//MPDocument *document = [[NSDocumentController sharedDocumentController] currentDocument];
[self.outlineView expandItem:document.root expandChildren:NO];
} }
- (void)clearSelection { - (void)clearSelection {
@@ -131,8 +131,12 @@
if(!group) { if(!group) {
group = document.root; group = document.root;
} }
BOOL isFistGroup = [document.root.groups count] == 0;
[document createGroup:group]; [document createGroup:group];
[self.outlineView reloadData]; if(isFistGroup) {
NSTreeNode *node = [_outlineView itemAtRow:0];
[_outlineView expandItem:node expandChildren:NO];
}
} }
- (void)createEntry:(id)sender { - (void)createEntry:(id)sender {

View File

@@ -71,4 +71,9 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
[[NSNotificationCenter defaultCenter] postNotificationName:MPOutlineViewDidChangeGroupSelection object:self userInfo:nil]; [[NSNotificationCenter defaultCenter] postNotificationName:MPOutlineViewDidChangeGroupSelection object:self userInfo:nil];
} }
- (BOOL)outlineView:(NSOutlineView *)outlineView shouldShowOutlineCellForItem:(id)item {
KdbGroup *group = [item representedObject];
return (nil != group.parent);
}
@end @end

View File

@@ -48,7 +48,7 @@
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>8DB</string> <string>905</string>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string> <string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSHumanReadableCopyright</key> <key>NSHumanReadableCopyright</key>

View File

@@ -2,9 +2,9 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00"> <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
<data> <data>
<int key="IBDocument.SystemTarget">1080</int> <int key="IBDocument.SystemTarget">1080</int>
<string key="IBDocument.SystemVersion">12D78</string> <string key="IBDocument.SystemVersion">12E55</string>
<string key="IBDocument.InterfaceBuilderVersion">3084</string> <string key="IBDocument.InterfaceBuilderVersion">3084</string>
<string key="IBDocument.AppKitVersion">1187.37</string> <string key="IBDocument.AppKitVersion">1187.39</string>
<string key="IBDocument.HIToolboxVersion">626.00</string> <string key="IBDocument.HIToolboxVersion">626.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions"> <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -200,7 +200,6 @@
<string key="NSFrame">{{1, 119}, {238, 15}}</string> <string key="NSFrame">{{1, 119}, {238, 15}}</string>
<reference key="NSSuperview" ref="628894392"/> <reference key="NSSuperview" ref="628894392"/>
<reference key="NSWindow"/> <reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:60</string> <string key="NSReuseIdentifierKey">_NS:60</string>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool> <bool key="NSAllowsLogicalLayoutDirection">NO</bool>
<int key="NSsFlags">1</int> <int key="NSsFlags">1</int>