| 1 |
footashida |
1.1 |
#import "MainController.h" |
| 2 |
|
|
#import "DummyOutlineDataSource.h" |
| 3 |
footashida |
1.2 |
#import "MainToolbarSource.h" |
| 4 |
footashida |
1.1 |
#import "IconedCell.h" |
| 5 |
footashida |
1.2 |
#import "ComposeToolbarSource.h" |
| 6 |
footashida |
1.3 |
#import "PreferenceToolbarSource.h" |
| 7 |
footashida |
1.1 |
|
| 8 |
|
|
@implementation MainController |
| 9 |
|
|
-(void)awakeFromNib{ |
| 10 |
|
|
DummyOutlineDataSource *ds; |
| 11 |
|
|
NSToolbar *toolbar; |
| 12 |
footashida |
1.2 |
MainToolbarSource *mainToolbarSource; |
| 13 |
|
|
ComposeToolbarSource *composeToolbarSource; |
| 14 |
footashida |
1.3 |
PreferenceToolbarSource *preferenceToolbarSource; |
| 15 |
|
|
|
| 16 |
|
|
[preferenceWindow setContentSize:[generalPref bounds].size]; |
| 17 |
|
|
[[preferenceWindow contentView] addSubview:generalPref]; |
| 18 |
footashida |
1.1 |
|
| 19 |
|
|
ds = [[DummyOutlineDataSource alloc] init]; |
| 20 |
|
|
[folderTree setDataSource:ds]; |
| 21 |
|
|
|
| 22 |
|
|
toolbar = [[NSToolbar alloc] initWithIdentifier:@"myToolBar"]; |
| 23 |
footashida |
1.2 |
mainToolbarSource = [[MainToolbarSource alloc] initWithController:self]; |
| 24 |
|
|
[toolbar setDelegate:mainToolbarSource]; |
| 25 |
footashida |
1.1 |
[window setToolbar:toolbar]; |
| 26 |
|
|
[toolbar release]; |
| 27 |
|
|
|
| 28 |
|
|
toolbar = [[NSToolbar alloc] initWithIdentifier:@"componentToolBar"]; |
| 29 |
footashida |
1.2 |
composeToolbarSource = [[ComposeToolbarSource alloc] initWithController:self]; |
| 30 |
|
|
[toolbar setDelegate:composeToolbarSource]; |
| 31 |
footashida |
1.1 |
[composeWindow setToolbar:toolbar]; |
| 32 |
|
|
[toolbar release]; |
| 33 |
|
|
|
| 34 |
footashida |
1.3 |
toolbar = [[NSToolbar alloc] initWithIdentifier:@"preferenceToolBar"]; |
| 35 |
|
|
preferenceToolbarSource = [[PreferenceToolbarSource alloc] initWithController:self]; |
| 36 |
|
|
[toolbar setDelegate:preferenceToolbarSource]; |
| 37 |
|
|
[preferenceWindow setToolbar:toolbar]; |
| 38 |
|
|
[toolbar release]; |
| 39 |
|
|
|
| 40 |
footashida |
1.1 |
} |
| 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 |
footashida |
1.2 |
} |
| 56 |
|
|
-(IBAction)showPreference:(id)sender{ |
| 57 |
|
|
[preferenceWindow makeKeyAndOrderFront:nil]; |
| 58 |
footashida |
1.3 |
} |
| 59 |
|
|
-(IBAction)selectPreferenceTab:(id)sender{ |
| 60 |
|
|
NSString *identifier = [sender itemIdentifier]; |
| 61 |
|
|
if([identifier isEqual:@"general_tab"]){ |
| 62 |
footashida |
1.4 |
[self changePreferenceView:generalPref]; |
| 63 |
footashida |
1.3 |
}else{ |
| 64 |
footashida |
1.4 |
[self changePreferenceView:accountPref]; |
| 65 |
footashida |
1.3 |
} |
| 66 |
footashida |
1.4 |
|
| 67 |
|
|
} |
| 68 |
|
|
-(IBAction)changePreferenceView:(NSView *)newView{ |
| 69 |
|
|
|
| 70 |
|
|
NSRect oldContentRect; // �����O���R���e���c�r���[��Rect |
| 71 |
|
|
NSRect oldWindowRect; // �����O��Window��Rect |
| 72 |
|
|
NSRect newContentRect; // ���������R���e���c�r���[��Rect |
| 73 |
|
|
NSRect newWindowRect; // ��������Window�[��Rect |
| 74 |
|
|
float toolbarHeight; // �c�[���o�[������ |
| 75 |
|
|
|
| 76 |
|
|
NSView *contentsView; // Window���R���e���c�r���[ |
| 77 |
|
|
|
| 78 |
|
|
oldWindowRect = [preferenceWindow frame]; |
| 79 |
|
|
oldContentRect = [[preferenceWindow contentView] bounds]; |
| 80 |
|
|
|
| 81 |
|
|
toolbarHeight = NSHeight(oldWindowRect) - NSHeight(oldContentRect); |
| 82 |
|
|
|
| 83 |
|
|
newContentRect = [newView bounds]; |
| 84 |
|
|
|
| 85 |
|
|
// ���T�C�Y����Window��Rect���v�Z |
| 86 |
|
|
newWindowRect.origin.x |
| 87 |
|
|
= oldWindowRect.origin.x; |
| 88 |
|
|
newWindowRect.origin.y |
| 89 |
|
|
= oldWindowRect.origin.y + (NSHeight(oldContentRect) - NSHeight(newContentRect)); |
| 90 |
|
|
newWindowRect.size.width |
| 91 |
|
|
= newContentRect.size.width; |
| 92 |
|
|
newWindowRect.size.height |
| 93 |
|
|
= toolbarHeight + newContentRect.size.height; |
| 94 |
|
|
|
| 95 |
|
|
contentsView = [preferenceWindow contentView]; |
| 96 |
|
|
[contentsView replaceSubview:[[contentsView subviews] objectAtIndex:0] with:newView]; |
| 97 |
|
|
[preferenceWindow setFrame:newWindowRect display:YES animate:YES]; |
| 98 |
footashida |
1.3 |
|
| 99 |
footashida |
1.1 |
} |
| 100 |
|
|
|
| 101 |
|
|
@end |