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
18 static bool sUMAHasAppearance
= false ;
19 static long sUMAAppearanceVersion
= 0 ;
20 extern int gAGABackgroundColor
;
21 bool UMAHasAppearance() { return sUMAHasAppearance
; }
22 long UMAGetAppearanceVersion() { return sUMAAppearanceVersion
; }
24 static bool sUMAHasWindowManager
= false ;
25 static long sUMAWindowManagerAttr
= 0 ;
27 bool UMAHasWindowManager() { return sUMAHasWindowManager
; }
28 long UMAGetWindowManagerAttr() { return sUMAWindowManagerAttr
; }
29 void UMACleanupToolbox()
31 #if UMA_USE_APPEARANCE
32 if ( sUMAHasAppearance
)
34 UnregisterAppearanceClient() ;
37 if ( NavServicesAvailable() )
42 void UMAInitToolbox( UInt16 inMoreMastersCalls
)
46 for (long i
= 1; i
<= inMoreMastersCalls
; i
++)
49 ::InitGraf(&qd
.thePort
);
54 ::FlushEvents(everyEvent
, 0);
57 PurgeSpace(&total
, &contig
);
62 #if UMA_USE_APPEARANCE
64 if ( Gestalt( gestaltAppearanceAttr
, &theAppearance
) == noErr
)
66 sUMAHasAppearance
= true ;
67 RegisterAppearanceClient();
68 if ( Gestalt( gestaltAppearanceVersion
, &theAppearance
) == noErr
)
70 sUMAAppearanceVersion
= theAppearance
;
74 sUMAAppearanceVersion
= 0x0100 ;
77 #endif // UMA_USE_APPEARANCE
80 if ( Gestalt( gestaltWindowMgrAttr
, &sUMAWindowManagerAttr
) == noErr
)
82 sUMAHasWindowManager
= sUMAWindowManagerAttr
& gestaltWindowMgrPresent
;
84 #endif // UMA_USE_WINDOWMGR
89 // Call currently implicitely done : InitFloatingWindows() ;
91 if ( sUMAHasWindowManager
)
92 InitFloatingWindows() ;
98 if ( NavServicesAvailable() )
105 long UMAGetProcessMode()
108 ProcessInfoRec processinfo
;
109 ProcessSerialNumber procno
;
111 procno
.highLongOfPSN
= NULL
;
112 procno
.lowLongOfPSN
= kCurrentProcess
;
113 processinfo
.processInfoLength
= sizeof(ProcessInfoRec
);
114 processinfo
.processName
= NULL
;
115 processinfo
.processAppSpec
= NULL
;
117 err
= ::GetProcessInformation( &procno
, &processinfo
) ;
118 wxASSERT( err
== noErr
) ;
119 return processinfo
.processMode
;
122 bool UMAGetProcessModeDoesActivateOnFGSwitch()
124 return UMAGetProcessMode() & modeDoesActivateOnFGSwitch
;
129 void UMASetMenuTitle( MenuRef menu
, StringPtr title
)
132 long size
= GetHandleSize( (Handle
) menu
) ;
133 const long headersize
= 14 ;
134 int oldlen
= (**menu
).menuData
[0] + 1;
135 int newlen
= title
[0] + 1 ;
137 if ( oldlen
< newlen
)
139 // enlarge before adjusting
140 SetHandleSize( (Handle
) menu
, size
+ (newlen
- oldlen
) );
143 if ( oldlen
!= newlen
)
144 memmove( (char*) (**menu
).menuData
+ newlen
, (char*) (**menu
).menuData
+ oldlen
, size
- headersize
- oldlen
) ;
146 memcpy( (char*) (**menu
).menuData
, title
, newlen
) ;
147 if ( oldlen
> newlen
)
150 SetHandleSize( (Handle
) menu
, size
+ (newlen
- oldlen
) ) ;
153 SetMenuTitle( menu
, title
) ;
157 UInt32
UMAMenuEvent( EventRecord
*inEvent
)
159 #if UMA_USE_APPEARANCE
160 if ( UMAHasAppearance() )
162 return MenuEvent( inEvent
) ;
167 if ( inEvent
->what
== keyDown
&& inEvent
->modifiers
& cmdKey
)
169 return MenuKey( inEvent
->message
& charCodeMask
) ;
175 void UMAEnableMenuItem( MenuRef inMenu
, MenuItemIndex inItem
)
177 #if UMA_USE_8_6 || TARGET_CARBON
178 EnableMenuItem( inMenu
, inItem
) ;
180 EnableItem( inMenu
, inItem
) ;
184 void UMADisableMenuItem( MenuRef inMenu
, MenuItemIndex inItem
)
186 #if UMA_USE_8_6 || TARGET_CARBON
187 DisableMenuItem( inMenu
, inItem
) ;
189 DisableItem( inMenu
, inItem
) ;
193 void UMAAppendSubMenuItem( MenuRef menu
, StringPtr l
, SInt16 id
)
196 memcpy( label
, l
, l
[0]+1 ) ;
197 // hardcoded adding of the submenu combination for mac
199 int theEnd
= label
[0] + 1;
201 theEnd
= 251; // mac allows only 255 characters
202 label
[theEnd
++] = '/';
203 label
[theEnd
++] = hMenuCmd
;
204 label
[theEnd
++] = '!';
205 label
[theEnd
++] = id
;
206 label
[theEnd
] = 0x00;
208 MacAppendMenu(menu
, label
);
211 void UMAInsertSubMenuItem( MenuRef menu
, StringPtr l
, MenuItemIndex item
, SInt16 id
)
214 memcpy( label
, l
, l
[0]+1 ) ;
215 // hardcoded adding of the submenu combination for mac
217 int theEnd
= label
[0] + 1;
219 theEnd
= 251; // mac allows only 255 characters
220 label
[theEnd
++] = '/';
221 label
[theEnd
++] = hMenuCmd
;
222 label
[theEnd
++] = '!';
223 label
[theEnd
++] = id
;
224 label
[theEnd
] = 0x00;
226 MacInsertMenuItem(menu
, label
, item
);
229 void UMAAppendMenuItem( MenuRef menu
, StringPtr l
, SInt16 key
, UInt8 modifiers
)
232 memcpy( label
, l
, l
[0]+1 ) ;
237 label
[++pos
] = toupper( key
);
240 MacAppendMenu( menu
, label
) ;
243 void UMAInsertMenuItem( MenuRef menu
, StringPtr l
, MenuItemIndex item
, SInt16 key
, UInt8 modifiers
)
246 memcpy( label
, l
, l
[0]+1 ) ;
251 label
[++pos
] = toupper( key
);
254 MacInsertMenuItem( menu
, label
, item
) ;
257 void UMADrawMenuBar()
263 void UMASetMenuItemText( MenuRef menu
, MenuItemIndex item
, StringPtr label
)
265 ::SetMenuItemText( menu
, item
, label
) ;
268 MenuRef
UMANewMenu( SInt16 menuid
, StringPtr label
)
270 return ::NewMenu(menuid
, label
);
273 void UMADisposeMenu( MenuRef menu
)
275 DisposeMenu( menu
) ;
277 void UMADeleteMenu( SInt16 menuId
)
279 ::DeleteMenu( menuId
) ;
282 void UMAInsertMenu( MenuRef insertMenu
, SInt16 afterId
)
284 ::InsertMenu( insertMenu
, afterId
) ;
290 int gPrOpenCounter
= 0 ;
297 if ( gPrOpenCounter
== 1 )
301 wxASSERT( err
== noErr
) ;
305 OSStatus err
= noErr
;
307 if ( gPrOpenCounter
== 1 )
310 wxASSERT( err
== noErr
) ;
316 OSStatus
UMAPrClose()
320 wxASSERT( gPrOpenCounter
>= 1 ) ;
321 if ( gPrOpenCounter
== 1 )
325 wxASSERT( err
== noErr
) ;
330 OSStatus err
= noErr
;
331 wxASSERT( gPrOpenCounter
>= 1 ) ;
332 if ( gPrOpenCounter
== 1 )
343 pascal QDGlobalsPtr
GetQDGlobalsPtr (void)
345 return QDGlobalsPtr (* (Ptr
*) LMGetCurrentA5 ( ) - 0xCA);
350 void UMAShowWatchCursor()
354 CursHandle watchFob
= GetCursor (watchCursor
);
361 Cursor preservedArrow
;
362 GetQDGlobalsArrow (&preservedArrow
);
363 SetQDGlobalsArrow (*watchFob
);
365 SetQDGlobalsArrow (&preservedArrow
);
367 SetCursor (*watchFob
);
372 void UMAShowArrowCursor()
376 SetCursor (GetQDGlobalsArrow (&arrow
));
378 SetCursor (&(qd
.arrow
));
384 GrafPtr
UMAGetWindowPort( WindowRef inWindowRef
)
386 wxASSERT( inWindowRef
!= NULL
) ;
388 return GetWindowPort( inWindowRef
) ;
390 return (GrafPtr
) inWindowRef
;
394 void UMADisposeWindow( WindowRef inWindowRef
)
396 wxASSERT( inWindowRef
!= NULL
) ;
397 DisposeWindow( inWindowRef
) ;
400 void UMASetWTitleC( WindowRef inWindowRef
, const char *title
)
403 strncpy( (char*)ptitle
, title
, 96 ) ;
406 c2pstrcpy( ptitle
, (char *)ptitle
) ;
408 c2pstr( (char*)ptitle
) ;
410 SetWTitle( inWindowRef
, ptitle
) ;
413 void UMAGetWTitleC( WindowRef inWindowRef
, char *title
)
415 GetWTitle( inWindowRef
, (unsigned char*)title
) ;
417 p2cstrcpy( title
, (unsigned char *)title
) ;
419 p2cstr( (unsigned char*)title
) ;
423 void UMAShowWindow( WindowRef inWindowRef
)
425 ShowWindow( inWindowRef
) ;
428 void UMAHideWindow( WindowRef inWindowRef
)
430 HideWindow( inWindowRef
) ;
433 void UMASelectWindow( WindowRef inWindowRef
)
435 SelectWindow( inWindowRef
) ;
438 void UMABringToFront( WindowRef inWindowRef
)
440 BringToFront( inWindowRef
) ;
443 void UMASendBehind( WindowRef inWindowRef
, WindowRef behindWindow
)
445 SendBehind( inWindowRef
, behindWindow
) ;
448 void UMACloseWindow(WindowRef inWindowRef
)
452 CloseWindow( inWindowRef
) ;
456 // appearance additions
458 void UMAActivateControl( ControlHandle inControl
)
460 WindowRef theWindow
= GetControlOwner(inControl
) ;
461 RgnHandle updateRgn
= NewRgn() ;
462 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340)
463 GetWindowRegion( theWindow
, kWindowUpdateRgn
, updateRgn
) ;
465 GetWindowUpdateRgn( theWindow
, updateRgn
) ;
467 #if UMA_USE_APPEARANCE
468 if ( UMAHasAppearance() )
470 ::ActivateControl( inControl
) ;
476 AGAActivateControl( inControl
) ;
482 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340)
483 InvalWindowRgn( theWindow
, updateRgn
) ;
485 InvalRgn( updateRgn
) ;
489 void UMADrawControl( ControlHandle inControl
)
491 WindowRef theWindow
= GetControlOwner(inControl
) ;
492 RgnHandle updateRgn
= NewRgn() ;
493 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340)
494 GetWindowRegion( theWindow
, kWindowUpdateRgn
, updateRgn
) ;
496 GetWindowUpdateRgn( theWindow
, updateRgn
) ;
498 #if UMA_USE_APPEARANCE
499 if ( UMAHasAppearance() )
501 ::DrawControlInCurrentPort( inControl
) ;
507 AGADrawControl( inControl
) ;
513 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340)
514 InvalWindowRgn( theWindow
, updateRgn
) ;
516 InvalRgn( updateRgn
) ;
520 void UMAMoveControl( ControlHandle inControl
, short x
, short y
)
522 WindowRef theWindow
= GetControlOwner(inControl
) ;
523 RgnHandle updateRgn
= NewRgn() ;
524 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340)
525 GetWindowRegion( theWindow
, kWindowUpdateRgn
, updateRgn
) ;
527 GetWindowUpdateRgn( theWindow
, updateRgn
) ;
529 #if UMA_USE_APPEARANCE
530 if ( UMAHasAppearance() )
532 ::MoveControl( inControl
, x
, y
) ;
538 AGAMoveControl( inControl
, x
,y
) ;
544 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340)
545 InvalWindowRgn( theWindow
, updateRgn
) ;
547 InvalRgn( updateRgn
) ;
551 void UMASizeControl( ControlHandle inControl
, short x
, short y
)
553 WindowRef theWindow
= GetControlOwner(inControl
) ;
554 RgnHandle updateRgn
= NewRgn() ;
555 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340)
556 GetWindowRegion( theWindow
, kWindowUpdateRgn
, updateRgn
) ;
558 GetWindowUpdateRgn( theWindow
, updateRgn
) ;
560 #if UMA_USE_APPEARANCE
561 if ( UMAHasAppearance() )
563 ::SizeControl( inControl
, x
, y
) ;
569 AGASizeControl( inControl
, x
,y
) ;
575 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340)
576 InvalWindowRgn( theWindow
, updateRgn
) ;
578 InvalRgn( updateRgn
) ;
582 void UMADeactivateControl( ControlHandle inControl
)
584 WindowRef theWindow
= GetControlOwner(inControl
) ;
585 RgnHandle updateRgn
= NewRgn() ;
586 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340)
587 GetWindowRegion( theWindow
, kWindowUpdateRgn
, updateRgn
) ;
589 GetWindowUpdateRgn( theWindow
, updateRgn
) ;
591 #if UMA_USE_APPEARANCE
592 if ( UMAHasAppearance() )
594 ::DeactivateControl( inControl
) ;
600 AGADeactivateControl( inControl
) ;
606 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340)
607 InvalWindowRgn( theWindow
, updateRgn
) ;
609 InvalRgn( updateRgn
) ;
613 void UMASetThemeWindowBackground (WindowRef inWindow
,
617 #if UMA_USE_APPEARANCE
618 if ( UMAHasAppearance() )
620 ::SetThemeWindowBackground( inWindow
,inBrush
, inUpdate
) ;
626 AGASetThemeWindowBackground( inWindow
, inBrush
, inUpdate
) ;
634 void UMAApplyThemeBackground (ThemeBackgroundKind inKind
,
636 ThemeDrawState inState
,
640 #if UMA_USE_APPEARANCE
641 if ( UMAHasAppearance() )
644 if ( sUMAAppearanceVersion >= 0x0110 )
645 ::ApplyThemeBackground( inKind ,bounds , inState , inDepth , inColorDev ) ;
652 AGAApplyThemeBackground( inKind
,bounds
, inState
, inDepth
, inColorDev
) ;
660 ControlHandle
UMANewControl(WindowPtr owningWindow
,
661 const Rect
* boundsRect
,
662 ConstStr255Param controlTitle
,
663 Boolean initiallyVisible
,
668 SInt32 controlReference
)
670 ControlHandle theControl
= NULL
;
671 #if UMA_USE_APPEARANCE
672 if ( UMAHasAppearance() )
674 theControl
= NewControl( owningWindow
, boundsRect
, controlTitle
, initiallyVisible
,
675 initialValue
, minimumValue
, maximumValue
, procID
, controlReference
) ;
681 theControl
= AGANewControl( owningWindow
, boundsRect
, controlTitle
, initiallyVisible
,
682 initialValue
, minimumValue
, maximumValue
, procID
, controlReference
) ;
691 void UMADisposeControl (ControlHandle theControl
)
693 if ( UMAHasAppearance() )
695 ::DisposeControl( theControl
) ;
699 ::DisposeControl( theControl
) ;
704 void UMAHiliteControl (ControlHandle inControl
,
705 ControlPartCode hiliteState
)
707 WindowRef theWindow
= GetControlOwner(inControl
) ;
708 RgnHandle updateRgn
= NewRgn() ;
709 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340)
710 GetWindowRegion( theWindow
, kWindowUpdateRgn
, updateRgn
) ;
712 GetWindowUpdateRgn( theWindow
, updateRgn
) ;
714 if ( UMAHasAppearance() )
716 ::HiliteControl( inControl
, hiliteState
) ;
720 ::HiliteControl( inControl
, hiliteState
) ;
722 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340)
723 InvalWindowRgn( theWindow
, updateRgn
) ;
725 InvalRgn( updateRgn
) ;
729 void UMAShowControl (ControlHandle inControl
)
731 WindowRef theWindow
= GetControlOwner(inControl
) ;
732 RgnHandle updateRgn
= NewRgn() ;
733 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340)
734 GetWindowRegion( theWindow
, kWindowUpdateRgn
, updateRgn
) ;
736 GetWindowUpdateRgn( theWindow
, updateRgn
) ;
738 if ( UMAHasAppearance() )
740 ::ShowControl( inControl
) ;
744 ::ShowControl( inControl
) ;
746 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340)
747 InvalWindowRgn( theWindow
, updateRgn
) ;
749 InvalRgn( updateRgn
) ;
754 void UMAHideControl (ControlHandle inControl
)
756 if ( UMAHasAppearance() )
758 ::HideControl( inControl
) ;
762 ::HideControl( inControl
) ;
767 void UMASetControlVisibility (ControlHandle inControl
,
771 if ( UMAHasAppearance() )
773 #if UMA_USE_APPEARANCE
774 ::SetControlVisibility( inControl
, inIsVisible
, inDoDraw
) ;
781 bool UMAIsControlActive (ControlHandle inControl
)
784 return IsControlActive( inControl
) ;
786 #if UMA_USE_APPEARANCE
787 if ( UMAHasAppearance() )
789 return IsControlActive( inControl
) ;
793 return (**inControl
).contrlHilite
== 0 ;
798 bool UMAIsControlVisible (ControlHandle inControl
)
800 #if UMA_USE_APPEARANCE
801 if ( UMAHasAppearance() )
803 return IsControlVisible( inControl
) ;
809 OSErr
UMAGetBestControlRect (ControlHandle inControl
,
811 SInt16
* outBaseLineOffset
)
813 #if UMA_USE_APPEARANCE
814 if ( UMAHasAppearance() )
816 return GetBestControlRect( inControl
, outRect
, outBaseLineOffset
) ;
822 return AGAGetBestControlRect( inControl
, outRect
, outBaseLineOffset
) ;
832 OSErr
UMASetControlFontStyle (ControlHandle inControl
,
833 const ControlFontStyleRec
* inStyle
)
835 #if UMA_USE_APPEARANCE
836 if ( UMAHasAppearance() )
838 return ::SetControlFontStyle( inControl
, inStyle
) ;
843 return AGASetControlFontStyle( inControl
, inStyle
) ;
855 OSErr
UMACreateRootControl (WindowPtr inWindow
,
856 ControlHandle
* outControl
)
858 #if UMA_USE_APPEARANCE
859 if ( UMAHasAppearance() )
861 return CreateRootControl( inWindow
, outControl
) ;
866 return AGACreateRootControl( inWindow
, outControl
) ;
876 OSErr
UMAEmbedControl (ControlHandle inControl
,
877 ControlHandle inContainer
)
879 #if UMA_USE_APPEARANCE
880 if ( UMAHasAppearance() )
882 return EmbedControl( inControl
, inContainer
) ;
887 return AGAEmbedControl( inControl
, inContainer
) ; ;
898 OSErr
UMASetKeyboardFocus (WindowPtr inWindow
,
899 ControlHandle inControl
,
900 ControlFocusPart inPart
)
906 SetPort( GetWindowPort( inWindow
) ) ;
908 SetPort( inWindow
) ;
911 #if UMA_USE_APPEARANCE
912 if ( UMAHasAppearance() )
914 err
= SetKeyboardFocus( inWindow
, inControl
, inPart
) ;
919 err
= AGASetKeyboardFocus( inWindow
, inControl
, inPart
) ;
933 ControlPartCode
UMAHandleControlClick (ControlHandle inControl
,
936 ControlActionUPP inAction
)
938 #if UMA_USE_APPEARANCE
939 if ( UMAHasAppearance() )
941 return HandleControlClick( inControl
, inWhere
, inModifiers
, inAction
) ;
947 return AGAHandleControlClick( inControl
, inWhere
, inModifiers
, inAction
) ;
957 SInt16
UMAHandleControlKey (ControlHandle inControl
,
962 #if UMA_USE_APPEARANCE
963 if ( UMAHasAppearance() )
965 return HandleControlKey( inControl
, inKeyCode
, inCharCode
, inModifiers
) ;
971 return AGAHandleControlKey(inControl
, inKeyCode
, inCharCode
, inModifiers
) ;
982 void UMAIdleControls (WindowPtr inWindow
)
984 #if UMA_USE_APPEARANCE
985 if ( UMAHasAppearance() )
987 IdleControls( inWindow
) ;
993 AGAIdleControls( inWindow
) ;
1001 void UMAUpdateControls( WindowPtr inWindow
, RgnHandle inRgn
)
1003 RgnHandle updateRgn
= NewRgn() ;
1004 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340)
1005 GetWindowRegion( inWindow
, kWindowUpdateRgn
, updateRgn
) ;
1007 GetWindowUpdateRgn( inWindow
, updateRgn
) ;
1009 #if UMA_USE_APPEARANCE
1010 if ( UMAHasAppearance() )
1012 UpdateControls( inWindow
, inRgn
) ;
1018 AGAUpdateControls( inWindow
, inRgn
) ;
1024 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340)
1025 InvalWindowRgn( inWindow
, updateRgn
) ;
1027 InvalRgn( updateRgn
) ;
1031 OSErr
UMAGetRootControl( WindowPtr inWindow
, ControlHandle
*outControl
)
1033 #if UMA_USE_APPEARANCE
1034 if ( UMAHasAppearance() )
1036 return GetRootControl( inWindow
, outControl
) ;
1042 return AGAGetRootControl( inWindow
, outControl
) ;
1052 // handling control data
1054 OSErr
UMASetControlData (ControlHandle inControl
,
1055 ControlPartCode inPart
,
1060 #if UMA_USE_APPEARANCE
1061 if ( UMAHasAppearance() )
1063 return SetControlData( inControl
, inPart
, inTagName
, inSize
, inData
) ;
1068 return AGASetControlData( inControl
, inPart
, inTagName
, inSize
, inData
) ;
1078 OSErr
UMAGetControlData (ControlHandle inControl
,
1079 ControlPartCode inPart
,
1083 Size
* outActualSize
)
1085 #if UMA_USE_APPEARANCE
1086 if ( UMAHasAppearance() )
1088 return ::GetControlData( inControl
, inPart
, inTagName
, inBufferSize
, outBuffer
, outActualSize
) ;
1094 return AGAGetControlData( inControl
, inPart
, inTagName
, inBufferSize
, outBuffer
, outActualSize
) ;
1104 OSErr
UMAGetControlDataSize (ControlHandle inControl
,
1105 ControlPartCode inPart
,
1109 #if UMA_USE_APPEARANCE
1110 if ( UMAHasAppearance() )
1112 return GetControlDataSize( inControl
, inPart
, inTagName
, outMaxSize
) ;
1118 return AGAGetControlDataSize( inControl
, inPart
, inTagName
, outMaxSize
) ;
1131 // system 8.0 changes
1133 short UMAFindWindow( Point inPoint
, WindowRef
*outWindow
)
1135 // todo add the additional area codes
1136 return FindWindow( inPoint
, outWindow
) ;
1139 OSStatus
UMAGetWindowFeatures( WindowRef inWindowRef
, UInt32
*outFeatures
)
1141 #if UMA_USE_WINDOWMGR
1142 return GetWindowFeatures( inWindowRef
, outFeatures
) ;
1148 OSStatus
UMAGetWindowRegion( WindowRef inWindowRef
, WindowRegionCode inRegionCode
, RgnHandle ioWinRgn
)
1150 #if UMA_USE_WINDOWMGR
1151 return GetWindowRegion( inWindowRef
, inRegionCode
, ioWinRgn
) ;
1157 void UMADrawGrowIcon( WindowRef inWindowRef
)
1159 DrawGrowIcon( inWindowRef
) ;
1162 OSStatus
UMACollapseWindow( WindowRef inWindowRef
, Boolean inCollapseIt
)
1164 return CollapseWindow( inWindowRef
, inCollapseIt
) ;
1167 OSStatus
UMACollapseAllWindows( Boolean inCollapseEm
)
1169 return CollapseAllWindows( inCollapseEm
) ;
1172 Boolean
UMAIsWindowCollapsed( WindowRef inWindowRef
)
1174 return IsWindowCollapsed( inWindowRef
) ;
1177 Boolean
UMAIsWindowCollapsable( WindowRef inWindowRef
)
1179 return IsWindowCollapsable( inWindowRef
) ;
1182 // system 8.5 changes<MacWindows.h>
1183 OSStatus
UMACreateNewWindow( WindowClass windowClass
, WindowAttributes attributes
, const Rect
*bounds
, WindowRef
*outWindow
)
1185 #if UMA_USE_WINDOWMGR
1186 if ( UMAHasWindowManager() )
1188 return CreateNewWindow( windowClass
, attributes
, bounds
, outWindow
) ;
1194 if ( UMAHasAppearance() )
1196 switch( windowClass
)
1198 case kMovableModalWindowClass
:
1199 procID
= kWindowMovableModalDialogProc
;
1201 case kModalWindowClass
:
1202 procID
= kWindowShadowDialogProc
;
1204 case kFloatingWindowClass
:
1205 if ( attributes
& kWindowSideTitlebarAttribute
)
1207 if( ( attributes
& kWindowResizableAttribute
) &&
1208 ( attributes
& kWindowFullZoomAttribute
) )
1210 procID
= kWindowFloatSideFullZoomGrowProc
;
1212 else if( attributes
& kWindowFullZoomAttribute
)
1214 procID
= kWindowFloatSideFullZoomProc
;
1216 else if ( attributes
& kWindowResizableAttribute
)
1218 procID
= kWindowFloatSideGrowProc
;
1222 procID
= kWindowFloatSideProc
;
1227 if( ( attributes
& kWindowResizableAttribute
) &&
1228 ( attributes
& kWindowFullZoomAttribute
) )
1230 procID
= kWindowFloatFullZoomGrowProc
;
1232 else if( attributes
& kWindowFullZoomAttribute
)
1234 procID
= kWindowFloatFullZoomProc
;
1236 else if ( attributes
& kWindowResizableAttribute
)
1238 procID
= kWindowFloatGrowProc
;
1242 procID
= kWindowFloatProc
;
1246 case kDocumentWindowClass
:
1248 if( ( attributes
& kWindowResizableAttribute
) &&
1249 ( attributes
& kWindowFullZoomAttribute
) )
1251 procID
= kWindowFullZoomGrowDocumentProc
;
1253 else if( attributes
& kWindowFullZoomAttribute
)
1255 procID
= kWindowFullZoomDocumentProc
;
1257 else if ( attributes
& kWindowResizableAttribute
)
1259 procID
= kWindowGrowDocumentProc
;
1263 procID
= kWindowDocumentProc
;
1270 switch( windowClass
)
1272 case kMovableModalWindowClass
:
1273 procID
= movableDBoxProc
;
1275 case kModalWindowClass
:
1276 procID
= altDBoxProc
;
1278 case kFloatingWindowClass
:
1279 if ( attributes
& kWindowSideTitlebarAttribute
)
1281 if( ( attributes
& kWindowResizableAttribute
) &&
1282 ( attributes
& kWindowFullZoomAttribute
) )
1284 procID
= floatSideZoomGrowProc
;
1286 else if( attributes
& kWindowFullZoomAttribute
)
1288 procID
= floatSideZoomProc
;
1290 else if ( attributes
& kWindowResizableAttribute
)
1292 procID
= floatSideGrowProc
;
1296 procID
= floatSideProc
;
1301 if( ( attributes
& kWindowResizableAttribute
) &&
1302 ( attributes
& kWindowFullZoomAttribute
) )
1304 procID
= floatZoomGrowProc
;
1306 else if( attributes
& kWindowFullZoomAttribute
)
1308 procID
= floatZoomProc
;
1310 else if ( attributes
& kWindowResizableAttribute
)
1312 procID
= floatGrowProc
;
1320 case kDocumentWindowClass
:
1322 if( ( attributes
& kWindowResizableAttribute
) &&
1323 ( attributes
& kWindowFullZoomAttribute
) )
1325 procID
= zoomDocProc
;
1327 else if( attributes
& kWindowFullZoomAttribute
)
1329 procID
= zoomNoGrow
;
1331 else if ( attributes
& kWindowResizableAttribute
)
1333 procID
= documentProc
;
1337 procID
= noGrowDocProc
;
1343 *outWindow
= NewCWindow(nil
, bounds
, "\p", false, procID
, (WindowRef
) -1 /*behind*/,
1344 attributes
& kWindowCloseBoxAttribute
, (long)NULL
);
1349 OSStatus
UMAGetWindowClass( WindowRef inWindowRef
, WindowClass
*outWindowClass
)
1351 #if UMA_USE_WINDOWMGR
1352 if ( UMAHasWindowManager() )
1354 return GetWindowClass( inWindowRef
, outWindowClass
) ;
1358 return kDocumentWindowClass
;
1361 OSStatus
UMAGetWindowAttributes( WindowRef inWindowRef
, WindowAttributes
*outAttributes
)
1363 #if UMA_USE_WINDOWMGR
1364 if ( UMAHasWindowManager() )
1366 return GetWindowAttributes( inWindowRef
, outAttributes
) ;
1369 return kWindowNoAttributes
;
1372 void UMAShowFloatingWindows()
1374 #if UMA_USE_WINDOWMGR
1375 if ( UMAHasWindowManager() )
1377 ShowFloatingWindows() ;
1382 void UMAHideFloatingWindows()
1384 #if UMA_USE_WINDOWMGR
1385 if ( UMAHasWindowManager() )
1387 HideFloatingWindows() ;
1392 Boolean
UMAAreFloatingWindowsVisible()
1394 #if UMA_USE_WINDOWMGR
1395 if ( UMAHasWindowManager() )
1397 return AreFloatingWindowsVisible() ;
1403 WindowRef
UMAFrontNonFloatingWindow()
1405 #if UMA_USE_WINDOWMGR
1406 if ( UMAHasWindowManager() )
1408 return FrontNonFloatingWindow() ;
1413 return FrontWindow() ;
1417 WindowRef
UMAFrontWindow()
1419 #if UMA_USE_WINDOWMGR
1420 if ( UMAHasWindowManager() )
1422 return FrontWindow() ;
1427 return FrontWindow() ;
1431 WindowRef
UMAGetActiveNonFloatingWindow()
1436 bool UMAIsWindowFloating( WindowRef inWindow
)
1440 UMAGetWindowClass( inWindow
, &cl
) ;
1441 return cl
== kFloatingWindowClass
;
1444 bool UMAIsWindowModal( WindowRef inWindow
)
1448 UMAGetWindowClass( inWindow
, &cl
) ;
1449 return cl
< kFloatingWindowClass
;
1454 void UMAHighlightAndActivateWindow( WindowRef inWindowRef
, bool inActivate
)
1458 // bool isHighlighted = IsWindowHighlited( inWindowRef ) ;
1459 // if ( inActivate != isHightlited )
1463 SetPort( GetWindowPort( inWindowRef
) ) ;
1465 SetPort( inWindowRef
) ;
1467 SetOrigin( 0 , 0 ) ;
1468 HiliteWindow( inWindowRef
, inActivate
) ;
1469 ControlHandle control
= NULL
;
1470 UMAGetRootControl( inWindowRef
, & control
) ;
1474 UMAActivateControl( control
) ;
1476 UMADeactivateControl( control
) ;
1481 OSStatus
UMADrawThemePlacard( const Rect
*inRect
, ThemeDrawState inState
)
1483 #if UMA_USE_APPEARANCE
1484 if ( UMAHasAppearance() )
1486 ::DrawThemePlacard( inRect
, inState
) ;