Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
actions are categorized and sorted, hopefully I didn't do that too wr…
…ong...
- Loading branch information
Showing
38 changed files
with
290 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// | ||
// ActionSubmenuItem.h | ||
// ControlPlane | ||
// | ||
// Created by Dustin Rue on 3/22/12. | ||
// Copyright (c) 2012. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
@interface ActionSubmenuItem : NSObject <NSMenuDelegate> { | ||
NSMutableArray *items; | ||
id target; | ||
id representedObject; | ||
} | ||
|
||
@property (readwrite, retain) NSMutableArray *items; | ||
@property (readwrite, assign) id target; | ||
@property (readwrite, assign) id representedObject; | ||
|
||
- (void) addObject:(id) object; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// | ||
// ActionSubmenuItem.m | ||
// ControlPlane | ||
// | ||
// Created by Dustin Rue on 3/22/12. | ||
// Copyright (c) 2012. All rights reserved. | ||
// | ||
|
||
#import "ActionSubmenuItem.h" | ||
#import "Action.h" | ||
|
||
@implementation ActionSubmenuItem | ||
|
||
@synthesize items; | ||
@synthesize target; | ||
@synthesize representedObject; | ||
|
||
- (id) init { | ||
self = [super init]; | ||
|
||
if (self) { | ||
items = [[NSMutableArray alloc] init]; | ||
} | ||
|
||
return self; | ||
} | ||
|
||
- (void) dealloc { | ||
[items release]; | ||
|
||
[super dealloc]; | ||
} | ||
- (void) addObject:(id) object { | ||
[items addObject:object]; | ||
} | ||
- (BOOL) menu:(NSMenu *)menu updateItem:(NSMenuItem *)item atIndex:(NSInteger)index shouldCancel:(BOOL)shouldCancel { | ||
|
||
SEL addAction = NSSelectorFromString(@"addAction:"); | ||
|
||
[item setTitle:[[[items objectAtIndex:index] objectForKey:@"class"] friendlyName]]; | ||
[item setTarget:target]; | ||
[item setRepresentedObject:[[items objectAtIndex:index] objectForKey:@"representedObject"]]; | ||
[item setAction:addAction]; | ||
|
||
return YES; | ||
} | ||
|
||
- (NSInteger) numberOfItemsInMenu:(NSMenu *)menu { | ||
return [items count]; | ||
} | ||
|
||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.