]> git.saurik.com Git - wxWidgets.git/blame - src/mac/uma.cpp
removing dependancy on mac headers from public wx headers (eventually adding wx/mac...
[wxWidgets.git] / src / mac / uma.cpp
CommitLineData
03e11df5 1#include "wx/defs.h"
5fde6fcc 2#include "wx/dc.h"
03e11df5 3#include "wx/mac/uma.h"
b03e4fcd 4#include <MacTextEditor.h>
72e7876b 5
f5c6eb5c 6#ifndef __DARWIN__
03e11df5
GD
7 #include <Navigation.h>
8#endif
5b781a67 9
72055702
SC
10// since we have decided that we only support 8.6 upwards we are
11// checking for these minimum requirements in the startup code of
12// the application so all wxWindows code can safely assume that appearance 1.1
13// windows manager, control manager, navigation services etc. are
14// present
e7b596fb 15
b03e4fcd
SC
16#define wxUSE_MLTE 0
17
0888ccc7 18
72e7876b
SC
19static bool sUMAHasAppearance = false ;
20static long sUMAAppearanceVersion = 0 ;
0888ccc7 21static bool sUMAHasAquaLayout = false ;
72e7876b
SC
22extern int gAGABackgroundColor ;
23bool UMAHasAppearance() { return sUMAHasAppearance ; }
24long UMAGetAppearanceVersion() { return sUMAAppearanceVersion ; }
25
26static bool sUMAHasWindowManager = false ;
27static long sUMAWindowManagerAttr = 0 ;
28
29bool UMAHasWindowManager() { return sUMAHasWindowManager ; }
30long UMAGetWindowManagerAttr() { return sUMAWindowManagerAttr ; }
0888ccc7
SC
31bool UMAHasAquaLayout() { return sUMAHasAquaLayout ; }
32
72055702 33
5b781a67
SC
34void UMACleanupToolbox()
35{
5b781a67
SC
36 if ( sUMAHasAppearance )
37 {
38 UnregisterAppearanceClient() ;
39 }
5b781a67
SC
40 if ( NavServicesAvailable() )
41 {
42 NavUnload() ;
43 }
b03e4fcd
SC
44#if wxUSE_MLTE
45 TXNTerminateTextension( ) ;
46#endif
5b781a67 47}
72e7876b
SC
48void UMAInitToolbox( UInt16 inMoreMastersCalls )
49{
50#if !TARGET_CARBON
51 ::MaxApplZone();
52 for (long i = 1; i <= inMoreMastersCalls; i++)
53 ::MoreMasters();
54
55 ::InitGraf(&qd.thePort);
56 ::InitFonts();
72e7876b
SC
57 ::InitMenus();
58 ::TEInit();
59 ::InitDialogs(0L);
60 ::FlushEvents(everyEvent, 0);
61 ::InitCursor();
62 long total,contig;
63 PurgeSpace(&total, &contig);
64#else
2f1ae414 65 InitCursor();
72e7876b
SC
66#endif
67
72e7876b
SC
68 long theAppearance ;
69 if ( Gestalt( gestaltAppearanceAttr, &theAppearance ) == noErr )
70 {
71 sUMAHasAppearance = true ;
72 RegisterAppearanceClient();
73 if ( Gestalt( gestaltAppearanceVersion, &theAppearance ) == noErr )
74 {
75 sUMAAppearanceVersion = theAppearance ;
76 }
77 else
78 {
79 sUMAAppearanceVersion = 0x0100 ;
80 }
81 }
72e7876b
SC
82 if ( Gestalt( gestaltWindowMgrAttr, &sUMAWindowManagerAttr ) == noErr )
83 {
84 sUMAHasWindowManager = sUMAWindowManagerAttr & gestaltWindowMgrPresent ;
85 }
5b781a67 86
f5c6eb5c 87#ifndef __DARWIN__
8e8d3ba8
SC
88#if TARGET_CARBON
89// Call currently implicitely done : InitFloatingWindows() ;
90#else
5b781a67
SC
91 if ( sUMAHasWindowManager )
92 InitFloatingWindows() ;
93 else
94 InitWindows();
8e8d3ba8 95#endif
03e11df5 96#endif
5b781a67
SC
97
98 if ( NavServicesAvailable() )
99 {
100 NavLoad() ;
101 }
b03e4fcd
SC
102
103#if wxUSE_MLTE
104 TXNMacOSPreferredFontDescription defaults;
105 defaults.fontID = kFontIDGeneva ;
106 defaults.pointSize = (10 << 16) ;
107 defaults.fontStyle = kTXNDefaultFontStyle;
108 defaults.encoding = kTXNSystemDefaultEncoding;
109 TXNInitTextension(&defaults, 1, (kTXNAlwaysUseQuickDrawTextMask | kTXNWantMoviesMask | kTXNWantSoundMask | kTXNWantGraphicsMask));
110#endif
0888ccc7
SC
111 long menuMgrAttr ;
112 Gestalt( gestaltMenuMgrAttr , &menuMgrAttr ) ;
113 if ( menuMgrAttr & gestaltMenuMgrAquaLayoutMask )
114 sUMAHasAquaLayout = true ;
115
72e7876b
SC
116}
117
118// process manager
119long UMAGetProcessMode()
120{
121 OSErr err ;
122 ProcessInfoRec processinfo;
123 ProcessSerialNumber procno ;
124
125 procno.highLongOfPSN = NULL ;
126 procno.lowLongOfPSN = kCurrentProcess ;
127 processinfo.processInfoLength = sizeof(ProcessInfoRec);
128 processinfo.processName = NULL;
129 processinfo.processAppSpec = NULL;
130
131 err = ::GetProcessInformation( &procno , &processinfo ) ;
132 wxASSERT( err == noErr ) ;
133 return processinfo.processMode ;
134}
135
136bool UMAGetProcessModeDoesActivateOnFGSwitch()
137{
138 return UMAGetProcessMode() & modeDoesActivateOnFGSwitch ;
139}
140
141// menu manager
142
2f1ae414 143void UMASetMenuTitle( MenuRef menu , StringPtr title )
72e7876b 144{
76a5e5d2 145/*
72e7876b
SC
146#if !TARGET_CARBON
147 long size = GetHandleSize( (Handle) menu ) ;
148 const long headersize = 14 ;
149 int oldlen = (**menu).menuData[0] + 1;
150 int newlen = title[0] + 1 ;
151
152 if ( oldlen < newlen )
153 {
154 // enlarge before adjusting
155 SetHandleSize( (Handle) menu , size + (newlen - oldlen ) );
156 }
157
158 if ( oldlen != newlen )
159 memmove( (char*) (**menu).menuData + newlen , (char*) (**menu).menuData + oldlen , size - headersize - oldlen ) ;
160
161 memcpy( (char*) (**menu).menuData , title , newlen ) ;
162 if ( oldlen > newlen )
163 {
164 // shrink after
165 SetHandleSize( (Handle) menu , size + (newlen - oldlen ) ) ;
166 }
167#else
76a5e5d2 168*/
72e7876b 169 SetMenuTitle( menu , title ) ;
76a5e5d2 170//#endif
72e7876b
SC
171}
172
173UInt32 UMAMenuEvent( EventRecord *inEvent )
174{
72e7876b 175 return MenuEvent( inEvent ) ;
72e7876b
SC
176}
177
178void UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex inItem )
179{
72e7876b 180 EnableMenuItem( inMenu , inItem ) ;
72e7876b
SC
181}
182
183void UMADisableMenuItem( MenuRef inMenu , MenuItemIndex inItem )
184{
72e7876b 185 DisableMenuItem( inMenu , inItem ) ;
72e7876b 186}
2f1ae414
SC
187
188void UMAAppendSubMenuItem( MenuRef menu , StringPtr l , SInt16 id )
189{
190 Str255 label ;
191 memcpy( label , l , l[0]+1 ) ;
192 // hardcoded adding of the submenu combination for mac
193
194 int theEnd = label[0] + 1;
195 if (theEnd > 251)
196 theEnd = 251; // mac allows only 255 characters
197 label[theEnd++] = '/';
198 label[theEnd++] = hMenuCmd;
199 label[theEnd++] = '!';
200 label[theEnd++] = id ;
201 label[theEnd] = 0x00;
202 label[0] = theEnd;
203 MacAppendMenu(menu, label);
204}
205
206void UMAInsertSubMenuItem( MenuRef menu , StringPtr l , MenuItemIndex item , SInt16 id )
207{
208 Str255 label ;
209 memcpy( label , l , l[0]+1 ) ;
210 // hardcoded adding of the submenu combination for mac
211
212 int theEnd = label[0] + 1;
213 if (theEnd > 251)
214 theEnd = 251; // mac allows only 255 characters
215 label[theEnd++] = '/';
216 label[theEnd++] = hMenuCmd;
217 label[theEnd++] = '!';
218 label[theEnd++] = id;
219 label[theEnd] = 0x00;
220 label[0] = theEnd;
221 MacInsertMenuItem(menu, label , item);
222}
223
224void UMAAppendMenuItem( MenuRef menu , StringPtr l , SInt16 key, UInt8 modifiers )
225{
226 Str255 label ;
227 memcpy( label , l , l[0]+1 ) ;
228 if ( key )
229 {
230 int pos = label[0] ;
231 label[++pos] = '/';
232 label[++pos] = toupper( key );
233 label[0] = pos ;
234 }
235 MacAppendMenu( menu , label ) ;
236}
237
238void UMAInsertMenuItem( MenuRef menu , StringPtr l , MenuItemIndex item , SInt16 key, UInt8 modifiers )
239{
240 Str255 label ;
241 memcpy( label , l , l[0]+1 ) ;
242 if ( key )
243 {
244 int pos = label[0] ;
245 label[++pos] = '/';
246 label[++pos] = toupper( key );
247 label[0] = pos ;
248 }
249 MacInsertMenuItem( menu , label , item) ;
250}
251
72e7876b
SC
252// quickdraw
253
2f1ae414
SC
254int gPrOpenCounter = 0 ;
255
93f0fe75
GD
256#if TARGET_CARBON && PM_USE_SESSION_APIS
257OSStatus UMAPrOpen(PMPrintSession *macPrintSession)
87df17a1
GD
258#else
259OSStatus UMAPrOpen()
a689a4d0 260#endif
2f1ae414
SC
261{
262#if !TARGET_CARBON
263 OSErr err = noErr ;
264 ++gPrOpenCounter ;
265 if ( gPrOpenCounter == 1 )
266 {
267 PrOpen() ;
268 err = PrError() ;
269 wxASSERT( err == noErr ) ;
270 }
5b781a67 271 return err ;
2f1ae414 272#else
5b781a67
SC
273 OSStatus err = noErr ;
274 ++gPrOpenCounter ;
275 if ( gPrOpenCounter == 1 )
276 {
a689a4d0 277 #if PM_USE_SESSION_APIS
93f0fe75 278 err = PMCreateSession(macPrintSession) ;
a689a4d0
GD
279 #else
280 err = PMBegin() ;
281 #endif
5b781a67
SC
282 wxASSERT( err == noErr ) ;
283 }
284 return err ;
2f1ae414
SC
285#endif
286}
287
93f0fe75
GD
288#if TARGET_CARBON && PM_USE_SESSION_APIS
289OSStatus UMAPrClose(PMPrintSession *macPrintSession)
87df17a1
GD
290#else
291OSStatus UMAPrClose()
a689a4d0 292#endif
2f1ae414
SC
293{
294#if !TARGET_CARBON
295 OSErr err = noErr ;
296 wxASSERT( gPrOpenCounter >= 1 ) ;
297 if ( gPrOpenCounter == 1 )
298 {
299 PrClose() ;
300 err = PrError() ;
301 wxASSERT( err == noErr ) ;
302 }
303 --gPrOpenCounter ;
5b781a67 304 return err ;
2f1ae414 305#else
5b781a67
SC
306 OSStatus err = noErr ;
307 wxASSERT( gPrOpenCounter >= 1 ) ;
308 if ( gPrOpenCounter == 1 )
309 {
a689a4d0 310 #if PM_USE_SESSION_APIS
93f0fe75
GD
311 err = PMRelease(*macPrintSession) ;
312 *macPrintSession = kPMNoReference;
a689a4d0
GD
313 #else
314 err = PMEnd() ;
315 #endif
5b781a67
SC
316 }
317 --gPrOpenCounter ;
318 return err ;
2f1ae414
SC
319#endif
320}
321
72e7876b
SC
322#if !TARGET_CARBON
323
72055702 324pascal QDGlobalsPtr GetQDGlobalsPtr (void) ;
72e7876b
SC
325pascal QDGlobalsPtr GetQDGlobalsPtr (void)
326{
327 return QDGlobalsPtr (* (Ptr*) LMGetCurrentA5 ( ) - 0xCA);
328}
329
330#endif
331
332void UMAShowWatchCursor()
333{
334 OSErr err = noErr;
335
336 CursHandle watchFob = GetCursor (watchCursor);
337
338 if (!watchFob)
339 err = nilHandleErr;
340 else
341 {
342 #if TARGET_CARBON
72055702
SC
343// Cursor preservedArrow;
344// GetQDGlobalsArrow (&preservedArrow);
345// SetQDGlobalsArrow (*watchFob);
346// InitCursor ( );
347// SetQDGlobalsArrow (&preservedArrow);
348 SetCursor (*watchFob);
72e7876b
SC
349 #else
350 SetCursor (*watchFob);
351 #endif
352 }
353}
354
355void UMAShowArrowCursor()
356{
357#if TARGET_CARBON
358 Cursor arrow;
359 SetCursor (GetQDGlobalsArrow (&arrow));
360#else
361 SetCursor (&(qd.arrow));
362#endif
363}
364
365// window manager
366
367GrafPtr UMAGetWindowPort( WindowRef inWindowRef )
368{
369 wxASSERT( inWindowRef != NULL ) ;
370#if TARGET_CARBON
371 return GetWindowPort( inWindowRef ) ;
372#else
373 return (GrafPtr) inWindowRef ;
374#endif
375}
376
377void UMADisposeWindow( WindowRef inWindowRef )
378{
379 wxASSERT( inWindowRef != NULL ) ;
380 DisposeWindow( inWindowRef ) ;
381}
382
383void UMASetWTitleC( WindowRef inWindowRef , const char *title )
384{
385 Str255 ptitle ;
386 strncpy( (char*)ptitle , title , 96 ) ;
387 ptitle[96] = 0 ;
03e11df5
GD
388#if TARGET_CARBON
389 c2pstrcpy( ptitle, (char *)ptitle ) ;
390#else
72e7876b 391 c2pstr( (char*)ptitle ) ;
03e11df5 392#endif
72e7876b
SC
393 SetWTitle( inWindowRef , ptitle ) ;
394}
03e11df5 395
72e7876b
SC
396void UMAGetWTitleC( WindowRef inWindowRef , char *title )
397{
398 GetWTitle( inWindowRef , (unsigned char*)title ) ;
03e11df5
GD
399#if TARGET_CARBON
400 p2cstrcpy( title, (unsigned char *)title ) ;
401#else
72e7876b 402 p2cstr( (unsigned char*)title ) ;
03e11df5 403#endif
72e7876b
SC
404}
405
72e7876b
SC
406// appearance additions
407
408void UMAActivateControl( ControlHandle inControl )
409{
22e751a5
SC
410 // we have to add the control after again to the update rgn
411 // otherwise updates get lost
412 if ( !IsControlActive( inControl ) )
413 {
fdaf613a
SC
414 bool visible = IsControlVisible( inControl ) ;
415 if ( visible )
416 SetControlVisibility( inControl , false , false ) ;
3f4902f5 417 ::ActivateControl( inControl ) ;
fdaf613a
SC
418 if ( visible ) {
419 SetControlVisibility( inControl , true , false ) ;
c36f0244
SC
420 Rect ctrlBounds ;
421 InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
fdaf613a 422 }
22e751a5 423 }
72e7876b
SC
424}
425
426void UMADrawControl( ControlHandle inControl )
427{
3f4902f5
GD
428 WindowRef theWindow = GetControlOwner(inControl) ;
429 RgnHandle updateRgn = NewRgn() ;
3f4902f5 430 GetWindowUpdateRgn( theWindow , updateRgn ) ;
22e751a5
SC
431 Point zero = { 0 , 0 } ;
432 LocalToGlobal( &zero ) ;
433 OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
434 ::DrawControlInCurrentPort( inControl ) ;
435 InvalWindowRgn( theWindow, updateRgn) ;
436 DisposeRgn( updateRgn ) ;
72e7876b
SC
437}
438
439void UMAMoveControl( ControlHandle inControl , short x , short y )
440{
72055702
SC
441 bool visible = IsControlVisible( inControl ) ;
442 if ( visible ) {
443 SetControlVisibility( inControl , false , false ) ;
444 Rect ctrlBounds ;
445 InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
446 }
447 ::MoveControl( inControl , x , y ) ;
448 if ( visible ) {
449 SetControlVisibility( inControl , true , false ) ;
450 Rect ctrlBounds ;
451 InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
452 }
72e7876b
SC
453}
454
455void UMASizeControl( ControlHandle inControl , short x , short y )
456{
72055702
SC
457 bool visible = IsControlVisible( inControl ) ;
458 if ( visible ) {
459 SetControlVisibility( inControl , false , false ) ;
460 Rect ctrlBounds ;
461 InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
b03e4fcd 462 }
72055702
SC
463 ::SizeControl( inControl , x , y ) ;
464 if ( visible ) {
465 SetControlVisibility( inControl , true , false ) ;
466 Rect ctrlBounds ;
467 InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
468 }
72e7876b
SC
469}
470
471void UMADeactivateControl( ControlHandle inControl )
472{
22e751a5
SC
473 // we have to add the control after again to the update rgn
474 // otherwise updates get lost
72055702
SC
475 bool visible = IsControlVisible( inControl ) ;
476 if ( visible )
477 SetControlVisibility( inControl , false , false ) ;
478 ::DeactivateControl( inControl ) ;
479 if ( visible ) {
480 SetControlVisibility( inControl , true , false ) ;
481 Rect ctrlBounds ;
482 InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
483 }
72e7876b 484}
fdaf613a 485// shows the control and adds the region to the update region
3f4902f5 486void UMAShowControl (ControlHandle inControl)
72e7876b 487{
fdaf613a 488 SetControlVisibility( inControl , true , false ) ;
c36f0244
SC
489 Rect ctrlBounds ;
490 InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
72e7876b
SC
491}
492
22e751a5
SC
493// shows the control and adds the region to the update region
494void UMAHideControl (ControlHandle inControl)
495{
496 SetControlVisibility( inControl , false , false ) ;
497 Rect ctrlBounds ;
498 InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
499}
72e7876b
SC
500// keyboard focus
501OSErr UMASetKeyboardFocus (WindowPtr inWindow,
502 ControlHandle inControl,
503 ControlFocusPart inPart)
504{
2f1ae414
SC
505 OSErr err = noErr;
506 GrafPtr port ;
507 GetPort( &port ) ;
72055702
SC
508
509 SetPortWindowPort( inWindow ) ;
510
72055702 511 err = SetKeyboardFocus( inWindow , inControl , inPart ) ;
2f1ae414
SC
512 SetPort( port ) ;
513 return err ;
72e7876b
SC
514}
515
516
517
518
519// events
72e7876b
SC
520void UMAUpdateControls( WindowPtr inWindow , RgnHandle inRgn )
521{
72055702
SC
522 RgnHandle updateRgn = NewRgn() ;
523 GetWindowUpdateRgn( inWindow , updateRgn ) ;
524
be57fda6
SC
525 Point zero = { 0 , 0 } ;
526 LocalToGlobal( &zero ) ;
527 OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
72e7876b 528
72055702
SC
529 UpdateControls( inWindow , inRgn ) ;
530 InvalWindowRgn( inWindow, updateRgn) ;
531 DisposeRgn( updateRgn ) ;
72e7876b 532
72e7876b
SC
533}
534
535bool UMAIsWindowFloating( WindowRef inWindow )
536{
537 WindowClass cl ;
538
72055702 539 GetWindowClass( inWindow , &cl ) ;
72e7876b
SC
540 return cl == kFloatingWindowClass ;
541}
542
543bool UMAIsWindowModal( WindowRef inWindow )
544{
545 WindowClass cl ;
546
72055702 547 GetWindowClass( inWindow , &cl ) ;
72e7876b
SC
548 return cl < kFloatingWindowClass ;
549}
550
551// others
552
553void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate )
554{
555 if ( inWindowRef )
556 {
557// bool isHighlighted = IsWindowHighlited( inWindowRef ) ;
558// if ( inActivate != isHightlited )
c809f3be
SC
559 GrafPtr port ;
560 GetPort( &port ) ;
72055702 561 SetPortWindowPort( inWindowRef ) ;
c809f3be
SC
562 HiliteWindow( inWindowRef , inActivate ) ;
563 ControlHandle control = NULL ;
72055702 564 ::GetRootControl( inWindowRef , & control ) ;
c809f3be
SC
565 if ( control )
566 {
567 if ( inActivate )
568 UMAActivateControl( control ) ;
569 else
570 UMADeactivateControl( control ) ;
571 }
572 SetPort( port ) ;
72e7876b
SC
573 }
574}
2f1ae414
SC
575OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState )
576{
72055702 577 return ::DrawThemePlacard( inRect , inState ) ;
2f1ae414 578}
72e7876b 579
b03e4fcd
SC
580static OSStatus helpMenuStatus = noErr ;
581static MenuRef helpMenuHandle = NULL ;
582static MenuItemIndex firstCustomItemIndex = 0 ;
583
584OSStatus UMAGetHelpMenu(
585 MenuRef * outHelpMenu,
586 MenuItemIndex * outFirstCustomItemIndex)
587{
588#if TARGET_CARBON
589 return HMGetHelpMenu( outHelpMenu , outFirstCustomItemIndex ) ;
590#else
591 if ( helpMenuHandle == NULL )
592 {
593 helpMenuStatus = HMGetHelpMenuHandle( &helpMenuHandle ) ;
594 if ( helpMenuStatus == noErr )
595 {
596 firstCustomItemIndex = CountMenuItems( helpMenuHandle ) + 1 ;
597 }
598 }
599 if ( outFirstCustomItemIndex )
600 {
601 *outFirstCustomItemIndex = firstCustomItemIndex ;
602 }
603 *outHelpMenu = helpMenuHandle ;
604 return helpMenuStatus ;
605#endif
606}
76a5e5d2
SC
607
608wxMacPortStateHelper::wxMacPortStateHelper( GrafPtr newport)
609{
610 m_clip = NULL ;
611 Setup( newport ) ;
612}
613
614wxMacPortStateHelper::wxMacPortStateHelper()
615{
616 m_clip = NULL ;
617}
618
619void wxMacPortStateHelper::Setup( GrafPtr newport )
620{
621 GetPort( &m_oldPort ) ;
622 SetPort( newport ) ;
623 wxASSERT_MSG( m_clip == NULL , "Cannot call setup twice" ) ;
624 m_clip = NewRgn() ;
625 GetClip( m_clip );
626 m_textFont = GetPortTextFont( (CGrafPtr) newport);
627 m_textSize = GetPortTextSize( (CGrafPtr) newport);
628 m_textStyle = GetPortTextFace( (CGrafPtr) newport);
629 m_textMode = GetPortTextMode( (CGrafPtr) newport);
630 GetThemeDrawingState( &m_drawingState ) ;
631 m_currentPort = newport ;
632}
633void wxMacPortStateHelper::Clear()
634{
635 if ( m_clip )
636 {
637 DisposeRgn( m_clip ) ;
638 DisposeThemeDrawingState( m_drawingState ) ;
639 m_clip = NULL ;
640 }
641}
642
643wxMacPortStateHelper::~wxMacPortStateHelper()
644{
645 if ( m_clip )
646 {
647 SetPort( m_currentPort ) ;
648 SetClip( m_clip ) ;
649 DisposeRgn( m_clip ) ;
650 TextFont( m_textFont );
651 TextSize( m_textSize );
652 TextFace( m_textStyle );
653 TextMode( m_textMode );
654 SetThemeDrawingState( m_drawingState , true ) ;
655 SetPort( m_oldPort ) ;
656 }
657}
658