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() ;
464 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
465 GetWindowRegion( theWindow
, kWindowUpdateRgn
, updateRgn
) ;
467 GetWindowUpdateRgn( theWindow
, updateRgn
) ;
469 #if UMA_USE_APPEARANCE
470 if ( UMAHasAppearance() )
472 ::ActivateControl( inControl
) ;
478 AGAActivateControl( inControl
) ;
484 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
485 InvalWindowRgn( theWindow
, updateRgn
) ;
487 InvalRgn( updateRgn
) ;
491 void UMADrawControl( ControlHandle inControl
)
493 WindowRef theWindow
= GetControlOwner(inControl
) ;
494 RgnHandle updateRgn
= NewRgn() ;
495 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
496 GetWindowRegion( theWindow
, kWindowUpdateRgn
, updateRgn
) ;
498 GetWindowUpdateRgn( theWindow
, updateRgn
) ;
500 #if UMA_USE_APPEARANCE
501 if ( UMAHasAppearance() )
503 ::DrawControlInCurrentPort( inControl
) ;
509 AGADrawControl( inControl
) ;
515 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
516 InvalWindowRgn( theWindow
, updateRgn
) ;
518 InvalRgn( updateRgn
) ;
522 void UMAMoveControl( ControlHandle inControl
, short x
, short y
)
524 WindowRef theWindow
= GetControlOwner(inControl
) ;
525 RgnHandle updateRgn
= NewRgn() ;
526 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
527 GetWindowRegion( theWindow
, kWindowUpdateRgn
, updateRgn
) ;
529 GetWindowUpdateRgn( theWindow
, updateRgn
) ;
531 #if UMA_USE_APPEARANCE
532 if ( UMAHasAppearance() )
534 ::MoveControl( inControl
, x
, y
) ;
540 AGAMoveControl( inControl
, x
,y
) ;
546 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
547 InvalWindowRgn( theWindow
, updateRgn
) ;
549 InvalRgn( updateRgn
) ;
553 void UMASizeControl( ControlHandle inControl
, short x
, short y
)
555 WindowRef theWindow
= GetControlOwner(inControl
) ;
556 RgnHandle updateRgn
= NewRgn() ;
557 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
558 GetWindowRegion( theWindow
, kWindowUpdateRgn
, updateRgn
) ;
560 GetWindowUpdateRgn( theWindow
, updateRgn
) ;
562 #if UMA_USE_APPEARANCE
563 if ( UMAHasAppearance() )
565 ::SizeControl( inControl
, x
, y
) ;
571 AGASizeControl( inControl
, x
,y
) ;
577 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
578 InvalWindowRgn( theWindow
, updateRgn
) ;
580 InvalRgn( updateRgn
) ;
585 void UMADeactivateControl( ControlHandle inControl
)
587 WindowRef theWindow
= GetControlOwner(inControl
) ;
588 RgnHandle updateRgn
= NewRgn() ;
589 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
590 GetWindowRegion( theWindow
, kWindowUpdateRgn
, updateRgn
) ;
592 GetWindowUpdateRgn( theWindow
, updateRgn
) ;
594 #if UMA_USE_APPEARANCE
595 if ( UMAHasAppearance() )
597 ::DeactivateControl( inControl
) ;
603 AGADeactivateControl( inControl
) ;
609 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
610 InvalWindowRgn( theWindow
, updateRgn
) ;
612 InvalRgn( updateRgn
) ;
616 void UMASetThemeWindowBackground (WindowRef inWindow
,
620 #if UMA_USE_APPEARANCE
621 if ( UMAHasAppearance() )
623 ::SetThemeWindowBackground( inWindow
,inBrush
, inUpdate
) ;
629 AGASetThemeWindowBackground( inWindow
, inBrush
, inUpdate
) ;
637 void UMAApplyThemeBackground (ThemeBackgroundKind inKind
,
639 ThemeDrawState inState
,
643 #if UMA_USE_APPEARANCE
644 if ( UMAHasAppearance() )
647 if ( sUMAAppearanceVersion >= 0x0110 )
648 ::ApplyThemeBackground( inKind ,bounds , inState , inDepth , inColorDev ) ;
655 AGAApplyThemeBackground( inKind
,bounds
, inState
, inDepth
, inColorDev
) ;
663 ControlHandle
UMANewControl(WindowPtr owningWindow
,
664 const Rect
* boundsRect
,
665 ConstStr255Param controlTitle
,
666 Boolean initiallyVisible
,
671 SInt32 controlReference
)
673 ControlHandle theControl
= NULL
;
674 #if UMA_USE_APPEARANCE
675 if ( UMAHasAppearance() )
677 theControl
= NewControl( owningWindow
, boundsRect
, controlTitle
, initiallyVisible
,
678 initialValue
, minimumValue
, maximumValue
, procID
, controlReference
) ;
684 theControl
= AGANewControl( owningWindow
, boundsRect
, controlTitle
, initiallyVisible
,
685 initialValue
, minimumValue
, maximumValue
, procID
, controlReference
) ;
694 void UMADisposeControl (ControlHandle theControl
)
696 if ( UMAHasAppearance() )
698 ::DisposeControl( theControl
) ;
702 ::DisposeControl( theControl
) ;
706 void UMAHiliteControl (ControlHandle inControl
,
707 ControlPartCode hiliteState
)
709 WindowRef theWindow
= GetControlOwner(inControl
) ;
710 RgnHandle updateRgn
= NewRgn() ;
711 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
712 GetWindowRegion( theWindow
, kWindowUpdateRgn
, updateRgn
) ;
714 GetWindowUpdateRgn( theWindow
, updateRgn
) ;
716 if ( UMAHasAppearance() )
718 ::HiliteControl( inControl
, hiliteState
) ;
722 ::HiliteControl( inControl
, hiliteState
) ;
724 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
725 InvalWindowRgn( theWindow
, updateRgn
) ;
727 InvalRgn( updateRgn
) ;
731 void UMAShowControl (ControlHandle inControl
)
733 WindowRef theWindow
= GetControlOwner(inControl
) ;
734 RgnHandle updateRgn
= NewRgn() ;
735 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
736 GetWindowRegion( theWindow
, kWindowUpdateRgn
, updateRgn
) ;
738 GetWindowUpdateRgn( theWindow
, updateRgn
) ;
740 if ( UMAHasAppearance() )
742 ::ShowControl( inControl
) ;
746 ::ShowControl( inControl
) ;
748 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
749 InvalWindowRgn( theWindow
, updateRgn
) ;
751 InvalRgn( updateRgn
) ;
756 void UMAHideControl (ControlHandle inControl
)
758 if ( UMAHasAppearance() )
760 ::HideControl( inControl
) ;
764 ::HideControl( inControl
) ;
769 void UMASetControlVisibility (ControlHandle inControl
,
773 if ( UMAHasAppearance() )
775 #if UMA_USE_APPEARANCE
776 ::SetControlVisibility( inControl
, inIsVisible
, inDoDraw
) ;
783 bool UMAIsControlActive (ControlHandle inControl
)
786 return IsControlActive( inControl
) ;
788 #if UMA_USE_APPEARANCE
789 if ( UMAHasAppearance() )
791 return IsControlActive( inControl
) ;
795 return (**inControl
).contrlHilite
== 0 ;
800 bool UMAIsControlVisible (ControlHandle inControl
)
802 #if UMA_USE_APPEARANCE
803 if ( UMAHasAppearance() )
805 return IsControlVisible( inControl
) ;
811 OSErr
UMAGetBestControlRect (ControlHandle inControl
,
813 SInt16
* outBaseLineOffset
)
815 #if UMA_USE_APPEARANCE
816 if ( UMAHasAppearance() )
818 return GetBestControlRect( inControl
, outRect
, outBaseLineOffset
) ;
824 return AGAGetBestControlRect( inControl
, outRect
, outBaseLineOffset
) ;
834 OSErr
UMASetControlFontStyle (ControlHandle inControl
,
835 const ControlFontStyleRec
* inStyle
)
837 #if UMA_USE_APPEARANCE
838 if ( UMAHasAppearance() )
840 return ::SetControlFontStyle( inControl
, inStyle
) ;
845 return AGASetControlFontStyle( inControl
, inStyle
) ;
857 OSErr
UMACreateRootControl (WindowPtr inWindow
,
858 ControlHandle
* outControl
)
860 #if UMA_USE_APPEARANCE
861 if ( UMAHasAppearance() )
863 return CreateRootControl( inWindow
, outControl
) ;
868 return AGACreateRootControl( inWindow
, outControl
) ;
878 OSErr
UMAEmbedControl (ControlHandle inControl
,
879 ControlHandle inContainer
)
881 #if UMA_USE_APPEARANCE
882 if ( UMAHasAppearance() )
884 return EmbedControl( inControl
, inContainer
) ;
889 return AGAEmbedControl( inControl
, inContainer
) ; ;
900 OSErr
UMASetKeyboardFocus (WindowPtr inWindow
,
901 ControlHandle inControl
,
902 ControlFocusPart inPart
)
908 SetPort( GetWindowPort( inWindow
) ) ;
910 SetPort( inWindow
) ;
913 #if UMA_USE_APPEARANCE
914 if ( UMAHasAppearance() )
916 err
= SetKeyboardFocus( inWindow
, inControl
, inPart
) ;
921 err
= AGASetKeyboardFocus( inWindow
, inControl
, inPart
) ;
935 ControlPartCode
UMAHandleControlClick (ControlHandle inControl
,
938 ControlActionUPP inAction
)
940 #if UMA_USE_APPEARANCE
941 if ( UMAHasAppearance() )
943 return HandleControlClick( inControl
, inWhere
, inModifiers
, inAction
) ;
949 return AGAHandleControlClick( inControl
, inWhere
, inModifiers
, inAction
) ;
959 SInt16
UMAHandleControlKey (ControlHandle inControl
,
964 #if UMA_USE_APPEARANCE
965 if ( UMAHasAppearance() )
967 return HandleControlKey( inControl
, inKeyCode
, inCharCode
, inModifiers
) ;
973 return AGAHandleControlKey(inControl
, inKeyCode
, inCharCode
, inModifiers
) ;
984 void UMAIdleControls (WindowPtr inWindow
)
986 #if UMA_USE_APPEARANCE
987 if ( UMAHasAppearance() )
989 IdleControls( inWindow
) ;
995 AGAIdleControls( inWindow
) ;
1003 void UMAUpdateControls( WindowPtr inWindow
, RgnHandle inRgn
)
1005 RgnHandle updateRgn
= NewRgn() ;
1006 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
1007 GetWindowRegion( inWindow
, kWindowUpdateRgn
, updateRgn
) ;
1009 GetWindowUpdateRgn( inWindow
, updateRgn
) ;
1011 #if UMA_USE_APPEARANCE
1012 if ( UMAHasAppearance() )
1014 UpdateControls( inWindow
, inRgn
) ;
1020 AGAUpdateControls( inWindow
, inRgn
) ;
1026 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
1027 InvalWindowRgn( inWindow
, updateRgn
) ;
1029 InvalRgn( updateRgn
) ;
1033 OSErr
UMAGetRootControl( WindowPtr inWindow
, ControlHandle
*outControl
)
1035 #if UMA_USE_APPEARANCE
1036 if ( UMAHasAppearance() )
1038 return GetRootControl( inWindow
, outControl
) ;
1044 return AGAGetRootControl( inWindow
, outControl
) ;
1054 // handling control data
1056 OSErr
UMASetControlData (ControlHandle inControl
,
1057 ControlPartCode inPart
,
1062 #if UMA_USE_APPEARANCE
1063 if ( UMAHasAppearance() )
1065 return SetControlData( inControl
, inPart
, inTagName
, inSize
, inData
) ;
1070 return AGASetControlData( inControl
, inPart
, inTagName
, inSize
, inData
) ;
1080 OSErr
UMAGetControlData (ControlHandle inControl
,
1081 ControlPartCode inPart
,
1085 Size
* outActualSize
)
1087 #if UMA_USE_APPEARANCE
1088 if ( UMAHasAppearance() )
1090 return ::GetControlData( inControl
, inPart
, inTagName
, inBufferSize
, outBuffer
, outActualSize
) ;
1096 return AGAGetControlData( inControl
, inPart
, inTagName
, inBufferSize
, outBuffer
, outActualSize
) ;
1106 OSErr
UMAGetControlDataSize (ControlHandle inControl
,
1107 ControlPartCode inPart
,
1111 #if UMA_USE_APPEARANCE
1112 if ( UMAHasAppearance() )
1114 return GetControlDataSize( inControl
, inPart
, inTagName
, outMaxSize
) ;
1120 return AGAGetControlDataSize( inControl
, inPart
, inTagName
, outMaxSize
) ;
1133 // system 8.0 changes
1135 short UMAFindWindow( Point inPoint
, WindowRef
*outWindow
)
1137 // todo add the additional area codes
1138 return FindWindow( inPoint
, outWindow
) ;
1141 OSStatus
UMAGetWindowFeatures( WindowRef inWindowRef
, UInt32
*outFeatures
)
1143 #if UMA_USE_WINDOWMGR
1144 return GetWindowFeatures( inWindowRef
, outFeatures
) ;
1150 OSStatus
UMAGetWindowRegion( WindowRef inWindowRef
, WindowRegionCode inRegionCode
, RgnHandle ioWinRgn
)
1152 #if UMA_USE_WINDOWMGR
1153 return GetWindowRegion( inWindowRef
, inRegionCode
, ioWinRgn
) ;
1159 void UMADrawGrowIcon( WindowRef inWindowRef
)
1161 DrawGrowIcon( inWindowRef
) ;
1164 OSStatus
UMACollapseWindow( WindowRef inWindowRef
, Boolean inCollapseIt
)
1166 return CollapseWindow( inWindowRef
, inCollapseIt
) ;
1169 OSStatus
UMACollapseAllWindows( Boolean inCollapseEm
)
1171 return CollapseAllWindows( inCollapseEm
) ;
1174 Boolean
UMAIsWindowCollapsed( WindowRef inWindowRef
)
1176 return IsWindowCollapsed( inWindowRef
) ;
1179 Boolean
UMAIsWindowCollapsable( WindowRef inWindowRef
)
1181 return IsWindowCollapsable( inWindowRef
) ;
1184 // system 8.5 changes<MacWindows.h>
1185 OSStatus
UMACreateNewWindow( WindowClass windowClass
, WindowAttributes attributes
, const Rect
*bounds
, WindowRef
*outWindow
)
1187 #if UMA_USE_WINDOWMGR
1188 if ( UMAHasWindowManager() )
1190 return CreateNewWindow( windowClass
, attributes
, bounds
, outWindow
) ;
1196 if ( UMAHasAppearance() )
1198 switch( windowClass
)
1200 case kMovableModalWindowClass
:
1201 procID
= kWindowMovableModalDialogProc
;
1203 case kModalWindowClass
:
1204 procID
= kWindowShadowDialogProc
;
1206 case kFloatingWindowClass
:
1207 if ( attributes
& kWindowSideTitlebarAttribute
)
1209 if( ( attributes
& kWindowResizableAttribute
) &&
1210 ( attributes
& kWindowFullZoomAttribute
) )
1212 procID
= kWindowFloatSideFullZoomGrowProc
;
1214 else if( attributes
& kWindowFullZoomAttribute
)
1216 procID
= kWindowFloatSideFullZoomProc
;
1218 else if ( attributes
& kWindowResizableAttribute
)
1220 procID
= kWindowFloatSideGrowProc
;
1224 procID
= kWindowFloatSideProc
;
1229 if( ( attributes
& kWindowResizableAttribute
) &&
1230 ( attributes
& kWindowFullZoomAttribute
) )
1232 procID
= kWindowFloatFullZoomGrowProc
;
1234 else if( attributes
& kWindowFullZoomAttribute
)
1236 procID
= kWindowFloatFullZoomProc
;
1238 else if ( attributes
& kWindowResizableAttribute
)
1240 procID
= kWindowFloatGrowProc
;
1244 procID
= kWindowFloatProc
;
1248 case kDocumentWindowClass
:
1250 if( ( attributes
& kWindowResizableAttribute
) &&
1251 ( attributes
& kWindowFullZoomAttribute
) )
1253 procID
= kWindowFullZoomGrowDocumentProc
;
1255 else if( attributes
& kWindowFullZoomAttribute
)
1257 procID
= kWindowFullZoomDocumentProc
;
1259 else if ( attributes
& kWindowResizableAttribute
)
1261 procID
= kWindowGrowDocumentProc
;
1265 procID
= kWindowDocumentProc
;
1272 switch( windowClass
)
1274 case kMovableModalWindowClass
:
1275 procID
= movableDBoxProc
;
1277 case kModalWindowClass
:
1278 procID
= altDBoxProc
;
1280 case kFloatingWindowClass
:
1281 if ( attributes
& kWindowSideTitlebarAttribute
)
1283 if( ( attributes
& kWindowResizableAttribute
) &&
1284 ( attributes
& kWindowFullZoomAttribute
) )
1286 procID
= floatSideZoomGrowProc
;
1288 else if( attributes
& kWindowFullZoomAttribute
)
1290 procID
= floatSideZoomProc
;
1292 else if ( attributes
& kWindowResizableAttribute
)
1294 procID
= floatSideGrowProc
;
1298 procID
= floatSideProc
;
1303 if( ( attributes
& kWindowResizableAttribute
) &&
1304 ( attributes
& kWindowFullZoomAttribute
) )
1306 procID
= floatZoomGrowProc
;
1308 else if( attributes
& kWindowFullZoomAttribute
)
1310 procID
= floatZoomProc
;
1312 else if ( attributes
& kWindowResizableAttribute
)
1314 procID
= floatGrowProc
;
1322 case kDocumentWindowClass
:
1324 if( ( attributes
& kWindowResizableAttribute
) &&
1325 ( attributes
& kWindowFullZoomAttribute
) )
1327 procID
= zoomDocProc
;
1329 else if( attributes
& kWindowFullZoomAttribute
)
1331 procID
= zoomNoGrow
;
1333 else if ( attributes
& kWindowResizableAttribute
)
1335 procID
= documentProc
;
1339 procID
= noGrowDocProc
;
1345 *outWindow
= NewCWindow(nil
, bounds
, "\p", false, procID
, (WindowRef
) -1 /*behind*/,
1346 attributes
& kWindowCloseBoxAttribute
, (long)NULL
);
1351 OSStatus
UMAGetWindowClass( WindowRef inWindowRef
, WindowClass
*outWindowClass
)
1353 #if UMA_USE_WINDOWMGR
1354 if ( UMAHasWindowManager() )
1356 return GetWindowClass( inWindowRef
, outWindowClass
) ;
1360 return kDocumentWindowClass
;
1363 OSStatus
UMAGetWindowAttributes( WindowRef inWindowRef
, WindowAttributes
*outAttributes
)
1365 #if UMA_USE_WINDOWMGR
1366 if ( UMAHasWindowManager() )
1368 return GetWindowAttributes( inWindowRef
, outAttributes
) ;
1371 return kWindowNoAttributes
;
1374 void UMAShowFloatingWindows()
1376 #if UMA_USE_WINDOWMGR
1377 if ( UMAHasWindowManager() )
1379 ShowFloatingWindows() ;
1384 void UMAHideFloatingWindows()
1386 #if UMA_USE_WINDOWMGR
1387 if ( UMAHasWindowManager() )
1389 HideFloatingWindows() ;
1394 Boolean
UMAAreFloatingWindowsVisible()
1396 #if UMA_USE_WINDOWMGR
1397 if ( UMAHasWindowManager() )
1399 return AreFloatingWindowsVisible() ;
1405 WindowRef
UMAFrontNonFloatingWindow()
1407 #if UMA_USE_WINDOWMGR
1408 if ( UMAHasWindowManager() )
1410 return FrontNonFloatingWindow() ;
1415 return FrontWindow() ;
1419 WindowRef
UMAFrontWindow()
1421 #if UMA_USE_WINDOWMGR
1422 if ( UMAHasWindowManager() )
1424 return FrontWindow() ;
1429 return FrontWindow() ;
1433 WindowRef
UMAGetActiveNonFloatingWindow()
1438 bool UMAIsWindowFloating( WindowRef inWindow
)
1442 UMAGetWindowClass( inWindow
, &cl
) ;
1443 return cl
== kFloatingWindowClass
;
1446 bool UMAIsWindowModal( WindowRef inWindow
)
1450 UMAGetWindowClass( inWindow
, &cl
) ;
1451 return cl
< kFloatingWindowClass
;
1456 void UMAHighlightAndActivateWindow( WindowRef inWindowRef
, bool inActivate
)
1460 // bool isHighlighted = IsWindowHighlited( inWindowRef ) ;
1461 // if ( inActivate != isHightlited )
1465 SetPort( GetWindowPort( inWindowRef
) ) ;
1467 SetPort( inWindowRef
) ;
1469 SetOrigin( 0 , 0 ) ;
1470 HiliteWindow( inWindowRef
, inActivate
) ;
1471 ControlHandle control
= NULL
;
1472 UMAGetRootControl( inWindowRef
, & control
) ;
1476 UMAActivateControl( control
) ;
1478 UMADeactivateControl( control
) ;
1483 OSStatus
UMADrawThemePlacard( const Rect
*inRect
, ThemeDrawState inState
)
1485 #if UMA_USE_APPEARANCE
1486 if ( UMAHasAppearance() )
1488 ::DrawThemePlacard( inRect
, inState
) ;