Develop and Download Open Source Software

Browse CVS Repository

Annotation of /undmail/guiproto/MainController.m

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


Revision 1.5 - (hide annotations) (download)
Wed Nov 20 13:42:53 2002 UTC (21 years, 5 months ago) by footashida
Branch: MAIN
Changes since 1.4: +24 -3 lines
Account Preference Panel

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.5 #import "POPServerTableDataSource.h"
8     #import "SMTPServerTableDataSource.h"
9     #import "MailCheckTableDataSource.h"
10 footashida 1.1
11     @implementation MainController
12     -(void)awakeFromNib{
13     DummyOutlineDataSource *ds;
14     NSToolbar *toolbar;
15 footashida 1.2 MainToolbarSource *mainToolbarSource;
16     ComposeToolbarSource *composeToolbarSource;
17 footashida 1.3 PreferenceToolbarSource *preferenceToolbarSource;
18 footashida 1.5 NSButtonCell *mailCheckButtonCell;
19     NSButtonCell *mailDeleteButtonCell;
20 footashida 1.3
21     [preferenceWindow setContentSize:[generalPref bounds].size];
22     [[preferenceWindow contentView] addSubview:generalPref];
23 footashida 1.1
24     ds = [[DummyOutlineDataSource alloc] init];
25     [folderTree setDataSource:ds];
26    
27 footashida 1.5 toolbar = [[NSToolbar alloc] initWithIdentifier:@"MainToolBar"];
28 footashida 1.2 mainToolbarSource = [[MainToolbarSource alloc] initWithController:self];
29     [toolbar setDelegate:mainToolbarSource];
30 footashida 1.1 [window setToolbar:toolbar];
31     [toolbar release];
32    
33 footashida 1.5 toolbar = [[NSToolbar alloc] initWithIdentifier:@"ComposeToolBar"];
34 footashida 1.2 composeToolbarSource = [[ComposeToolbarSource alloc] initWithController:self];
35     [toolbar setDelegate:composeToolbarSource];
36 footashida 1.1 [composeWindow setToolbar:toolbar];
37     [toolbar release];
38    
39 footashida 1.5 toolbar = [[NSToolbar alloc] initWithIdentifier:@"PreferenceToolBar"];
40 footashida 1.3 preferenceToolbarSource = [[PreferenceToolbarSource alloc] initWithController:self];
41     [toolbar setDelegate:preferenceToolbarSource];
42     [preferenceWindow setToolbar:toolbar];
43     [toolbar release];
44    
45 footashida 1.5 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 footashida 1.1 }
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 footashida 1.2 }
73     -(IBAction)showPreference:(id)sender{
74     [preferenceWindow makeKeyAndOrderFront:nil];
75 footashida 1.3 }
76     -(IBAction)selectPreferenceTab:(id)sender{
77     NSString *identifier = [sender itemIdentifier];
78     if([identifier isEqual:@"general_tab"]){
79 footashida 1.4 [self changePreferenceView:generalPref];
80 footashida 1.3 }else{
81 footashida 1.4 [self changePreferenceView:accountPref];
82 footashida 1.3 }
83 footashida 1.4
84     }
85     -(IBAction)changePreferenceView:(NSView *)newView{
86    
87     NSRect oldContentRect; // �����O���R���e���c�r���[��Rect
88     NSRect oldWindowRect; // �����O��Window��Rect
89     NSRect newContentRect; // ���������R���e���c�r���[��Rect
90     NSRect newWindowRect; // ��������Window�[��Rect
91     float toolbarHeight; // �c�[���o�[������
92    
93     NSView *contentsView; // Window���R���e���c�r���[
94    
95     oldWindowRect = [preferenceWindow frame];
96     oldContentRect = [[preferenceWindow contentView] bounds];
97    
98     toolbarHeight = NSHeight(oldWindowRect) - NSHeight(oldContentRect);
99    
100     newContentRect = [newView bounds];
101    
102     // ���T�C�Y����Window��Rect���v�Z
103     newWindowRect.origin.x
104     = oldWindowRect.origin.x;
105     newWindowRect.origin.y
106     = oldWindowRect.origin.y + (NSHeight(oldContentRect) - NSHeight(newContentRect));
107     newWindowRect.size.width
108     = newContentRect.size.width;
109     newWindowRect.size.height
110     = toolbarHeight + newContentRect.size.height;
111    
112     contentsView = [preferenceWindow contentView];
113     [contentsView replaceSubview:[[contentsView subviews] objectAtIndex:0] with:newView];
114     [preferenceWindow setFrame:newWindowRect display:YES animate:YES];
115 footashida 1.5
116     [popServerTable setDataSource:[[POPServerTableDataSource alloc] init]];
117     [smtpServerTable setDataSource:[[SMTPServerTableDataSource alloc] init]];
118     [mailCheckTable setDataSource:[[MailCheckTableDataSource alloc] init]];
119 footashida 1.3
120 footashida 1.1 }
121    
122     @end

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