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.6 - (show annotations) (download)
Fri Nov 22 15:10:34 2002 UTC (21 years, 4 months ago) by footashida
Branch: MAIN
Changes since 1.5: +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{
83 [self changePreferenceView:accountPref];
84 }
85
86 }
87 -(IBAction)changePreferenceView:(NSView *)newView{
88
89 NSRect oldContentRect; // �����O���R���e���c�r���[��Rect
90 NSRect oldWindowRect; // �����O��Window��Rect
91 NSRect newContentRect; // ���������R���e���c�r���[��Rect
92 NSRect newWindowRect; // ��������Window�[��Rect
93 float toolbarHeight; // �c�[���o�[������
94
95 NSView *contentsView; // Window���R���e���c�r���[
96
97 oldWindowRect = [preferenceWindow frame];
98 oldContentRect = [[preferenceWindow contentView] bounds];
99
100 toolbarHeight = NSHeight(oldWindowRect) - NSHeight(oldContentRect);
101
102 newContentRect = [newView bounds];
103
104 // ���T�C�Y����Window��Rect���v�Z
105 newWindowRect.origin.x
106 = oldWindowRect.origin.x;
107 newWindowRect.origin.y
108 = oldWindowRect.origin.y + (NSHeight(oldContentRect) - NSHeight(newContentRect));
109 newWindowRect.size.width
110 = newContentRect.size.width;
111 newWindowRect.size.height
112 = toolbarHeight + newContentRect.size.height;
113
114 contentsView = [preferenceWindow contentView];
115 [contentsView replaceSubview:[[contentsView subviews] objectAtIndex:0] with:newView];
116 [preferenceWindow setFrame:newWindowRect display:YES animate:YES];
117
118 [popServerTable setDataSource:[[POPServerTableDataSource alloc] init]];
119 [smtpServerTable setDataSource:[[SMTPServerTableDataSource alloc] init]];
120 [mailCheckTable setDataSource:[[MailCheckTableDataSource alloc] init]];
121
122 }
123
124 @end

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