mirror of https://github.com/ksherlock/ample.git
machine view - clicking a parent-only row will toggle expansion
also add animation proxy to bookmark code
This commit is contained in:
parent
c0534f0107
commit
7b55c37128
|
@ -43,13 +43,22 @@
|
||||||
#pragma mark - IBActions
|
#pragma mark - IBActions
|
||||||
- (IBAction)clickAction:(id)sender {
|
- (IBAction)clickAction:(id)sender {
|
||||||
|
|
||||||
NSInteger row = [_outlineView selectedRow];
|
NSInteger row = [_outlineView clickedRow];
|
||||||
if (row < 0) return;
|
if (row < 0) return;
|
||||||
NSDictionary *d = [_outlineView itemAtRow: row];
|
NSDictionary *item = [_outlineView itemAtRow: row];
|
||||||
if (!d) return;
|
if (!item) return;
|
||||||
NSString *value = [d objectForKey: @"value"];
|
|
||||||
if (!d) return;
|
NSString *value = [item objectForKey: @"value"];
|
||||||
[self setMachine: value];
|
NSArray *children = [item objectForKey: @"children"];
|
||||||
|
|
||||||
|
if (value) {
|
||||||
|
[self setMachine: value];
|
||||||
|
} else if (children) {
|
||||||
|
id ap = [_outlineView animator];
|
||||||
|
[_outlineView isItemExpanded: item] ? [ap collapseItem: item] : [ap expandItem: item];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -163,7 +172,9 @@
|
||||||
|
|
||||||
- (BOOL)loadBookmark:(NSDictionary *)bookmark {
|
- (BOOL)loadBookmark:(NSDictionary *)bookmark {
|
||||||
NSString *machine = [bookmark objectForKey: @"machine"];
|
NSString *machine = [bookmark objectForKey: @"machine"];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//NSInteger row = [_outlineView selectedRow];
|
//NSInteger row = [_outlineView selectedRow];
|
||||||
if (!machine) {
|
if (!machine) {
|
||||||
[self setMachine: nil];
|
[self setMachine: nil];
|
||||||
|
@ -177,7 +188,8 @@
|
||||||
for (NSDictionary *child in children) {
|
for (NSDictionary *child in children) {
|
||||||
if ([machine isEqualToString: [child objectForKey: @"value"]]) {
|
if ([machine isEqualToString: [child objectForKey: @"value"]]) {
|
||||||
|
|
||||||
[_outlineView expandItem: parent];
|
id ap = [_outlineView animator];
|
||||||
|
[ap expandItem: parent];
|
||||||
NSInteger row = [_outlineView rowForItem: child];
|
NSInteger row = [_outlineView rowForItem: child];
|
||||||
if (row >= 0) {
|
if (row >= 0) {
|
||||||
NSIndexSet *set = [NSIndexSet indexSetWithIndex: row];
|
NSIndexSet *set = [NSIndexSet indexSetWithIndex: row];
|
||||||
|
|
Loading…
Reference in New Issue