]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/uma.cpp
added generic dir dlg
[wxWidgets.git] / src / mac / carbon / uma.cpp
CommitLineData
03e11df5 1#include "wx/defs.h"
5fde6fcc 2#include "wx/dc.h"
03e11df5
GD
3#include "wx/mac/uma.h"
4#include "wx/mac/aga.h"
72e7876b 5
03e11df5 6#ifdef __UNIX__
5fde6fcc 7 #include <Carbon/Carbon.h>
03e11df5
GD
8#else
9 #include <Navigation.h>
10#endif
5b781a67 11
72e7876b
SC
12// init
13
e7b596fb
SC
14#if !TARGET_CARBON
15#define GetControlOwner( control ) (**control).contrlOwner
65608e3b
SC
16// since we always call this in the right context we don't have to set and reset the port
17#define InvalWindowRgn( window , rgn ) InvalRgn( rgn )
e7b596fb
SC
18#endif
19
72e7876b
SC
20static bool sUMAHasAppearance = false ;
21static long sUMAAppearanceVersion = 0 ;
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 ; }
5b781a67
SC
31void UMACleanupToolbox()
32{
33#if UMA_USE_APPEARANCE
34 if ( sUMAHasAppearance )
35 {
36 UnregisterAppearanceClient() ;
37 }
38#endif
39 if ( NavServicesAvailable() )
40 {
41 NavUnload() ;
42 }
43}
72e7876b
SC
44void UMAInitToolbox( UInt16 inMoreMastersCalls )
45{
46#if !TARGET_CARBON
47 ::MaxApplZone();
48 for (long i = 1; i <= inMoreMastersCalls; i++)
49 ::MoreMasters();
50
51 ::InitGraf(&qd.thePort);
52 ::InitFonts();
72e7876b
SC
53 ::InitMenus();
54 ::TEInit();
55 ::InitDialogs(0L);
56 ::FlushEvents(everyEvent, 0);
57 ::InitCursor();
58 long total,contig;
59 PurgeSpace(&total, &contig);
60#else
2f1ae414 61 InitCursor();
72e7876b
SC
62#endif
63
64#if UMA_USE_APPEARANCE
65 long theAppearance ;
66 if ( Gestalt( gestaltAppearanceAttr, &theAppearance ) == noErr )
67 {
68 sUMAHasAppearance = true ;
69 RegisterAppearanceClient();
70 if ( Gestalt( gestaltAppearanceVersion, &theAppearance ) == noErr )
71 {
72 sUMAAppearanceVersion = theAppearance ;
73 }
74 else
75 {
76 sUMAAppearanceVersion = 0x0100 ;
77 }
78 }
79#endif // UMA_USE_APPEARANCE
80#if UMA_USE_8_6
81#if UMA_USE_WINDOWMGR
82 if ( Gestalt( gestaltWindowMgrAttr, &sUMAWindowManagerAttr ) == noErr )
83 {
84 sUMAHasWindowManager = sUMAWindowManagerAttr & gestaltWindowMgrPresent ;
85 }
86#endif // UMA_USE_WINDOWMGR
87#endif
5b781a67 88
03e11df5 89#ifndef __UNIX__
8e8d3ba8
SC
90#if TARGET_CARBON
91// Call currently implicitely done : InitFloatingWindows() ;
92#else
5b781a67
SC
93 if ( sUMAHasWindowManager )
94 InitFloatingWindows() ;
95 else
96 InitWindows();
8e8d3ba8 97#endif
03e11df5 98#endif
5b781a67
SC
99
100 if ( NavServicesAvailable() )
101 {
102 NavLoad() ;
103 }
72e7876b
SC
104}
105
106// process manager
107long UMAGetProcessMode()
108{
109 OSErr err ;
110 ProcessInfoRec processinfo;
111 ProcessSerialNumber procno ;
112
113 procno.highLongOfPSN = NULL ;
114 procno.lowLongOfPSN = kCurrentProcess ;
115 processinfo.processInfoLength = sizeof(ProcessInfoRec);
116 processinfo.processName = NULL;
117 processinfo.processAppSpec = NULL;
118
119 err = ::GetProcessInformation( &procno , &processinfo ) ;
120 wxASSERT( err == noErr ) ;
121 return processinfo.processMode ;
122}
123
124bool UMAGetProcessModeDoesActivateOnFGSwitch()
125{
126 return UMAGetProcessMode() & modeDoesActivateOnFGSwitch ;
127}
128
129// menu manager
130
2f1ae414 131void UMASetMenuTitle( MenuRef menu , StringPtr title )
72e7876b
SC
132{
133#if !TARGET_CARBON
134 long size = GetHandleSize( (Handle) menu ) ;
135 const long headersize = 14 ;
136 int oldlen = (**menu).menuData[0] + 1;
137 int newlen = title[0] + 1 ;
138
139 if ( oldlen < newlen )
140 {
141 // enlarge before adjusting
142 SetHandleSize( (Handle) menu , size + (newlen - oldlen ) );
143 }
144
145 if ( oldlen != newlen )
146 memmove( (char*) (**menu).menuData + newlen , (char*) (**menu).menuData + oldlen , size - headersize - oldlen ) ;
147
148 memcpy( (char*) (**menu).menuData , title , newlen ) ;
149 if ( oldlen > newlen )
150 {
151 // shrink after
152 SetHandleSize( (Handle) menu , size + (newlen - oldlen ) ) ;
153 }
154#else
155 SetMenuTitle( menu , title ) ;
156#endif
157}
158
159UInt32 UMAMenuEvent( EventRecord *inEvent )
160{
2f1ae414 161#if UMA_USE_APPEARANCE
72e7876b
SC
162 if ( UMAHasAppearance() )
163 {
164 return MenuEvent( inEvent ) ;
165 }
166 else
2f1ae414 167#endif
72e7876b
SC
168 {
169 if ( inEvent->what == keyDown && inEvent->modifiers & cmdKey)
170 {
171 return MenuKey( inEvent->message & charCodeMask ) ;
172 }
173 return NULL ;
174 }
175}
176
177void UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex inItem )
178{
2f1ae414 179#if UMA_USE_8_6 || TARGET_CARBON
72e7876b
SC
180 EnableMenuItem( inMenu , inItem ) ;
181#else
182 EnableItem( inMenu , inItem ) ;
183#endif
184}
185
186void UMADisableMenuItem( MenuRef inMenu , MenuItemIndex inItem )
187{
2f1ae414 188#if UMA_USE_8_6 || TARGET_CARBON
72e7876b
SC
189 DisableMenuItem( inMenu , inItem ) ;
190#else
191 DisableItem( inMenu , inItem ) ;
192#endif
193}
2f1ae414
SC
194
195void UMAAppendSubMenuItem( MenuRef menu , StringPtr l , SInt16 id )
196{
197 Str255 label ;
198 memcpy( label , l , l[0]+1 ) ;
199 // hardcoded adding of the submenu combination for mac
200
201 int theEnd = label[0] + 1;
202 if (theEnd > 251)
203 theEnd = 251; // mac allows only 255 characters
204 label[theEnd++] = '/';
205 label[theEnd++] = hMenuCmd;
206 label[theEnd++] = '!';
207 label[theEnd++] = id ;
208 label[theEnd] = 0x00;
209 label[0] = theEnd;
210 MacAppendMenu(menu, label);
211}
212
213void UMAInsertSubMenuItem( MenuRef menu , StringPtr l , MenuItemIndex item , SInt16 id )
214{
215 Str255 label ;
216 memcpy( label , l , l[0]+1 ) ;
217 // hardcoded adding of the submenu combination for mac
218
219 int theEnd = label[0] + 1;
220 if (theEnd > 251)
221 theEnd = 251; // mac allows only 255 characters
222 label[theEnd++] = '/';
223 label[theEnd++] = hMenuCmd;
224 label[theEnd++] = '!';
225 label[theEnd++] = id;
226 label[theEnd] = 0x00;
227 label[0] = theEnd;
228 MacInsertMenuItem(menu, label , item);
229}
230
231void UMAAppendMenuItem( MenuRef menu , StringPtr l , SInt16 key, UInt8 modifiers )
232{
233 Str255 label ;
234 memcpy( label , l , l[0]+1 ) ;
235 if ( key )
236 {
237 int pos = label[0] ;
238 label[++pos] = '/';
239 label[++pos] = toupper( key );
240 label[0] = pos ;
241 }
242 MacAppendMenu( menu , label ) ;
243}
244
245void UMAInsertMenuItem( MenuRef menu , StringPtr l , MenuItemIndex item , SInt16 key, UInt8 modifiers )
246{
247 Str255 label ;
248 memcpy( label , l , l[0]+1 ) ;
249 if ( key )
250 {
251 int pos = label[0] ;
252 label[++pos] = '/';
253 label[++pos] = toupper( key );
254 label[0] = pos ;
255 }
256 MacInsertMenuItem( menu , label , item) ;
257}
258
259void UMADrawMenuBar()
260{
261 DrawMenuBar() ;
262}
263
264
265void UMASetMenuItemText( MenuRef menu , MenuItemIndex item , StringPtr label )
266{
267 ::SetMenuItemText( menu , item , label ) ;
268}
269
270MenuRef UMANewMenu( SInt16 menuid , StringPtr label )
271{
272 return ::NewMenu(menuid, label);
273}
274
275void UMADisposeMenu( MenuRef menu )
276{
277 DisposeMenu( menu ) ;
278}
279void UMADeleteMenu( SInt16 menuId )
280{
281 ::DeleteMenu( menuId ) ;
282}
283
284void UMAInsertMenu( MenuRef insertMenu , SInt16 afterId )
285{
286 ::InsertMenu( insertMenu , afterId ) ;
287}
288
289
72e7876b
SC
290// quickdraw
291
2f1ae414
SC
292int gPrOpenCounter = 0 ;
293
5b781a67 294OSStatus UMAPrOpen()
2f1ae414
SC
295{
296#if !TARGET_CARBON
297 OSErr err = noErr ;
298 ++gPrOpenCounter ;
299 if ( gPrOpenCounter == 1 )
300 {
301 PrOpen() ;
302 err = PrError() ;
303 wxASSERT( err == noErr ) ;
304 }
5b781a67 305 return err ;
2f1ae414 306#else
5b781a67
SC
307 OSStatus err = noErr ;
308 ++gPrOpenCounter ;
309 if ( gPrOpenCounter == 1 )
310 {
311 err = PMBegin() ;
312 wxASSERT( err == noErr ) ;
313 }
314 return err ;
2f1ae414
SC
315#endif
316}
317
5b781a67 318OSStatus UMAPrClose()
2f1ae414
SC
319{
320#if !TARGET_CARBON
321 OSErr err = noErr ;
322 wxASSERT( gPrOpenCounter >= 1 ) ;
323 if ( gPrOpenCounter == 1 )
324 {
325 PrClose() ;
326 err = PrError() ;
327 wxASSERT( err == noErr ) ;
328 }
329 --gPrOpenCounter ;
5b781a67 330 return err ;
2f1ae414 331#else
5b781a67
SC
332 OSStatus err = noErr ;
333 wxASSERT( gPrOpenCounter >= 1 ) ;
334 if ( gPrOpenCounter == 1 )
335 {
336 err = PMEnd() ;
337 }
338 --gPrOpenCounter ;
339 return err ;
2f1ae414
SC
340#endif
341}
342
72e7876b
SC
343#if !TARGET_CARBON
344
345pascal QDGlobalsPtr GetQDGlobalsPtr (void)
346{
347 return QDGlobalsPtr (* (Ptr*) LMGetCurrentA5 ( ) - 0xCA);
348}
349
350#endif
351
352void UMAShowWatchCursor()
353{
354 OSErr err = noErr;
355
356 CursHandle watchFob = GetCursor (watchCursor);
357
358 if (!watchFob)
359 err = nilHandleErr;
360 else
361 {
362 #if TARGET_CARBON
363 Cursor preservedArrow;
364 GetQDGlobalsArrow (&preservedArrow);
365 SetQDGlobalsArrow (*watchFob);
366 InitCursor ( );
367 SetQDGlobalsArrow (&preservedArrow);
368 #else
369 SetCursor (*watchFob);
370 #endif
371 }
372}
373
374void UMAShowArrowCursor()
375{
376#if TARGET_CARBON
377 Cursor arrow;
378 SetCursor (GetQDGlobalsArrow (&arrow));
379#else
380 SetCursor (&(qd.arrow));
381#endif
382}
383
384// window manager
385
386GrafPtr UMAGetWindowPort( WindowRef inWindowRef )
387{
388 wxASSERT( inWindowRef != NULL ) ;
389#if TARGET_CARBON
390 return GetWindowPort( inWindowRef ) ;
391#else
392 return (GrafPtr) inWindowRef ;
393#endif
394}
395
396void UMADisposeWindow( WindowRef inWindowRef )
397{
398 wxASSERT( inWindowRef != NULL ) ;
399 DisposeWindow( inWindowRef ) ;
400}
401
402void UMASetWTitleC( WindowRef inWindowRef , const char *title )
403{
404 Str255 ptitle ;
405 strncpy( (char*)ptitle , title , 96 ) ;
406 ptitle[96] = 0 ;
03e11df5
GD
407#if TARGET_CARBON
408 c2pstrcpy( ptitle, (char *)ptitle ) ;
409#else
72e7876b 410 c2pstr( (char*)ptitle ) ;
03e11df5 411#endif
72e7876b
SC
412 SetWTitle( inWindowRef , ptitle ) ;
413}
03e11df5 414
72e7876b
SC
415void UMAGetWTitleC( WindowRef inWindowRef , char *title )
416{
417 GetWTitle( inWindowRef , (unsigned char*)title ) ;
03e11df5
GD
418#if TARGET_CARBON
419 p2cstrcpy( title, (unsigned char *)title ) ;
420#else
72e7876b 421 p2cstr( (unsigned char*)title ) ;
03e11df5 422#endif
72e7876b
SC
423}
424
425void UMAShowWindow( WindowRef inWindowRef )
426{
427 ShowWindow( inWindowRef ) ;
428}
429
430void UMAHideWindow( WindowRef inWindowRef )
431{
432 HideWindow( inWindowRef) ;
433}
434
435void UMASelectWindow( WindowRef inWindowRef )
436{
437 SelectWindow( inWindowRef ) ;
438}
439
440void UMABringToFront( WindowRef inWindowRef )
441{
442 BringToFront( inWindowRef ) ;
443}
444
445void UMASendBehind( WindowRef inWindowRef , WindowRef behindWindow )
446{
447 SendBehind( inWindowRef , behindWindow ) ;
448}
449
450void UMACloseWindow(WindowRef inWindowRef)
451{
452#if TARGET_CARBON
453#else
454 CloseWindow( inWindowRef ) ;
455#endif
456}
457
458// appearance additions
459
460void UMAActivateControl( ControlHandle inControl )
461{
3f4902f5
GD
462 WindowRef theWindow = GetControlOwner(inControl) ;
463 RgnHandle updateRgn = NewRgn() ;
be57fda6 464#if TARGET_CARBON
3f4902f5
GD
465 GetWindowRegion( theWindow , kWindowUpdateRgn, updateRgn ) ;
466#else
467 GetWindowUpdateRgn( theWindow , updateRgn ) ;
468#endif
be57fda6
SC
469 Point zero = { 0 , 0 } ;
470 LocalToGlobal( &zero ) ;
471 OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
2f1ae414 472#if UMA_USE_APPEARANCE
3f4902f5
GD
473 if ( UMAHasAppearance() )
474 {
475 ::ActivateControl( inControl ) ;
476 }
477 else
2f1ae414
SC
478#endif
479#if !TARGET_CARBON
3f4902f5
GD
480 {
481 AGAActivateControl( inControl ) ;
482 }
2f1ae414 483#else
3f4902f5
GD
484 {
485 }
486#endif
65608e3b 487#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
3f4902f5
GD
488 InvalWindowRgn( theWindow, updateRgn) ;
489#else
490 InvalRgn( updateRgn ) ;
2f1ae414 491#endif
be57fda6
SC
492 DisposeRgn( updateRgn ) ;
493
494DisposeRgn( updateRgn ) ;
495
72e7876b
SC
496}
497
498void UMADrawControl( ControlHandle inControl )
499{
3f4902f5
GD
500 WindowRef theWindow = GetControlOwner(inControl) ;
501 RgnHandle updateRgn = NewRgn() ;
be57fda6 502#if TARGET_CARBON
3f4902f5
GD
503 GetWindowRegion( theWindow , kWindowUpdateRgn, updateRgn ) ;
504#else
505 GetWindowUpdateRgn( theWindow , updateRgn ) ;
506#endif
be57fda6
SC
507 Point zero = { 0 , 0 } ;
508 LocalToGlobal( &zero ) ;
509 OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
2f1ae414 510#if UMA_USE_APPEARANCE
3f4902f5
GD
511 if ( UMAHasAppearance() )
512 {
513 ::DrawControlInCurrentPort( inControl ) ;
514 }
515 else
2f1ae414
SC
516#endif
517#if !TARGET_CARBON
3f4902f5
GD
518 {
519 AGADrawControl( inControl ) ;
520 }
2f1ae414 521#else
3f4902f5
GD
522 {
523 }
524#endif
65608e3b 525#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
3f4902f5
GD
526 InvalWindowRgn( theWindow, updateRgn) ;
527#else
528 InvalRgn( updateRgn ) ;
2f1ae414 529#endif
be57fda6
SC
530 DisposeRgn( updateRgn ) ;
531
72e7876b
SC
532}
533
534void UMAMoveControl( ControlHandle inControl , short x , short y )
535{
3f4902f5
GD
536 WindowRef theWindow = GetControlOwner(inControl) ;
537 RgnHandle updateRgn = NewRgn() ;
be57fda6 538#if TARGET_CARBON
3f4902f5
GD
539 GetWindowRegion( theWindow , kWindowUpdateRgn, updateRgn ) ;
540#else
541 GetWindowUpdateRgn( theWindow , updateRgn ) ;
542#endif
be57fda6
SC
543 Point zero = { 0 , 0 } ;
544 LocalToGlobal( &zero ) ;
545 OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
2f1ae414 546#if UMA_USE_APPEARANCE
3f4902f5
GD
547 if ( UMAHasAppearance() )
548 {
549 ::MoveControl( inControl , x , y ) ;
550 }
551 else
2f1ae414
SC
552#endif
553#if !TARGET_CARBON
3f4902f5
GD
554 {
555 AGAMoveControl( inControl , x ,y ) ;
556 }
2f1ae414 557#else
3f4902f5
GD
558 {
559 }
560#endif
65608e3b 561#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
3f4902f5
GD
562 InvalWindowRgn( theWindow, updateRgn) ;
563#else
564 InvalRgn( updateRgn ) ;
2f1ae414 565#endif
be57fda6
SC
566 DisposeRgn( updateRgn ) ;
567
72e7876b
SC
568}
569
570void UMASizeControl( ControlHandle inControl , short x , short y )
571{
3f4902f5
GD
572 WindowRef theWindow = GetControlOwner(inControl) ;
573 RgnHandle updateRgn = NewRgn() ;
be57fda6 574#if TARGET_CARBON
3f4902f5
GD
575 GetWindowRegion( theWindow , kWindowUpdateRgn, updateRgn ) ;
576#else
577 GetWindowUpdateRgn( theWindow , updateRgn ) ;
578#endif
be57fda6
SC
579 Point zero = { 0 , 0 } ;
580 LocalToGlobal( &zero ) ;
581 OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
2f1ae414 582#if UMA_USE_APPEARANCE
3f4902f5
GD
583 if ( UMAHasAppearance() )
584 {
585 ::SizeControl( inControl , x , y ) ;
586 }
587 else
2f1ae414
SC
588#endif
589#if !TARGET_CARBON
3f4902f5
GD
590 {
591 AGASizeControl( inControl , x ,y ) ;
592 }
2f1ae414 593#else
3f4902f5
GD
594 {
595 }
596#endif
65608e3b 597#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
3f4902f5
GD
598 InvalWindowRgn( theWindow, updateRgn) ;
599#else
600 InvalRgn( updateRgn ) ;
2f1ae414 601#endif
be57fda6
SC
602 DisposeRgn( updateRgn ) ;
603
65608e3b 604
72e7876b
SC
605}
606
607void UMADeactivateControl( ControlHandle inControl )
608{
3f4902f5
GD
609 WindowRef theWindow = GetControlOwner(inControl) ;
610 RgnHandle updateRgn = NewRgn() ;
be57fda6 611#if TARGET_CARBON
3f4902f5
GD
612 GetWindowRegion( theWindow , kWindowUpdateRgn, updateRgn ) ;
613#else
614 GetWindowUpdateRgn( theWindow , updateRgn ) ;
615#endif
be57fda6
SC
616 Point zero = { 0 , 0 } ;
617 LocalToGlobal( &zero ) ;
618 OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
2f1ae414 619#if UMA_USE_APPEARANCE
3f4902f5
GD
620 if ( UMAHasAppearance() )
621 {
622 ::DeactivateControl( inControl ) ;
623 }
624 else
2f1ae414
SC
625#endif
626#if !TARGET_CARBON
3f4902f5
GD
627 {
628 AGADeactivateControl( inControl ) ;
629 }
2f1ae414 630#else
3f4902f5
GD
631 {
632 }
633#endif
65608e3b 634#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
3f4902f5
GD
635 InvalWindowRgn( theWindow, updateRgn) ;
636#else
637 InvalRgn( updateRgn ) ;
2f1ae414 638#endif
be57fda6
SC
639 DisposeRgn( updateRgn ) ;
640
72e7876b
SC
641}
642
3f4902f5
GD
643void UMASetThemeWindowBackground (WindowRef inWindow,
644 ThemeBrush inBrush,
645 Boolean inUpdate)
2f1ae414
SC
646{
647#if UMA_USE_APPEARANCE
3f4902f5
GD
648 if ( UMAHasAppearance() )
649 {
650 ::SetThemeWindowBackground( inWindow ,inBrush , inUpdate ) ;
651 }
652 else
2f1ae414
SC
653#endif
654#if !TARGET_CARBON
3f4902f5
GD
655 {
656 AGASetThemeWindowBackground( inWindow , inBrush , inUpdate ) ;
657 }
2f1ae414 658#else
3f4902f5
GD
659 {
660 }
2f1ae414 661#endif
72e7876b
SC
662}
663
2f1ae414
SC
664void UMAApplyThemeBackground (ThemeBackgroundKind inKind,
665 const Rect * bounds,
666 ThemeDrawState inState,
667 SInt16 inDepth,
668 Boolean inColorDev)
669{
670#if UMA_USE_APPEARANCE
671 if ( UMAHasAppearance() )
672 {
673 /*
674 if ( sUMAAppearanceVersion >= 0x0110 )
675 ::ApplyThemeBackground( inKind ,bounds , inState , inDepth , inColorDev ) ;
676 */
677 }
678 else
679#endif
680#if !TARGET_CARBON
681 {
682 AGAApplyThemeBackground( inKind ,bounds , inState , inDepth , inColorDev ) ;
683 }
684#else
685 {
686 }
687#endif
688}
72e7876b 689
3f4902f5
GD
690ControlHandle UMANewControl(WindowPtr owningWindow,
691 const Rect * boundsRect,
692 ConstStr255Param controlTitle,
693 Boolean initiallyVisible,
694 SInt16 initialValue,
695 SInt16 minimumValue,
696 SInt16 maximumValue,
697 SInt16 procID,
698 SInt32 controlReference)
72e7876b
SC
699{
700 ControlHandle theControl = NULL ;
2f1ae414 701#if UMA_USE_APPEARANCE
72e7876b
SC
702 if ( UMAHasAppearance() )
703 {
704 theControl = NewControl( owningWindow , boundsRect , controlTitle , initiallyVisible ,
705 initialValue , minimumValue , maximumValue , procID , controlReference ) ;
706 }
707 else
2f1ae414
SC
708#endif
709#if !TARGET_CARBON
72e7876b
SC
710 {
711 theControl = AGANewControl( owningWindow , boundsRect , controlTitle , initiallyVisible ,
712 initialValue , minimumValue , maximumValue , procID , controlReference ) ;
713 }
2f1ae414
SC
714#else
715 {
716 }
717#endif
72e7876b
SC
718 return theControl ;
719}
720
721void UMADisposeControl (ControlHandle theControl)
722{
3f4902f5
GD
723 if ( UMAHasAppearance() )
724 {
725 ::DisposeControl( theControl ) ;
726 }
727 else
728 {
729 ::DisposeControl( theControl ) ;
730 }
72e7876b
SC
731}
732
3f4902f5
GD
733void UMAHiliteControl (ControlHandle inControl,
734 ControlPartCode hiliteState)
735{
736 WindowRef theWindow = GetControlOwner(inControl) ;
737 RgnHandle updateRgn = NewRgn() ;
be57fda6 738#if TARGET_CARBON
3f4902f5
GD
739 GetWindowRegion( theWindow , kWindowUpdateRgn, updateRgn ) ;
740#else
741 GetWindowUpdateRgn( theWindow , updateRgn ) ;
742#endif
be57fda6
SC
743 Point zero = { 0 , 0 } ;
744 LocalToGlobal( &zero ) ;
745 OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
3f4902f5
GD
746 if ( UMAHasAppearance() )
747 {
748 ::HiliteControl( inControl , hiliteState ) ;
749 }
750 else
751 {
752 ::HiliteControl( inControl , hiliteState ) ;
753 }
65608e3b 754#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
3f4902f5
GD
755 InvalWindowRgn( theWindow, updateRgn) ;
756#else
757 InvalRgn( updateRgn ) ;
758#endif
be57fda6
SC
759 DisposeRgn( updateRgn ) ;
760
72e7876b
SC
761}
762
3f4902f5 763void UMAShowControl (ControlHandle inControl)
72e7876b 764{
3f4902f5
GD
765 WindowRef theWindow = GetControlOwner(inControl) ;
766 RgnHandle updateRgn = NewRgn() ;
be57fda6 767#if TARGET_CARBON
3f4902f5
GD
768 GetWindowRegion( theWindow , kWindowUpdateRgn, updateRgn ) ;
769#else
770 GetWindowUpdateRgn( theWindow , updateRgn ) ;
771#endif
be57fda6
SC
772 Point zero = { 0 , 0 } ;
773 LocalToGlobal( &zero ) ;
774 OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
3f4902f5
GD
775 if ( UMAHasAppearance() )
776 {
777 ::ShowControl( inControl ) ;
778 }
779 else
780 {
781 ::ShowControl( inControl ) ;
782 }
65608e3b 783#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
3f4902f5
GD
784 InvalWindowRgn( theWindow, updateRgn) ;
785#else
786 InvalRgn( updateRgn ) ;
787#endif
be57fda6
SC
788 DisposeRgn( updateRgn ) ;
789
72e7876b
SC
790}
791
792
3f4902f5 793void UMAHideControl (ControlHandle inControl)
72e7876b 794{
3f4902f5
GD
795 if ( UMAHasAppearance() )
796 {
797 ::HideControl( inControl ) ;
798 }
799 else
800 {
801 ::HideControl( inControl ) ;
802 }
72e7876b
SC
803}
804
805
806void UMASetControlVisibility (ControlHandle inControl,
807 Boolean inIsVisible,
808 Boolean inDoDraw)
3f4902f5
GD
809{
810 if ( UMAHasAppearance() )
811 {
2f1ae414 812#if UMA_USE_APPEARANCE
3f4902f5 813 ::SetControlVisibility( inControl , inIsVisible, inDoDraw ) ;
2f1ae414 814#endif
3f4902f5 815 }
72e7876b
SC
816}
817
818
819
820bool UMAIsControlActive (ControlHandle inControl)
821{
2f1ae414
SC
822#if TARGET_CARBON
823 return IsControlActive( inControl ) ;
824#else
825#if UMA_USE_APPEARANCE
72e7876b
SC
826 if ( UMAHasAppearance() )
827 {
828 return IsControlActive( inControl ) ;
829 }
830 else
2f1ae414 831#endif
72e7876b 832 return (**inControl).contrlHilite == 0 ;
2f1ae414 833#endif
72e7876b
SC
834}
835
836
837bool UMAIsControlVisible (ControlHandle inControl)
838{
2f1ae414 839#if UMA_USE_APPEARANCE
72e7876b
SC
840 if ( UMAHasAppearance() )
841 {
842 return IsControlVisible( inControl ) ;
843 }
2f1ae414 844#endif
72e7876b
SC
845 return true ;
846}
847
848OSErr UMAGetBestControlRect (ControlHandle inControl,
849 Rect * outRect,
850 SInt16 * outBaseLineOffset)
851{
2f1ae414 852#if UMA_USE_APPEARANCE
72e7876b
SC
853 if ( UMAHasAppearance() )
854 {
855 return GetBestControlRect( inControl , outRect , outBaseLineOffset ) ;
856 }
857 else
2f1ae414
SC
858#endif
859#if !TARGET_CARBON
72e7876b
SC
860 {
861 return AGAGetBestControlRect( inControl , outRect , outBaseLineOffset ) ;
862 }
2f1ae414
SC
863#else
864 {
865 return noErr ;
866 }
867#endif
72e7876b
SC
868}
869
870
871OSErr UMASetControlFontStyle (ControlHandle inControl,
872 const ControlFontStyleRec * inStyle)
873{
2f1ae414 874#if UMA_USE_APPEARANCE
72e7876b
SC
875 if ( UMAHasAppearance() )
876 {
877 return ::SetControlFontStyle( inControl , inStyle ) ;
878 }
879 else
2f1ae414
SC
880#endif
881#if !TARGET_CARBON
72e7876b 882 return AGASetControlFontStyle( inControl , inStyle ) ;
2f1ae414
SC
883#else
884 {
885 return noErr ;
886 }
887#endif
72e7876b
SC
888}
889
890
891
892// control hierarchy
893
894OSErr UMACreateRootControl (WindowPtr inWindow,
895 ControlHandle * outControl)
896{
2f1ae414 897#if UMA_USE_APPEARANCE
72e7876b
SC
898 if ( UMAHasAppearance() )
899 {
900 return CreateRootControl( inWindow , outControl ) ;
901 }
902 else
2f1ae414
SC
903#endif
904#if !TARGET_CARBON
72e7876b 905 return AGACreateRootControl( inWindow , outControl ) ;
2f1ae414
SC
906#else
907 {
908 return noErr ;
909 }
910#endif
72e7876b
SC
911}
912
913
914
915OSErr UMAEmbedControl (ControlHandle inControl,
916 ControlHandle inContainer)
917{
2f1ae414 918#if UMA_USE_APPEARANCE
72e7876b
SC
919 if ( UMAHasAppearance() )
920 {
921 return EmbedControl( inControl , inContainer ) ;
922 }
923 else
2f1ae414
SC
924#endif
925#if !TARGET_CARBON
72e7876b 926 return AGAEmbedControl( inControl , inContainer ) ; ;
2f1ae414
SC
927#else
928 {
929 return noErr ;
930 }
931#endif
72e7876b
SC
932}
933
934
935
936// keyboard focus
937OSErr UMASetKeyboardFocus (WindowPtr inWindow,
938 ControlHandle inControl,
939 ControlFocusPart inPart)
940{
2f1ae414
SC
941 OSErr err = noErr;
942 GrafPtr port ;
943 GetPort( &port ) ;
944#if TARGET_CARBON
945 SetPort( GetWindowPort( inWindow ) ) ;
946#else
947 SetPort( inWindow ) ;
948#endif
949 SetOrigin( 0 , 0 ) ;
950#if UMA_USE_APPEARANCE
72e7876b
SC
951 if ( UMAHasAppearance() )
952 {
2f1ae414 953 err = SetKeyboardFocus( inWindow , inControl , inPart ) ;
72e7876b
SC
954 }
955 else
2f1ae414
SC
956#endif
957#if !TARGET_CARBON
958 err = AGASetKeyboardFocus( inWindow , inControl , inPart ) ;
959#else
960 {
961 }
962#endif
963 SetPort( port ) ;
964 return err ;
72e7876b
SC
965}
966
967
968
969
970// events
971
972ControlPartCode UMAHandleControlClick (ControlHandle inControl,
973 Point inWhere,
974 SInt16 inModifiers,
975 ControlActionUPP inAction)
976{
2f1ae414 977#if UMA_USE_APPEARANCE
72e7876b
SC
978 if ( UMAHasAppearance() )
979 {
980 return HandleControlClick( inControl , inWhere , inModifiers , inAction ) ;
981 }
982 else
2f1ae414
SC
983#endif
984#if !TARGET_CARBON
72e7876b
SC
985 {
986 return AGAHandleControlClick( inControl , inWhere , inModifiers , inAction ) ;
987 }
2f1ae414
SC
988#else
989 {
990 return noErr ;
991 }
992#endif
72e7876b
SC
993}
994
995
996SInt16 UMAHandleControlKey (ControlHandle inControl,
997 SInt16 inKeyCode,
998 SInt16 inCharCode,
999 SInt16 inModifiers)
1000{
2f1ae414 1001#if UMA_USE_APPEARANCE
72e7876b
SC
1002 if ( UMAHasAppearance() )
1003 {
1004 return HandleControlKey( inControl , inKeyCode , inCharCode , inModifiers ) ;
1005 }
1006 else
2f1ae414
SC
1007#endif
1008#if !TARGET_CARBON
72e7876b
SC
1009 {
1010 return AGAHandleControlKey(inControl , inKeyCode , inCharCode , inModifiers ) ;
1011 }
2f1ae414
SC
1012#else
1013 {
1014 return noErr ;
1015 }
1016#endif
72e7876b
SC
1017}
1018
1019
1020
1021void UMAIdleControls (WindowPtr inWindow)
1022{
2f1ae414 1023#if UMA_USE_APPEARANCE
72e7876b
SC
1024 if ( UMAHasAppearance() )
1025 {
1026 IdleControls( inWindow ) ;
1027 }
1028 else
2f1ae414
SC
1029#endif
1030#if !TARGET_CARBON
72e7876b
SC
1031 {
1032 AGAIdleControls( inWindow ) ;
1033 }
2f1ae414
SC
1034#else
1035 {
1036 }
1037#endif
72e7876b
SC
1038}
1039
1040void UMAUpdateControls( WindowPtr inWindow , RgnHandle inRgn )
1041{
3f4902f5 1042 RgnHandle updateRgn = NewRgn() ;
be57fda6 1043#if TARGET_CARBON
3f4902f5
GD
1044 GetWindowRegion( inWindow , kWindowUpdateRgn, updateRgn ) ;
1045#else
1046 GetWindowUpdateRgn( inWindow , updateRgn ) ;
1047#endif
be57fda6
SC
1048 Point zero = { 0 , 0 } ;
1049 LocalToGlobal( &zero ) ;
1050 OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
2f1ae414 1051#if UMA_USE_APPEARANCE
3f4902f5
GD
1052 if ( UMAHasAppearance() )
1053 {
1054 UpdateControls( inWindow , inRgn ) ;
1055 }
1056 else
2f1ae414
SC
1057#endif
1058#if !TARGET_CARBON
3f4902f5
GD
1059 {
1060 AGAUpdateControls( inWindow , inRgn ) ;
1061 }
2f1ae414 1062#else
3f4902f5
GD
1063 {
1064 }
1065#endif
65608e3b 1066#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
3f4902f5
GD
1067 InvalWindowRgn( inWindow, updateRgn) ;
1068#else
1069 InvalRgn( updateRgn ) ;
2f1ae414 1070#endif
be57fda6
SC
1071 DisposeRgn( updateRgn ) ;
1072
72e7876b
SC
1073}
1074
1075OSErr UMAGetRootControl( WindowPtr inWindow , ControlHandle *outControl )
1076{
2f1ae414 1077#if UMA_USE_APPEARANCE
72e7876b
SC
1078 if ( UMAHasAppearance() )
1079 {
1080 return GetRootControl( inWindow , outControl ) ;
1081 }
1082 else
2f1ae414
SC
1083#endif
1084#if !TARGET_CARBON
72e7876b
SC
1085 {
1086 return AGAGetRootControl( inWindow , outControl ) ;
1087 }
2f1ae414
SC
1088#else
1089 {
1090 return noErr ;
1091 }
1092#endif
72e7876b
SC
1093}
1094
1095
1096// handling control data
1097
1098OSErr UMASetControlData (ControlHandle inControl,
1099 ControlPartCode inPart,
1100 ResType inTagName,
1101 Size inSize,
1102 Ptr inData)
1103{
2f1ae414 1104#if UMA_USE_APPEARANCE
72e7876b
SC
1105 if ( UMAHasAppearance() )
1106 {
1107 return SetControlData( inControl , inPart , inTagName , inSize , inData ) ;
1108 }
1109 else
2f1ae414
SC
1110#endif
1111#if !TARGET_CARBON
72e7876b 1112 return AGASetControlData( inControl , inPart , inTagName , inSize , inData ) ;
2f1ae414
SC
1113#else
1114 {
1115 return noErr ;
1116 }
1117#endif
72e7876b
SC
1118}
1119
1120
1121
1122OSErr UMAGetControlData (ControlHandle inControl,
1123 ControlPartCode inPart,
1124 ResType inTagName,
1125 Size inBufferSize,
1126 Ptr outBuffer,
1127 Size * outActualSize)
1128{
2f1ae414 1129#if UMA_USE_APPEARANCE
72e7876b
SC
1130 if ( UMAHasAppearance() )
1131 {
1132 return ::GetControlData( inControl , inPart , inTagName , inBufferSize , outBuffer , outActualSize ) ;
1133 }
1134 else
2f1ae414
SC
1135#endif
1136#if !TARGET_CARBON
72e7876b
SC
1137 {
1138 return AGAGetControlData( inControl , inPart , inTagName , inBufferSize , outBuffer , outActualSize ) ;
1139 }
2f1ae414
SC
1140#else
1141 {
1142 return noErr ;
1143 }
1144#endif
72e7876b
SC
1145}
1146
1147
1148OSErr UMAGetControlDataSize (ControlHandle inControl,
1149 ControlPartCode inPart,
1150 ResType inTagName,
1151 Size * outMaxSize)
1152{
2f1ae414 1153#if UMA_USE_APPEARANCE
72e7876b
SC
1154 if ( UMAHasAppearance() )
1155 {
1156 return GetControlDataSize( inControl , inPart , inTagName , outMaxSize ) ;
1157 }
1158 else
2f1ae414
SC
1159#endif
1160#if !TARGET_CARBON
72e7876b
SC
1161 {
1162 return AGAGetControlDataSize( inControl , inPart , inTagName , outMaxSize ) ;
1163 }
2f1ae414
SC
1164#else
1165 {
1166 return noErr ;
1167 }
1168#endif
72e7876b
SC
1169}
1170
1171
1172
1173
1174
1175// system 8.0 changes
1176
1177short UMAFindWindow( Point inPoint , WindowRef *outWindow )
1178{
1179 // todo add the additional area codes
1180 return FindWindow( inPoint , outWindow ) ;
1181}
1182
1183OSStatus UMAGetWindowFeatures( WindowRef inWindowRef , UInt32 *outFeatures )
1184{
1185#if UMA_USE_WINDOWMGR
1186 return GetWindowFeatures( inWindowRef , outFeatures ) ;
1187#else
1188 return 0 ;
1189#endif
1190}
1191
1192OSStatus UMAGetWindowRegion( WindowRef inWindowRef , WindowRegionCode inRegionCode , RgnHandle ioWinRgn )
1193{
1194#if UMA_USE_WINDOWMGR
1195 return GetWindowRegion( inWindowRef , inRegionCode , ioWinRgn ) ;
1196#else
1197 return 0 ;
1198#endif
1199}
1200
1201void UMADrawGrowIcon( WindowRef inWindowRef )
1202{
1203 DrawGrowIcon( inWindowRef ) ;
1204}
1205
1206OSStatus UMACollapseWindow( WindowRef inWindowRef , Boolean inCollapseIt )
1207{
1208 return CollapseWindow( inWindowRef , inCollapseIt ) ;
1209}
1210
1211OSStatus UMACollapseAllWindows( Boolean inCollapseEm )
1212{
1213 return CollapseAllWindows( inCollapseEm ) ;
1214}
1215
1216Boolean UMAIsWindowCollapsed( WindowRef inWindowRef )
1217{
1218 return IsWindowCollapsed( inWindowRef ) ;
1219}
1220
1221Boolean UMAIsWindowCollapsable( WindowRef inWindowRef )
1222{
1223 return IsWindowCollapsable( inWindowRef ) ;
1224}
1225
1226// system 8.5 changes<MacWindows.h>
1227OSStatus UMACreateNewWindow( WindowClass windowClass , WindowAttributes attributes , const Rect *bounds, WindowRef *outWindow )
1228{
1229#if UMA_USE_WINDOWMGR
1230 if ( UMAHasWindowManager() )
1231 {
1232 return CreateNewWindow( windowClass , attributes, bounds, outWindow ) ;
1233 }
1234 else
1235#endif
1236 {
1237 short procID ;
1238 if ( UMAHasAppearance() )
1239 {
1240 switch( windowClass )
1241 {
1242 case kMovableModalWindowClass :
1243 procID = kWindowMovableModalDialogProc;
1244 break ;
2f1ae414
SC
1245 case kModalWindowClass :
1246 procID = kWindowShadowDialogProc;
1247 break ;
1248 case kFloatingWindowClass :
1249 if ( attributes & kWindowSideTitlebarAttribute )
1250 {
1251 if( ( attributes & kWindowResizableAttribute ) &&
1252 ( attributes & kWindowFullZoomAttribute ) )
1253 {
1254 procID = kWindowFloatSideFullZoomGrowProc ;
1255 }
1256 else if( attributes & kWindowFullZoomAttribute )
1257 {
1258 procID = kWindowFloatSideFullZoomProc;
1259 }
1260 else if ( attributes & kWindowResizableAttribute )
1261 {
1262 procID = kWindowFloatSideGrowProc;
1263 }
1264 else
1265 {
1266 procID = kWindowFloatSideProc;
1267 }
1268 }
1269 else
1270 {
1271 if( ( attributes & kWindowResizableAttribute ) &&
1272 ( attributes & kWindowFullZoomAttribute ) )
1273 {
1274 procID = kWindowFloatFullZoomGrowProc ;
1275 }
1276 else if( attributes & kWindowFullZoomAttribute )
1277 {
1278 procID = kWindowFloatFullZoomProc;
1279 }
1280 else if ( attributes & kWindowResizableAttribute )
1281 {
1282 procID = kWindowFloatGrowProc;
1283 }
1284 else
1285 {
1286 procID = kWindowFloatProc;
1287 }
1288 }
72e7876b 1289 break ;
2f1ae414 1290 case kDocumentWindowClass :
72e7876b 1291 default :
2f1ae414
SC
1292 if( ( attributes & kWindowResizableAttribute ) &&
1293 ( attributes & kWindowFullZoomAttribute ) )
1294 {
1295 procID = kWindowFullZoomGrowDocumentProc;
1296 }
1297 else if( attributes & kWindowFullZoomAttribute )
1298 {
1299 procID = kWindowFullZoomDocumentProc;
1300 }
1301 else if ( attributes & kWindowResizableAttribute )
1302 {
1303 procID = kWindowGrowDocumentProc;
1304 }
1305 else
1306 {
1307 procID = kWindowDocumentProc;
1308 }
72e7876b
SC
1309 break ;
1310 }
1311 }
1312 else
1313 {
1314 switch( windowClass )
1315 {
1316 case kMovableModalWindowClass :
1317 procID = movableDBoxProc;
72e7876b 1318 break ;
2f1ae414
SC
1319 case kModalWindowClass :
1320 procID = altDBoxProc;
1321 break ;
1322 case kFloatingWindowClass :
1323 if ( attributes & kWindowSideTitlebarAttribute )
1324 {
1325 if( ( attributes & kWindowResizableAttribute ) &&
1326 ( attributes & kWindowFullZoomAttribute ) )
1327 {
1328 procID = floatSideZoomGrowProc ;
1329 }
1330 else if( attributes & kWindowFullZoomAttribute )
1331 {
1332 procID = floatSideZoomProc;
1333 }
1334 else if ( attributes & kWindowResizableAttribute )
1335 {
1336 procID = floatSideGrowProc;
1337 }
1338 else
1339 {
1340 procID = floatSideProc;
1341 }
1342 }
1343 else
1344 {
1345 if( ( attributes & kWindowResizableAttribute ) &&
1346 ( attributes & kWindowFullZoomAttribute ) )
1347 {
1348 procID = floatZoomGrowProc ;
1349 }
1350 else if( attributes & kWindowFullZoomAttribute )
1351 {
1352 procID = floatZoomProc;
1353 }
1354 else if ( attributes & kWindowResizableAttribute )
1355 {
1356 procID = floatGrowProc;
1357 }
1358 else
1359 {
1360 procID = floatProc;
1361 }
1362 }
72e7876b 1363 break ;
2f1ae414 1364 case kDocumentWindowClass :
72e7876b 1365 default :
2f1ae414
SC
1366 if( ( attributes & kWindowResizableAttribute ) &&
1367 ( attributes & kWindowFullZoomAttribute ) )
1368 {
1369 procID = zoomDocProc;
1370 }
1371 else if( attributes & kWindowFullZoomAttribute )
1372 {
1373 procID = zoomNoGrow;
1374 }
1375 else if ( attributes & kWindowResizableAttribute )
1376 {
1377 procID = documentProc;
1378 }
1379 else
1380 {
1381 procID = noGrowDocProc;
1382 }
1383 break ;
72e7876b
SC
1384 break ;
1385 }
1386 }
1387 *outWindow = NewCWindow(nil, bounds, "\p", false, procID, (WindowRef) -1 /*behind*/,
1388 attributes & kWindowCloseBoxAttribute , (long)NULL);
1389 return noErr ;
1390 }
1391}
1392
1393OSStatus UMAGetWindowClass( WindowRef inWindowRef , WindowClass *outWindowClass )
1394{
1395#if UMA_USE_WINDOWMGR
1396 if ( UMAHasWindowManager() )
1397 {
1398 return GetWindowClass( inWindowRef , outWindowClass ) ;
1399 }
1400 else
1401#endif
1402 return kDocumentWindowClass ;
1403}
1404
1405OSStatus UMAGetWindowAttributes( WindowRef inWindowRef , WindowAttributes *outAttributes )
1406{
1407#if UMA_USE_WINDOWMGR
1408 if ( UMAHasWindowManager() )
1409 {
1410 return GetWindowAttributes( inWindowRef , outAttributes ) ;
1411 }
1412#endif
1413 return kWindowNoAttributes ;
1414}
1415
1416void UMAShowFloatingWindows()
1417{
1418#if UMA_USE_WINDOWMGR
1419 if ( UMAHasWindowManager() )
1420 {
1421 ShowFloatingWindows() ;
1422 }
1423#endif
1424}
1425
1426void UMAHideFloatingWindows()
1427{
1428#if UMA_USE_WINDOWMGR
1429 if ( UMAHasWindowManager() )
1430 {
1431 HideFloatingWindows() ;
1432 }
1433#endif
1434}
1435
1436Boolean UMAAreFloatingWindowsVisible()
1437{
1438#if UMA_USE_WINDOWMGR
1439 if ( UMAHasWindowManager() )
1440 {
1441 return AreFloatingWindowsVisible() ;
1442 }
1443#endif
1444 return false ;
1445}
1446
1447WindowRef UMAFrontNonFloatingWindow()
1448{
1449#if UMA_USE_WINDOWMGR
1450 if ( UMAHasWindowManager() )
1451 {
1452 return FrontNonFloatingWindow() ;
1453 }
1454 else
1455#endif
1456 {
1457 return FrontWindow() ;
1458 }
1459}
1460
1461WindowRef UMAFrontWindow()
1462{
1463#if UMA_USE_WINDOWMGR
1464 if ( UMAHasWindowManager() )
1465 {
1466 return FrontWindow() ;
1467 }
1468 else
1469#endif
1470 {
1471 return FrontWindow() ;
1472 }
1473}
1474
1475WindowRef UMAGetActiveNonFloatingWindow()
1476{
1477 return NULL ;
1478}
1479
1480bool UMAIsWindowFloating( WindowRef inWindow )
1481{
1482 WindowClass cl ;
1483
1484 UMAGetWindowClass( inWindow , &cl ) ;
1485 return cl == kFloatingWindowClass ;
1486}
1487
1488bool UMAIsWindowModal( WindowRef inWindow )
1489{
1490 WindowClass cl ;
1491
1492 UMAGetWindowClass( inWindow , &cl ) ;
1493 return cl < kFloatingWindowClass ;
1494}
1495
1496// others
1497
1498void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate )
1499{
1500 if ( inWindowRef )
1501 {
1502// bool isHighlighted = IsWindowHighlited( inWindowRef ) ;
1503// if ( inActivate != isHightlited )
c809f3be
SC
1504 GrafPtr port ;
1505 GetPort( &port ) ;
1506#if TARGET_CARBON
1507 SetPort( GetWindowPort( inWindowRef ) ) ;
1508#else
1509 SetPort( inWindowRef ) ;
1510#endif
1511 SetOrigin( 0 , 0 ) ;
1512 HiliteWindow( inWindowRef , inActivate ) ;
1513 ControlHandle control = NULL ;
1514 UMAGetRootControl( inWindowRef , & control ) ;
1515 if ( control )
1516 {
1517 if ( inActivate )
1518 UMAActivateControl( control ) ;
1519 else
1520 UMADeactivateControl( control ) ;
1521 }
1522 SetPort( port ) ;
72e7876b
SC
1523 }
1524}
2f1ae414
SC
1525OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState )
1526{
1527#if UMA_USE_APPEARANCE
03e11df5
GD
1528 if ( UMAHasAppearance() )
1529 {
1530 ::DrawThemePlacard( inRect , inState ) ;
1531 }
1532 else
2f1ae414
SC
1533#endif
1534#if !TARGET_CARBON
03e11df5
GD
1535 {
1536 }
2f1ae414 1537#else
03e11df5
GD
1538 {
1539 }
2f1ae414
SC
1540#endif
1541}
72e7876b 1542