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

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