Develop and Download Open Source Software

Browse CVS Repository

Diff of /undmail/guiproto/MainController.m

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

revision 1.3 by footashida, Mon Nov 18 14:11:34 2002 UTC revision 1.4 by footashida, Wed Nov 20 12:09:56 2002 UTC
# Line 57  Line 57 
57      [preferenceWindow makeKeyAndOrderFront:nil];      [preferenceWindow makeKeyAndOrderFront:nil];
58  }  }
59  -(IBAction)selectPreferenceTab:(id)sender{  -(IBAction)selectPreferenceTab:(id)sender{
     NSView *contentView;  
     NSRect rect;  
     float toolbarHeight;  
60      NSString *identifier = [sender itemIdentifier];      NSString *identifier = [sender itemIdentifier];
     contentView = [preferenceWindow contentView];  
       
     toolbarHeight = [preferenceWindow frame].size.height - [contentView frame].size.height;  
     NSLog(@"toolbarHeight = %f", toolbarHeight);  
       
61      if([identifier isEqual:@"general_tab"]){      if([identifier isEqual:@"general_tab"]){
62          rect.origin = NSMakePoint([preferenceWindow frame].origin.x,          [self changePreferenceView:generalPref];
             [preferenceWindow frame].origin.y - ([generalPref bounds].size.height - [contentView bounds].size.height) - toolbarHeight);  
         rect.size = [generalPref bounds].size;  
         [preferenceWindow setFrame:rect display:YES animate:YES];  
         [contentView replaceSubview:accountPref with:generalPref];  
63      }else{      }else{
64          rect.origin = NSMakePoint([preferenceWindow frame].origin.x,          [self changePreferenceView:accountPref];
             [preferenceWindow frame].origin.y - ([accountPref bounds].size.height - [contentView bounds].size.height) - toolbarHeight);  
         rect.size = [accountPref bounds].size;  
         [preferenceWindow setFrame:rect display:YES animate:YES];  
         [contentView replaceSubview:generalPref with:accountPref];  
65      }      }
66            
67  }  }
68    -(IBAction)changePreferenceView:(NSView *)newView{
69    
70        NSRect oldContentRect;  // 切替前のコンテンツビューのRect
71        NSRect oldWindowRect;   // 切替前のWindowのRect
72        NSRect newContentRect;  // 切替後のコンテンツビューのRect
73        NSRect newWindowRect;   // 切替後のWindowーのRect
74        float toolbarHeight;    // ツールバーの高さ
75        
76        NSView *contentsView;   // Windowのコンテンツビュー
77        
78        oldWindowRect = [preferenceWindow frame];
79        oldContentRect = [[preferenceWindow contentView] bounds];
80        
81        toolbarHeight = NSHeight(oldWindowRect) - NSHeight(oldContentRect);
82        
83        newContentRect = [newView bounds];
84        
85        // リサイズ後のWindowのRectを計算
86        newWindowRect.origin.x
87            = oldWindowRect.origin.x;
88        newWindowRect.origin.y
89            = oldWindowRect.origin.y + (NSHeight(oldContentRect) - NSHeight(newContentRect));
90        newWindowRect.size.width
91            = newContentRect.size.width;
92        newWindowRect.size.height
93            = toolbarHeight + newContentRect.size.height;
94        
95        contentsView = [preferenceWindow contentView];
96        [contentsView replaceSubview:[[contentsView subviews] objectAtIndex:0] with:newView];
97        [preferenceWindow setFrame:newWindowRect display:YES animate:YES];
98        
99    }
100    
101  @end  @end

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

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