3 #include "wx/mac/uma.h"
4 #include "wx/mac/aga.h"
7 #include <Carbon/Carbon.h>
9 #include <Navigation.h>
15 #define GetControlOwner( control ) (**control).contrlOwner
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 )
20 static bool sUMAHasAppearance
= false ;
21 static long sUMAAppearanceVersion
= 0 ;
22 extern int gAGABackgroundColor
;
23 bool UMAHasAppearance() { return sUMAHasAppearance
; }
24 long UMAGetAppearanceVersion() { return sUMAAppearanceVersion
; }
26 static bool sUMAHasWindowManager
= false ;
27 static long sUMAWindowManagerAttr
= 0 ;
29 bool UMAHasWindowManager() { return sUMAHasWindowManager
; }
30 long UMAGetWindowManagerAttr() { return sUMAWindowManagerAttr
; }
31 void UMACleanupToolbox()
33 #if UMA_USE_APPEARANCE
34 if ( sUMAHasAppearance
)
36 UnregisterAppearanceClient() ;
39 if ( NavServicesAvailable() )
44 void UMAInitToolbox( UInt16 inMoreMastersCalls
)
48 for (long i
= 1; i
<= inMoreMastersCalls
; i
++)
51 ::InitGraf(&qd
.thePort
);
56 ::FlushEvents(everyEvent
, 0);
59 PurgeSpace(&total
, &contig
);
64 #if UMA_USE_APPEARANCE
66 if ( Gestalt( gestaltAppearanceAttr
, &theAppearance
) == noErr
)
68 sUMAHasAppearance
= true ;
69 RegisterAppearanceClient();
70 if ( Gestalt( gestaltAppearanceVersion
, &theAppearance
) == noErr
)
72 sUMAAppearanceVersion
= theAppearance
;
76 sUMAAppearanceVersion
= 0x0100 ;
79 #endif // UMA_USE_APPEARANCE
82 if ( Gestalt( gestaltWindowMgrAttr
, &sUMAWindowManagerAttr
) == noErr
)
84 sUMAHasWindowManager
= sUMAWindowManagerAttr
& gestaltWindowMgrPresent
;
86 #endif // UMA_USE_WINDOWMGR
91 // Call currently implicitely done : InitFloatingWindows() ;
93 if ( sUMAHasWindowManager
)
94 InitFloatingWindows() ;
100 if ( NavServicesAvailable() )
107 long UMAGetProcessMode()
110 ProcessInfoRec processinfo
;
111 ProcessSerialNumber procno
;
113 procno
.highLongOfPSN
= NULL
;
114 procno
.lowLongOfPSN
= kCurrentProcess
;
115 processinfo
.processInfoLength
= sizeof(ProcessInfoRec
);
116 processinfo
.processName
= NULL
;
117 processinfo
.processAppSpec
= NULL
;
119 err
= ::GetProcessInformation( &procno
, &processinfo
) ;
120 wxASSERT( err
== noErr
) ;
121 return processinfo
.processMode
;
124 bool UMAGetProcessModeDoesActivateOnFGSwitch()
126 return UMAGetProcessMode() & modeDoesActivateOnFGSwitch
;
131 void UMASetMenuTitle( MenuRef menu
, StringPtr title
)
134 long size
= GetHandleSize( (Handle
) menu
) ;
135 const long headersize
= 14 ;
136 int oldlen
= (**menu
).menuData
[0] + 1;
137 int newlen
= title
[0] + 1 ;
139 if ( oldlen
< newlen
)
141 // enlarge before adjusting
142 SetHandleSize( (Handle
) menu
, size
+ (newlen
- oldlen
) );
145 if ( oldlen
!= newlen
)
146 memmove( (char*) (**menu
).menuData
+ newlen
, (char*) (**menu
).menuData
+ oldlen
, size
- headersize
- oldlen
) ;
148 memcpy( (char*) (**menu
).menuData
, title
, newlen
) ;
149 if ( oldlen
> newlen
)
152 SetHandleSize( (Handle
) menu
, size
+ (newlen
- oldlen
) ) ;
155 SetMenuTitle( menu
, title
) ;
159 UInt32
UMAMenuEvent( EventRecord
*inEvent
)
161 #if UMA_USE_APPEARANCE
162 if ( UMAHasAppearance() )
164 return MenuEvent( inEvent
) ;
169 if ( inEvent
->what
== keyDown
&& inEvent
->modifiers
& cmdKey
)
171 return MenuKey( inEvent
->message
& charCodeMask
) ;
177 void UMAEnableMenuItem( MenuRef inMenu
, MenuItemIndex inItem
)
179 #if UMA_USE_8_6 || TARGET_CARBON
180 EnableMenuItem( inMenu
, inItem
) ;
182 EnableItem( inMenu
, inItem
) ;
186 void UMADisableMenuItem( MenuRef inMenu
, MenuItemIndex inItem
)
188 #if UMA_USE_8_6 || TARGET_CARBON
189 DisableMenuItem( inMenu
, inItem
) ;
191 DisableItem( inMenu
, inItem
) ;
195 void UMAAppendSubMenuItem( MenuRef menu
, StringPtr l
, SInt16 id
)
198 memcpy( label
, l
, l
[0]+1 ) ;
199 // hardcoded adding of the submenu combination for mac
201 int theEnd
= label
[0] + 1;
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;
210 MacAppendMenu(menu
, label
);
213 void UMAInsertSubMenuItem( MenuRef menu
, StringPtr l
, MenuItemIndex item
, SInt16 id
)
216 memcpy( label
, l
, l
[0]+1 ) ;
217 // hardcoded adding of the submenu combination for mac
219 int theEnd
= label
[0] + 1;
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;
228 MacInsertMenuItem(menu
, label
, item
);
231 void UMAAppendMenuItem( MenuRef menu
, StringPtr l
, SInt16 key
, UInt8 modifiers
)
234 memcpy( label
, l
, l
[0]+1 ) ;
239 label
[++pos
] = toupper( key
);
242 MacAppendMenu( menu
, label
) ;
245 void UMAInsertMenuItem( MenuRef menu
, StringPtr l
, MenuItemIndex item
, SInt16 key
, UInt8 modifiers
)
248 memcpy( label
, l
, l
[0]+1 ) ;
253 label
[++pos
] = toupper( key
);
256 MacInsertMenuItem( menu
, label
, item
) ;
259 void UMADrawMenuBar()
265 void UMASetMenuItemText( MenuRef menu
, MenuItemIndex item
, StringPtr label
)
267 ::SetMenuItemText( menu
, item
, label
) ;
270 MenuRef
UMANewMenu( SInt16 menuid
, StringPtr label
)
272 return ::NewMenu(menuid
, label
);
275 void UMADisposeMenu( MenuRef menu
)
277 DisposeMenu( menu
) ;
279 void UMADeleteMenu( SInt16 menuId
)
281 ::DeleteMenu( menuId
) ;
284 void UMAInsertMenu( MenuRef insertMenu
, SInt16 afterId
)
286 ::InsertMenu( insertMenu
, afterId
) ;
292 int gPrOpenCounter
= 0 ;
299 if ( gPrOpenCounter
== 1 )
303 wxASSERT( err
== noErr
) ;
307 OSStatus err
= noErr
;
309 if ( gPrOpenCounter
== 1 )
312 wxASSERT( err
== noErr
) ;
318 OSStatus
UMAPrClose()
322 wxASSERT( gPrOpenCounter
>= 1 ) ;
323 if ( gPrOpenCounter
== 1 )
327 wxASSERT( err
== noErr
) ;
332 OSStatus err
= noErr
;
333 wxASSERT( gPrOpenCounter
>= 1 ) ;
334 if ( gPrOpenCounter
== 1 )
345 pascal QDGlobalsPtr
GetQDGlobalsPtr (void)
347 return QDGlobalsPtr (* (Ptr
*) LMGetCurrentA5 ( ) - 0xCA);
352 void UMAShowWatchCursor()
356 CursHandle watchFob
= GetCursor (watchCursor
);
363 Cursor preservedArrow
;
364 GetQDGlobalsArrow (&preservedArrow
);
365 SetQDGlobalsArrow (*watchFob
);
367 SetQDGlobalsArrow (&preservedArrow
);
369 SetCursor (*watchFob
);
374 void UMAShowArrowCursor()
378 SetCursor (GetQDGlobalsArrow (&arrow
));
380 SetCursor (&(qd
.arrow
));
386 GrafPtr
UMAGetWindowPort( WindowRef inWindowRef
)
388 wxASSERT( inWindowRef
!= NULL
) ;
390 return GetWindowPort( inWindowRef
) ;
392 return (GrafPtr
) inWindowRef
;
396 void UMADisposeWindow( WindowRef inWindowRef
)
398 wxASSERT( inWindowRef
!= NULL
) ;
399 DisposeWindow( inWindowRef
) ;
402 void UMASetWTitleC( WindowRef inWindowRef
, const char *title
)
405 strncpy( (char*)ptitle
, title
, 96 ) ;
408 c2pstrcpy( ptitle
, (char *)ptitle
) ;
410 c2pstr( (char*)ptitle
) ;
412 SetWTitle( inWindowRef
, ptitle
) ;
415 void UMAGetWTitleC( WindowRef inWindowRef
, char *title
)
417 GetWTitle( inWindowRef
, (unsigned char*)title
) ;
419 p2cstrcpy( title
, (unsigned char *)title
) ;
421 p2cstr( (unsigned char*)title
) ;
425 void UMAShowWindow( WindowRef inWindowRef
)
427 ShowWindow( inWindowRef
) ;
430 void UMAHideWindow( WindowRef inWindowRef
)
432 HideWindow( inWindowRef
) ;
435 void UMASelectWindow( WindowRef inWindowRef
)
437 SelectWindow( inWindowRef
) ;
440 void UMABringToFront( WindowRef inWindowRef
)
442 BringToFront( inWindowRef
) ;
445 void UMASendBehind( WindowRef inWindowRef
, WindowRef behindWindow
)
447 SendBehind( inWindowRef
, behindWindow
) ;
450 void UMACloseWindow(WindowRef inWindowRef
)
454 CloseWindow( inWindowRef
) ;
458 // appearance additions
460 void UMAActivateControl( ControlHandle inControl
)
462 WindowRef theWindow
= GetControlOwner(inControl
) ;
463 RgnHandle updateRgn
= NewRgn() ;
465 GetWindowRegion( theWindow
, kWindowUpdateRgn
, updateRgn
) ;
467 GetWindowUpdateRgn( theWindow
, updateRgn
) ;
469 Point zero
= { 0 , 0 } ;
470 LocalToGlobal( &zero
) ;
471 OffsetRgn( updateRgn
, -zero
.h
, -zero
.v
) ;
472 #if UMA_USE_APPEARANCE
473 if ( UMAHasAppearance() )
475 ::ActivateControl( inControl
) ;
481 AGAActivateControl( inControl
) ;
487 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
488 InvalWindowRgn( theWindow
, updateRgn
) ;
490 InvalRgn( updateRgn
) ;
492 DisposeRgn( updateRgn
) ;
494 DisposeRgn( updateRgn
) ;
498 void UMADrawControl( ControlHandle inControl
)
500 WindowRef theWindow
= GetControlOwner(inControl
) ;
501 RgnHandle updateRgn
= NewRgn() ;
503 GetWindowRegion( theWindow
, kWindowUpdateRgn
, updateRgn
) ;
505 GetWindowUpdateRgn( theWindow
, updateRgn
) ;
507 Point zero
= { 0 , 0 } ;
508 LocalToGlobal( &zero
) ;
509 OffsetRgn( updateRgn
, -zero
.h
, -zero
.v
) ;
510 #if UMA_USE_APPEARANCE
511 if ( UMAHasAppearance() )
513 ::DrawControlInCurrentPort( inControl
) ;
519 AGADrawControl( inControl
) ;
525 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
526 InvalWindowRgn( theWindow
, updateRgn
) ;
528 InvalRgn( updateRgn
) ;
530 DisposeRgn( updateRgn
) ;
534 void UMAMoveControl( ControlHandle inControl
, short x
, short y
)
536 WindowRef theWindow
= GetControlOwner(inControl
) ;
537 RgnHandle updateRgn
= NewRgn() ;
539 GetWindowRegion( theWindow
, kWindowUpdateRgn
, updateRgn
) ;
541 GetWindowUpdateRgn( theWindow
, updateRgn
) ;
543 Point zero
= { 0 , 0 } ;
544 LocalToGlobal( &zero
) ;
545 OffsetRgn( updateRgn
, -zero
.h
, -zero
.v
) ;
546 #if UMA_USE_APPEARANCE
547 if ( UMAHasAppearance() )
549 ::MoveControl( inControl
, x
, y
) ;
555 AGAMoveControl( inControl
, x
,y
) ;
561 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
562 InvalWindowRgn( theWindow
, updateRgn
) ;
564 InvalRgn( updateRgn
) ;
566 DisposeRgn( updateRgn
) ;
570 void UMASizeControl( ControlHandle inControl
, short x
, short y
)
572 WindowRef theWindow
= GetControlOwner(inControl
) ;
573 RgnHandle updateRgn
= NewRgn() ;
575 GetWindowRegion( theWindow
, kWindowUpdateRgn
, updateRgn
) ;
577 GetWindowUpdateRgn( theWindow
, updateRgn
) ;
579 Point zero
= { 0 , 0 } ;
580 LocalToGlobal( &zero
) ;
581 OffsetRgn( updateRgn
, -zero
.h
, -zero
.v
) ;
582 #if UMA_USE_APPEARANCE
583 if ( UMAHasAppearance() )
585 ::SizeControl( inControl
, x
, y
) ;
591 AGASizeControl( inControl
, x
,y
) ;
597 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
598 InvalWindowRgn( theWindow
, updateRgn
) ;
600 InvalRgn( updateRgn
) ;
602 DisposeRgn( updateRgn
) ;
607 void UMADeactivateControl( ControlHandle inControl
)
609 WindowRef theWindow
= GetControlOwner(inControl
) ;
610 RgnHandle updateRgn
= NewRgn() ;
612 GetWindowRegion( theWindow
, kWindowUpdateRgn
, updateRgn
) ;
614 GetWindowUpdateRgn( theWindow
, updateRgn
) ;
616 Point zero
= { 0 , 0 } ;
617 LocalToGlobal( &zero
) ;
618 OffsetRgn( updateRgn
, -zero
.h
, -zero
.v
) ;
619 #if UMA_USE_APPEARANCE
620 if ( UMAHasAppearance() )
622 ::DeactivateControl( inControl
) ;
628 AGADeactivateControl( inControl
) ;
634 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
635 InvalWindowRgn( theWindow
, updateRgn
) ;
637 InvalRgn( updateRgn
) ;
639 DisposeRgn( updateRgn
) ;
643 void UMASetThemeWindowBackground (WindowRef inWindow
,
647 #if UMA_USE_APPEARANCE
648 if ( UMAHasAppearance() )
650 ::SetThemeWindowBackground( inWindow
,inBrush
, inUpdate
) ;
656 AGASetThemeWindowBackground( inWindow
, inBrush
, inUpdate
) ;
664 void UMAApplyThemeBackground (ThemeBackgroundKind inKind
,
666 ThemeDrawState inState
,
670 #if UMA_USE_APPEARANCE
671 if ( UMAHasAppearance() )
674 if ( sUMAAppearanceVersion >= 0x0110 )
675 ::ApplyThemeBackground( inKind ,bounds , inState , inDepth , inColorDev ) ;
682 AGAApplyThemeBackground( inKind
,bounds
, inState
, inDepth
, inColorDev
) ;
690 ControlHandle
UMANewControl(WindowPtr owningWindow
,
691 const Rect
* boundsRect
,
692 ConstStr255Param controlTitle
,
693 Boolean initiallyVisible
,
698 SInt32 controlReference
)
700 ControlHandle theControl
= NULL
;
701 #if UMA_USE_APPEARANCE
702 if ( UMAHasAppearance() )
704 theControl
= NewControl( owningWindow
, boundsRect
, controlTitle
, initiallyVisible
,
705 initialValue
, minimumValue
, maximumValue
, procID
, controlReference
) ;
711 theControl
= AGANewControl( owningWindow
, boundsRect
, controlTitle
, initiallyVisible
,
712 initialValue
, minimumValue
, maximumValue
, procID
, controlReference
) ;
721 void UMADisposeControl (ControlHandle theControl
)
723 if ( UMAHasAppearance() )
725 ::DisposeControl( theControl
) ;
729 ::DisposeControl( theControl
) ;
733 void UMAHiliteControl (ControlHandle inControl
,
734 ControlPartCode hiliteState
)
736 WindowRef theWindow
= GetControlOwner(inControl
) ;
737 RgnHandle updateRgn
= NewRgn() ;
739 GetWindowRegion( theWindow
, kWindowUpdateRgn
, updateRgn
) ;
741 GetWindowUpdateRgn( theWindow
, updateRgn
) ;
743 Point zero
= { 0 , 0 } ;
744 LocalToGlobal( &zero
) ;
745 OffsetRgn( updateRgn
, -zero
.h
, -zero
.v
) ;
746 if ( UMAHasAppearance() )
748 ::HiliteControl( inControl
, hiliteState
) ;
752 ::HiliteControl( inControl
, hiliteState
) ;
754 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
755 InvalWindowRgn( theWindow
, updateRgn
) ;
757 InvalRgn( updateRgn
) ;
759 DisposeRgn( updateRgn
) ;
763 void UMAShowControl (ControlHandle inControl
)
765 WindowRef theWindow
= GetControlOwner(inControl
) ;
766 RgnHandle updateRgn
= NewRgn() ;
768 GetWindowRegion( theWindow
, kWindowUpdateRgn
, updateRgn
) ;
770 GetWindowUpdateRgn( theWindow
, updateRgn
) ;
772 Point zero
= { 0 , 0 } ;
773 LocalToGlobal( &zero
) ;
774 OffsetRgn( updateRgn
, -zero
.h
, -zero
.v
) ;
775 if ( UMAHasAppearance() )
777 ::ShowControl( inControl
) ;
781 ::ShowControl( inControl
) ;
783 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
784 InvalWindowRgn( theWindow
, updateRgn
) ;
786 InvalRgn( updateRgn
) ;
788 DisposeRgn( updateRgn
) ;
793 void UMAHideControl (ControlHandle inControl
)
795 if ( UMAHasAppearance() )
797 ::HideControl( inControl
) ;
801 ::HideControl( inControl
) ;
806 void UMASetControlVisibility (ControlHandle inControl
,
810 if ( UMAHasAppearance() )
812 #if UMA_USE_APPEARANCE
813 ::SetControlVisibility( inControl
, inIsVisible
, inDoDraw
) ;
820 bool UMAIsControlActive (ControlHandle inControl
)
823 return IsControlActive( inControl
) ;
825 #if UMA_USE_APPEARANCE
826 if ( UMAHasAppearance() )
828 return IsControlActive( inControl
) ;
832 return (**inControl
).contrlHilite
== 0 ;
837 bool UMAIsControlVisible (ControlHandle inControl
)
839 #if UMA_USE_APPEARANCE
840 if ( UMAHasAppearance() )
842 return IsControlVisible( inControl
) ;
848 OSErr
UMAGetBestControlRect (ControlHandle inControl
,
850 SInt16
* outBaseLineOffset
)
852 #if UMA_USE_APPEARANCE
853 if ( UMAHasAppearance() )
855 return GetBestControlRect( inControl
, outRect
, outBaseLineOffset
) ;
861 return AGAGetBestControlRect( inControl
, outRect
, outBaseLineOffset
) ;
871 OSErr
UMASetControlFontStyle (ControlHandle inControl
,
872 const ControlFontStyleRec
* inStyle
)
874 #if UMA_USE_APPEARANCE
875 if ( UMAHasAppearance() )
877 return ::SetControlFontStyle( inControl
, inStyle
) ;
882 return AGASetControlFontStyle( inControl
, inStyle
) ;
894 OSErr
UMACreateRootControl (WindowPtr inWindow
,
895 ControlHandle
* outControl
)
897 #if UMA_USE_APPEARANCE
898 if ( UMAHasAppearance() )
900 return CreateRootControl( inWindow
, outControl
) ;
905 return AGACreateRootControl( inWindow
, outControl
) ;
915 OSErr
UMAEmbedControl (ControlHandle inControl
,
916 ControlHandle inContainer
)
918 #if UMA_USE_APPEARANCE
919 if ( UMAHasAppearance() )
921 return EmbedControl( inControl
, inContainer
) ;
926 return AGAEmbedControl( inControl
, inContainer
) ; ;
937 OSErr
UMASetKeyboardFocus (WindowPtr inWindow
,
938 ControlHandle inControl
,
939 ControlFocusPart inPart
)
945 SetPort( GetWindowPort( inWindow
) ) ;
947 SetPort( inWindow
) ;
950 #if UMA_USE_APPEARANCE
951 if ( UMAHasAppearance() )
953 err
= SetKeyboardFocus( inWindow
, inControl
, inPart
) ;
958 err
= AGASetKeyboardFocus( inWindow
, inControl
, inPart
) ;
972 ControlPartCode
UMAHandleControlClick (ControlHandle inControl
,
975 ControlActionUPP inAction
)
977 #if UMA_USE_APPEARANCE
978 if ( UMAHasAppearance() )
980 return HandleControlClick( inControl
, inWhere
, inModifiers
, inAction
) ;
986 return AGAHandleControlClick( inControl
, inWhere
, inModifiers
, inAction
) ;
996 SInt16
UMAHandleControlKey (ControlHandle inControl
,
1001 #if UMA_USE_APPEARANCE
1002 if ( UMAHasAppearance() )
1004 return HandleControlKey( inControl
, inKeyCode
, inCharCode
, inModifiers
) ;
1010 return AGAHandleControlKey(inControl
, inKeyCode
, inCharCode
, inModifiers
) ;
1021 void UMAIdleControls (WindowPtr inWindow
)
1023 #if UMA_USE_APPEARANCE
1024 if ( UMAHasAppearance() )
1026 IdleControls( inWindow
) ;
1032 AGAIdleControls( inWindow
) ;
1040 void UMAUpdateControls( WindowPtr inWindow
, RgnHandle inRgn
)
1042 RgnHandle updateRgn
= NewRgn() ;
1044 GetWindowRegion( inWindow
, kWindowUpdateRgn
, updateRgn
) ;
1046 GetWindowUpdateRgn( inWindow
, updateRgn
) ;
1048 Point zero
= { 0 , 0 } ;
1049 LocalToGlobal( &zero
) ;
1050 OffsetRgn( updateRgn
, -zero
.h
, -zero
.v
) ;
1051 #if UMA_USE_APPEARANCE
1052 if ( UMAHasAppearance() )
1054 UpdateControls( inWindow
, inRgn
) ;
1060 AGAUpdateControls( inWindow
, inRgn
) ;
1066 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
1067 InvalWindowRgn( inWindow
, updateRgn
) ;
1069 InvalRgn( updateRgn
) ;
1071 DisposeRgn( updateRgn
) ;
1075 OSErr
UMAGetRootControl( WindowPtr inWindow
, ControlHandle
*outControl
)
1077 #if UMA_USE_APPEARANCE
1078 if ( UMAHasAppearance() )
1080 return GetRootControl( inWindow
, outControl
) ;
1086 return AGAGetRootControl( inWindow
, outControl
) ;
1096 // handling control data
1098 OSErr
UMASetControlData (ControlHandle inControl
,
1099 ControlPartCode inPart
,
1104 #if UMA_USE_APPEARANCE
1105 if ( UMAHasAppearance() )
1107 return SetControlData( inControl
, inPart
, inTagName
, inSize
, inData
) ;
1112 return AGASetControlData( inControl
, inPart
, inTagName
, inSize
, inData
) ;
1122 OSErr
UMAGetControlData (ControlHandle inControl
,
1123 ControlPartCode inPart
,
1127 Size
* outActualSize
)
1129 #if UMA_USE_APPEARANCE
1130 if ( UMAHasAppearance() )
1132 return ::GetControlData( inControl
, inPart
, inTagName
, inBufferSize
, outBuffer
, outActualSize
) ;
1138 return AGAGetControlData( inControl
, inPart
, inTagName
, inBufferSize
, outBuffer
, outActualSize
) ;
1148 OSErr
UMAGetControlDataSize (ControlHandle inControl
,
1149 ControlPartCode inPart
,
1153 #if UMA_USE_APPEARANCE
1154 if ( UMAHasAppearance() )
1156 return GetControlDataSize( inControl
, inPart
, inTagName
, outMaxSize
) ;
1162 return AGAGetControlDataSize( inControl
, inPart
, inTagName
, outMaxSize
) ;
1175 // system 8.0 changes
1177 short UMAFindWindow( Point inPoint
, WindowRef
*outWindow
)
1179 // todo add the additional area codes
1180 return FindWindow( inPoint
, outWindow
) ;
1183 OSStatus
UMAGetWindowFeatures( WindowRef inWindowRef
, UInt32
*outFeatures
)
1185 #if UMA_USE_WINDOWMGR
1186 return GetWindowFeatures( inWindowRef
, outFeatures
) ;
1192 OSStatus
UMAGetWindowRegion( WindowRef inWindowRef
, WindowRegionCode inRegionCode
, RgnHandle ioWinRgn
)
1194 #if UMA_USE_WINDOWMGR
1195 return GetWindowRegion( inWindowRef
, inRegionCode
, ioWinRgn
) ;
1201 void UMADrawGrowIcon( WindowRef inWindowRef
)
1203 DrawGrowIcon( inWindowRef
) ;
1206 OSStatus
UMACollapseWindow( WindowRef inWindowRef
, Boolean inCollapseIt
)
1208 return CollapseWindow( inWindowRef
, inCollapseIt
) ;
1211 OSStatus
UMACollapseAllWindows( Boolean inCollapseEm
)
1213 return CollapseAllWindows( inCollapseEm
) ;
1216 Boolean
UMAIsWindowCollapsed( WindowRef inWindowRef
)
1218 return IsWindowCollapsed( inWindowRef
) ;
1221 Boolean
UMAIsWindowCollapsable( WindowRef inWindowRef
)
1223 return IsWindowCollapsable( inWindowRef
) ;
1226 // system 8.5 changes<MacWindows.h>
1227 OSStatus
UMACreateNewWindow( WindowClass windowClass
, WindowAttributes attributes
, const Rect
*bounds
, WindowRef
*outWindow
)
1229 #if UMA_USE_WINDOWMGR
1230 if ( UMAHasWindowManager() )
1232 return CreateNewWindow( windowClass
, attributes
, bounds
, outWindow
) ;
1238 if ( UMAHasAppearance() )
1240 switch( windowClass
)
1242 case kMovableModalWindowClass
:
1243 procID
= kWindowMovableModalDialogProc
;
1245 case kModalWindowClass
:
1246 procID
= kWindowShadowDialogProc
;
1248 case kFloatingWindowClass
:
1249 if ( attributes
& kWindowSideTitlebarAttribute
)
1251 if( ( attributes
& kWindowResizableAttribute
) &&
1252 ( attributes
& kWindowFullZoomAttribute
) )
1254 procID
= kWindowFloatSideFullZoomGrowProc
;
1256 else if( attributes
& kWindowFullZoomAttribute
)
1258 procID
= kWindowFloatSideFullZoomProc
;
1260 else if ( attributes
& kWindowResizableAttribute
)
1262 procID
= kWindowFloatSideGrowProc
;
1266 procID
= kWindowFloatSideProc
;
1271 if( ( attributes
& kWindowResizableAttribute
) &&
1272 ( attributes
& kWindowFullZoomAttribute
) )
1274 procID
= kWindowFloatFullZoomGrowProc
;
1276 else if( attributes
& kWindowFullZoomAttribute
)
1278 procID
= kWindowFloatFullZoomProc
;
1280 else if ( attributes
& kWindowResizableAttribute
)
1282 procID
= kWindowFloatGrowProc
;
1286 procID
= kWindowFloatProc
;
1290 case kDocumentWindowClass
:
1292 if( ( attributes
& kWindowResizableAttribute
) &&
1293 ( attributes
& kWindowFullZoomAttribute
) )
1295 procID
= kWindowFullZoomGrowDocumentProc
;
1297 else if( attributes
& kWindowFullZoomAttribute
)
1299 procID
= kWindowFullZoomDocumentProc
;
1301 else if ( attributes
& kWindowResizableAttribute
)
1303 procID
= kWindowGrowDocumentProc
;
1307 procID
= kWindowDocumentProc
;
1314 switch( windowClass
)
1316 case kMovableModalWindowClass
:
1317 procID
= movableDBoxProc
;
1319 case kModalWindowClass
:
1320 procID
= altDBoxProc
;
1322 case kFloatingWindowClass
:
1323 if ( attributes
& kWindowSideTitlebarAttribute
)
1325 if( ( attributes
& kWindowResizableAttribute
) &&
1326 ( attributes
& kWindowFullZoomAttribute
) )
1328 procID
= floatSideZoomGrowProc
;
1330 else if( attributes
& kWindowFullZoomAttribute
)
1332 procID
= floatSideZoomProc
;
1334 else if ( attributes
& kWindowResizableAttribute
)
1336 procID
= floatSideGrowProc
;
1340 procID
= floatSideProc
;
1345 if( ( attributes
& kWindowResizableAttribute
) &&
1346 ( attributes
& kWindowFullZoomAttribute
) )
1348 procID
= floatZoomGrowProc
;
1350 else if( attributes
& kWindowFullZoomAttribute
)
1352 procID
= floatZoomProc
;
1354 else if ( attributes
& kWindowResizableAttribute
)
1356 procID
= floatGrowProc
;
1364 case kDocumentWindowClass
:
1366 if( ( attributes
& kWindowResizableAttribute
) &&
1367 ( attributes
& kWindowFullZoomAttribute
) )
1369 procID
= zoomDocProc
;
1371 else if( attributes
& kWindowFullZoomAttribute
)
1373 procID
= zoomNoGrow
;
1375 else if ( attributes
& kWindowResizableAttribute
)
1377 procID
= documentProc
;
1381 procID
= noGrowDocProc
;
1387 *outWindow
= NewCWindow(nil
, bounds
, "\p", false, procID
, (WindowRef
) -1 /*behind*/,
1388 attributes
& kWindowCloseBoxAttribute
, (long)NULL
);
1393 OSStatus
UMAGetWindowClass( WindowRef inWindowRef
, WindowClass
*outWindowClass
)
1395 #if UMA_USE_WINDOWMGR
1396 if ( UMAHasWindowManager() )
1398 return GetWindowClass( inWindowRef
, outWindowClass
) ;
1402 return kDocumentWindowClass
;
1405 OSStatus
UMAGetWindowAttributes( WindowRef inWindowRef
, WindowAttributes
*outAttributes
)
1407 #if UMA_USE_WINDOWMGR
1408 if ( UMAHasWindowManager() )
1410 return GetWindowAttributes( inWindowRef
, outAttributes
) ;
1413 return kWindowNoAttributes
;
1416 void UMAShowFloatingWindows()
1418 #if UMA_USE_WINDOWMGR
1419 if ( UMAHasWindowManager() )
1421 ShowFloatingWindows() ;
1426 void UMAHideFloatingWindows()
1428 #if UMA_USE_WINDOWMGR
1429 if ( UMAHasWindowManager() )
1431 HideFloatingWindows() ;
1436 Boolean
UMAAreFloatingWindowsVisible()
1438 #if UMA_USE_WINDOWMGR
1439 if ( UMAHasWindowManager() )
1441 return AreFloatingWindowsVisible() ;
1447 WindowRef
UMAFrontNonFloatingWindow()
1449 #if UMA_USE_WINDOWMGR
1450 if ( UMAHasWindowManager() )
1452 return FrontNonFloatingWindow() ;
1457 return FrontWindow() ;
1461 WindowRef
UMAFrontWindow()
1463 #if UMA_USE_WINDOWMGR
1464 if ( UMAHasWindowManager() )
1466 return FrontWindow() ;
1471 return FrontWindow() ;
1475 WindowRef
UMAGetActiveNonFloatingWindow()
1480 bool UMAIsWindowFloating( WindowRef inWindow
)
1484 UMAGetWindowClass( inWindow
, &cl
) ;
1485 return cl
== kFloatingWindowClass
;
1488 bool UMAIsWindowModal( WindowRef inWindow
)
1492 UMAGetWindowClass( inWindow
, &cl
) ;
1493 return cl
< kFloatingWindowClass
;
1498 void UMAHighlightAndActivateWindow( WindowRef inWindowRef
, bool inActivate
)
1502 // bool isHighlighted = IsWindowHighlited( inWindowRef ) ;
1503 // if ( inActivate != isHightlited )
1507 SetPort( GetWindowPort( inWindowRef
) ) ;
1509 SetPort( inWindowRef
) ;
1511 SetOrigin( 0 , 0 ) ;
1512 HiliteWindow( inWindowRef
, inActivate
) ;
1513 ControlHandle control
= NULL
;
1514 UMAGetRootControl( inWindowRef
, & control
) ;
1518 UMAActivateControl( control
) ;
1520 UMADeactivateControl( control
) ;
1525 OSStatus
UMADrawThemePlacard( const Rect
*inRect
, ThemeDrawState inState
)
1527 #if UMA_USE_APPEARANCE
1528 if ( UMAHasAppearance() )
1530 ::DrawThemePlacard( inRect
, inState
) ;