Develop and Download Open Source Software

Browse CVS Repository

Contents of /undmail/guiproto/ToolbarSource.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Sun Nov 17 03:58:21 2002 UTC (21 years, 5 months ago) by footashida
Branch: MAIN
*** empty log message ***

1 #import "ToolbarSource.h"
2 #import "MainController.h"
3
4 @implementation ToolbarSource
5 - (id)init{
6 if(self = [super init]){
7 toolbarItemList = [[NSMutableArray alloc] init];
8 defaultToolbarItemList = [[NSMutableArray alloc] init];
9 itemTable = [[NSMutableDictionary alloc] init];
10 }
11 return self;
12 }
13 - (NSToolbarItem *)addToolbarItemWithIdentifier:(NSString *)identifier label:(NSString *)label imageName:(NSString *)imageName isDefault:(BOOL)isDefault{
14
15 NSToolbarItem *item;
16 NSBundle *mainBundle;
17 mainBundle = [NSBundle mainBundle];
18 item = [[[NSToolbarItem alloc] initWithItemIdentifier:identifier] autorelease];
19 [item setLabel:[mainBundle localizedStringForKey:label value:nil table:@"Toolbar"]];
20 [item setImage:[[[NSImage alloc] initByReferencingFile:
21 [mainBundle pathForImageResource:imageName]] autorelease]];
22 [item setEnabled:YES];
23 [itemTable setObject:item forKey:identifier];
24 [toolbarItemList addObject:identifier];
25 if(isDefault){
26 [defaultToolbarItemList addObject:identifier];
27 }
28 return item;
29 }
30 - (NSToolbarItem *)toolbar:(NSToolbar *)toolbar
31 itemForItemIdentifier:(NSString *)itemIdentifier
32 willBeInsertedIntoToolbar:(BOOL)flag{
33 return [itemTable objectForKey:itemIdentifier];
34 }
35 - (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar*)toolbar{
36 return toolbarItemList;
37 }
38 - (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar*)toolbar{
39 return defaultToolbarItemList;
40 }
41 -(void)test:(id)sender{
42 NSLog(@"test!!");
43 }
44
45 @end

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26