Develop and Download Open Source Software

Browse CVS Repository

Contents of /undmail/guiproto/MainController.m

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


Revision 1.8 - (show annotations) (download)
Fri Nov 22 16:06:33 2002 UTC (21 years, 4 months ago) by footashida
Branch: MAIN
Changes since 1.7: +2 -0 lines
*** empty log message ***

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 #import "POPServerTableDataSource.h"
8 #import "SMTPServerTableDataSource.h"
9 #import "MailCheckTableDataSource.h"
10
11 @implementation MainController
12 -(void)awakeFromNib{
13 DummyOutlineDataSource *ds;
14 NSToolbar *toolbar;
15 MainToolbarSource *mainToolbarSource;
16 ComposeToolbarSource *composeToolbarSource;
17 PreferenceToolbarSource *preferenceToolbarSource;
18 NSButtonCell *mailCheckButtonCell;
19 NSButtonCell *mailDeleteButtonCell;
20
21 [preferenceWindow setContentSize:[generalPref bounds].size];
22 [[preferenceWindow contentView] addSubview:generalPref];
23
24 ds = [[DummyOutlineDataSource alloc] init];
25 [folderTree setDataSource:ds];
26
27 toolbar = [[NSToolbar alloc] initWithIdentifier:@"MainToolBar"];
28 mainToolbarSource = [[MainToolbarSource alloc] initWithController:self];
29 [toolbar setDelegate:mainToolbarSource];
30 [window setToolbar:toolbar];
31 [toolbar release];
32
33 toolbar = [[NSToolbar alloc] initWithIdentifier:@"ComposeToolBar"];
34 composeToolbarSource = [[ComposeToolbarSource alloc] initWithController:self];
35 [toolbar setDelegate:composeToolbarSource];
36 [composeWindow setToolbar:toolbar];
37 [toolbar release];
38
39 toolbar = [[NSToolbar alloc] initWithIdentifier:@"PreferenceToolBar"];
40 preferenceToolbarSource = [[PreferenceToolbarSource alloc] initWithController:self];
41 [toolbar setDelegate:preferenceToolbarSource];
42 [preferenceWindow setToolbar:toolbar];
43 [toolbar release];
44
45 mailCheckButtonCell = [[NSButtonCell alloc] init];
46 mailDeleteButtonCell = [[NSButtonCell alloc] init];
47 [mailCheckButtonCell setButtonType:NSSwitchButton];
48 [mailDeleteButtonCell setButtonType:NSSwitchButton];
49
50 [mailCheckButtonCell setTitle:@""];
51 [mailDeleteButtonCell setTitle:@""];
52
53 [[mailCheckTable tableColumnWithIdentifier:@"MailCheckFlag"] setDataCell:mailCheckButtonCell];
54 [[mailCheckTable tableColumnWithIdentifier:@"MailDeleteFlag"] setDataCell:mailDeleteButtonCell];
55
56
57 }
58 - (void)applicationDidFinishLaunching:(NSNotification*)notif
59 {
60 NSTableColumn* tableColumn;
61 IconedCell* iconedCell;
62 // �t�H���_�c���[���A�A�C�R��+�������\���������������ACell�����X���s���B
63 tableColumn = [folderTree tableColumnWithIdentifier:@"folderview"];
64 iconedCell = [[[IconedCell alloc] init] autorelease];
65 [tableColumn setDataCell:iconedCell];
66 }
67 -(IBAction)createNewMessage:(id)sender{
68 [composeWindow makeKeyAndOrderFront:nil];
69 }
70 -(IBAction)findMessage:(id)sender{
71 [searchWindow makeKeyAndOrderFront:nil];
72 }
73 -(IBAction)showPreference:(id)sender{
74 [preferenceWindow makeKeyAndOrderFront:nil];
75 }
76 -(IBAction)selectPreferenceTab:(id)sender{
77 NSString *identifier = [sender itemIdentifier];
78 if([identifier isEqual:@"general_tab"]){
79 [self changePreferenceView:generalPref];
80 }else if([identifier isEqual:@"view_tab"]){
81 [self changePreferenceView:viewPref];
82 }else if([identifier isEqual:@"account_tab"]){
83 [self changePreferenceView:accountPref];
84 }else if([identifier isEqual:@"template_tab"]){
85 [self changePreferenceView:templatePref];
86 }else if([identifier isEqual:@"rule_tab"]){
87 [self changePreferenceView:rulePref];
88 }else{
89 // ���������������E�E�E
90 }
91
92 }
93 -(IBAction)changePreferenceView:(NSView *)newView{
94
95 NSRect oldContentRect; // �����O���R���e���c�r���[��Rect
96 NSRect oldWindowRect; // �����O��Window��Rect
97 NSRect newContentRect; // ���������R���e���c�r���[��Rect
98 NSRect newWindowRect; // ��������Window�[��Rect
99 float toolbarHeight; // �c�[���o�[������
100
101 NSView *contentsView; // Window���R���e���c�r���[
102 NSView *oldView;
103 NSView *dumView;
104
105 oldWindowRect = [preferenceWindow frame];
106 oldContentRect = [[preferenceWindow contentView] bounds];
107
108 toolbarHeight = NSHeight(oldWindowRect) - NSHeight(oldContentRect);
109
110 newContentRect = [newView bounds];
111
112 // ���T�C�Y����Window��Rect���v�Z
113 newWindowRect.origin.x
114 = oldWindowRect.origin.x;
115 newWindowRect.origin.y
116 = oldWindowRect.origin.y + (NSHeight(oldContentRect) - NSHeight(newContentRect));
117 newWindowRect.size.width
118 = newContentRect.size.width;
119 newWindowRect.size.height
120 = toolbarHeight + newContentRect.size.height;
121
122 contentsView = [preferenceWindow contentView];
123 oldView = [[contentsView subviews] objectAtIndex:0];
124 dumView = [[NSView alloc] init];
125 [contentsView replaceSubview:oldView with:dumView];
126 [preferenceWindow setFrame:newWindowRect display:YES animate:YES];
127 [contentsView replaceSubview:dumView with:newView];
128 [dumView release];
129
130 [popServerTable setDataSource:[[POPServerTableDataSource alloc] init]];
131 [smtpServerTable setDataSource:[[SMTPServerTableDataSource alloc] init]];
132 [mailCheckTable setDataSource:[[MailCheckTableDataSource alloc] init]];
133
134 }
135
136 @end

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