| 1 |
#import "MainController.h" |
| 2 |
#import "DummyOutlineDataSource.h" |
| 3 |
#import "MainToolbarSource.h" |
| 4 |
#import "IconedCell.h" |
| 5 |
#import "ComposeToolbarSource.h" |
| 6 |
#import "PreferenceToolbarSource.h" |
| 7 |
|
| 8 |
@implementation MainController |
| 9 |
-(void)awakeFromNib{ |
| 10 |
DummyOutlineDataSource *ds; |
| 11 |
NSToolbar *toolbar; |
| 12 |
MainToolbarSource *mainToolbarSource; |
| 13 |
ComposeToolbarSource *composeToolbarSource; |
| 14 |
PreferenceToolbarSource *preferenceToolbarSource; |
| 15 |
|
| 16 |
[preferenceWindow setContentSize:[generalPref bounds].size]; |
| 17 |
[[preferenceWindow contentView] addSubview:generalPref]; |
| 18 |
|
| 19 |
ds = [[DummyOutlineDataSource alloc] init]; |
| 20 |
[folderTree setDataSource:ds]; |
| 21 |
|
| 22 |
toolbar = [[NSToolbar alloc] initWithIdentifier:@"myToolBar"]; |
| 23 |
mainToolbarSource = [[MainToolbarSource alloc] initWithController:self]; |
| 24 |
[toolbar setDelegate:mainToolbarSource]; |
| 25 |
[window setToolbar:toolbar]; |
| 26 |
[toolbar release]; |
| 27 |
|
| 28 |
toolbar = [[NSToolbar alloc] initWithIdentifier:@"componentToolBar"]; |
| 29 |
composeToolbarSource = [[ComposeToolbarSource alloc] initWithController:self]; |
| 30 |
[toolbar setDelegate:composeToolbarSource]; |
| 31 |
[composeWindow setToolbar:toolbar]; |
| 32 |
[toolbar release]; |
| 33 |
|
| 34 |
toolbar = [[NSToolbar alloc] initWithIdentifier:@"preferenceToolBar"]; |
| 35 |
preferenceToolbarSource = [[PreferenceToolbarSource alloc] initWithController:self]; |
| 36 |
[toolbar setDelegate:preferenceToolbarSource]; |
| 37 |
[preferenceWindow setToolbar:toolbar]; |
| 38 |
[toolbar release]; |
| 39 |
|
| 40 |
} |
| 41 |
- (void)applicationDidFinishLaunching:(NSNotification*)notif |
| 42 |
{ |
| 43 |
NSTableColumn* tableColumn; |
| 44 |
IconedCell* iconedCell; |
| 45 |
// �t�H���_�c���[���A�A�C�R��+�������\���������������ACell�����X���s���B |
| 46 |
tableColumn = [folderTree tableColumnWithIdentifier:@"folderview"]; |
| 47 |
iconedCell = [[[IconedCell alloc] init] autorelease]; |
| 48 |
[tableColumn setDataCell:iconedCell]; |
| 49 |
} |
| 50 |
-(IBAction)createNewMessage:(id)sender{ |
| 51 |
[composeWindow makeKeyAndOrderFront:nil]; |
| 52 |
} |
| 53 |
-(IBAction)findMessage:(id)sender{ |
| 54 |
[searchWindow makeKeyAndOrderFront:nil]; |
| 55 |
} |
| 56 |
-(IBAction)showPreference:(id)sender{ |
| 57 |
[preferenceWindow makeKeyAndOrderFront:nil]; |
| 58 |
} |
| 59 |
-(IBAction)selectPreferenceTab:(id)sender{ |
| 60 |
NSView *contentView; |
| 61 |
NSRect rect; |
| 62 |
float toolbarHeight; |
| 63 |
NSString *identifier = [sender itemIdentifier]; |
| 64 |
contentView = [preferenceWindow contentView]; |
| 65 |
|
| 66 |
toolbarHeight = [preferenceWindow frame].size.height - [contentView frame].size.height; |
| 67 |
NSLog(@"toolbarHeight = %f", toolbarHeight); |
| 68 |
|
| 69 |
if([identifier isEqual:@"general_tab"]){ |
| 70 |
rect.origin = NSMakePoint([preferenceWindow frame].origin.x, |
| 71 |
[preferenceWindow frame].origin.y - ([generalPref bounds].size.height - [contentView bounds].size.height) - toolbarHeight); |
| 72 |
rect.size = [generalPref bounds].size; |
| 73 |
[preferenceWindow setFrame:rect display:YES animate:YES]; |
| 74 |
[contentView replaceSubview:accountPref with:generalPref]; |
| 75 |
}else{ |
| 76 |
rect.origin = NSMakePoint([preferenceWindow frame].origin.x, |
| 77 |
[preferenceWindow frame].origin.y - ([accountPref bounds].size.height - [contentView bounds].size.height) - toolbarHeight); |
| 78 |
rect.size = [accountPref bounds].size; |
| 79 |
[preferenceWindow setFrame:rect display:YES animate:YES]; |
| 80 |
[contentView replaceSubview:generalPref with:accountPref]; |
| 81 |
} |
| 82 |
|
| 83 |
} |
| 84 |
|
| 85 |
@end |