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

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