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
) ;
431 void UMAHideWindow( WindowRef inWindowRef
)
433 HideWindow( inWindowRef
) ;
436 void UMASelectWindow( WindowRef inWindowRef
)
438 SelectWindow( inWindowRef
) ;
441 void UMABringToFront( WindowRef inWindowRef
)
443 BringToFront( inWindowRef
) ;
446 void UMASendBehind( WindowRef inWindowRef
, WindowRef behindWindow
)
448 SendBehind( inWindowRef
, behindWindow
) ;
451 void UMACloseWindow(WindowRef inWindowRef
)
455 CloseWindow( inWindowRef
) ;
459 // appearance additions
461 void UMAActivateControl( ControlHandle inControl
)
463 #if UMA_USE_APPEARANCE
464 if ( UMAHasAppearance() )
466 if ( !UMAIsControlActive( inControl
) )
468 bool visible
= IsControlVisible( inControl
) ;
470 SetControlVisibility( inControl
, false , false ) ;
471 ::ActivateControl( inControl
) ;
473 SetControlVisibility( inControl
, true , false ) ;
475 InvalWindowRect(GetControlOwner(inControl
),GetControlBounds(inControl
,&ctrlBounds
) ) ;
483 AGAActivateControl( inControl
) ;
491 void UMADrawControl( ControlHandle inControl
)
493 WindowRef theWindow
= GetControlOwner(inControl
) ;
494 RgnHandle updateRgn
= NewRgn() ;
496 GetWindowRegion( theWindow
, kWindowUpdateRgn
, updateRgn
) ;
498 GetWindowUpdateRgn( theWindow
, updateRgn
) ;
500 Point zero
= { 0 , 0 } ;
501 LocalToGlobal( &zero
) ;
502 OffsetRgn( updateRgn
, -zero
.h
, -zero
.v
) ;
503 #if UMA_USE_APPEARANCE
504 if ( UMAHasAppearance() )
506 ::DrawControlInCurrentPort( inControl
) ;
512 AGADrawControl( inControl
) ;
518 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
519 InvalWindowRgn( theWindow
, updateRgn
) ;
521 InvalRgn( updateRgn
) ;
523 DisposeRgn( updateRgn
) ;
527 void UMAMoveControl( ControlHandle inControl
, short x
, short y
)
529 if ( UMAHasAppearance() )
531 bool visible
= UMAIsControlVisible( inControl
) ;
533 SetControlVisibility( inControl
, false , false ) ;
535 InvalWindowRect(GetControlOwner(inControl
),GetControlBounds(inControl
,&ctrlBounds
) ) ;
537 ::MoveControl( inControl
, x
, y
) ;
539 SetControlVisibility( inControl
, true , false ) ;
541 InvalWindowRect(GetControlOwner(inControl
),GetControlBounds(inControl
,&ctrlBounds
) ) ;
546 void UMASizeControl( ControlHandle inControl
, short x
, short y
)
548 if ( UMAHasAppearance() )
550 bool visible
= UMAIsControlVisible( inControl
) ;
552 SetControlVisibility( inControl
, false , false ) ;
554 InvalWindowRect(GetControlOwner(inControl
),GetControlBounds(inControl
,&ctrlBounds
) ) ;
556 ::SizeControl( inControl
, x
, y
) ;
558 SetControlVisibility( inControl
, true , false ) ;
560 InvalWindowRect(GetControlOwner(inControl
),GetControlBounds(inControl
,&ctrlBounds
) ) ;
565 void UMADeactivateControl( ControlHandle inControl
)
567 if ( UMAHasAppearance() )
569 if ( UMAIsControlActive( inControl
) )
571 bool visible
= IsControlVisible( inControl
) ;
573 SetControlVisibility( inControl
, false , false ) ;
574 ::DeactivateControl( inControl
) ;
576 SetControlVisibility( inControl
, true , false ) ;
578 InvalWindowRect(GetControlOwner(inControl
),GetControlBounds(inControl
,&ctrlBounds
) ) ;
584 void UMASetThemeWindowBackground (WindowRef inWindow
,
588 #if UMA_USE_APPEARANCE
589 if ( UMAHasAppearance() )
591 ::SetThemeWindowBackground( inWindow
,inBrush
, inUpdate
) ;
597 AGASetThemeWindowBackground( inWindow
, inBrush
, inUpdate
) ;
605 void UMAApplyThemeBackground (ThemeBackgroundKind inKind
,
607 ThemeDrawState inState
,
611 #if UMA_USE_APPEARANCE
612 if ( UMAHasAppearance() )
615 if ( sUMAAppearanceVersion >= 0x0110 )
616 ::ApplyThemeBackground( inKind ,bounds , inState , inDepth , inColorDev ) ;
623 AGAApplyThemeBackground( inKind
,bounds
, inState
, inDepth
, inColorDev
) ;
631 ControlHandle
UMANewControl(WindowPtr owningWindow
,
632 const Rect
* boundsRect
,
633 ConstStr255Param controlTitle
,
634 Boolean initiallyVisible
,
639 SInt32 controlReference
)
641 ControlHandle theControl
= NULL
;
642 #if UMA_USE_APPEARANCE
643 if ( UMAHasAppearance() )
645 theControl
= NewControl( owningWindow
, boundsRect
, controlTitle
, initiallyVisible
,
646 initialValue
, minimumValue
, maximumValue
, procID
, controlReference
) ;
652 theControl
= AGANewControl( owningWindow
, boundsRect
, controlTitle
, initiallyVisible
,
653 initialValue
, minimumValue
, maximumValue
, procID
, controlReference
) ;
662 void UMADisposeControl (ControlHandle theControl
)
664 if ( UMAHasAppearance() )
666 ::DisposeControl( theControl
) ;
670 ::DisposeControl( theControl
) ;
674 void UMAHiliteControl (ControlHandle inControl
,
675 ControlPartCode hiliteState
)
677 if ( UMAHasAppearance() )
679 ::HiliteControl( inControl
, hiliteState
) ;
683 ::HiliteControl( inControl
, hiliteState
) ;
687 // shows the control and adds the region to the update region
688 void UMAShowControl (ControlHandle inControl
)
690 if ( UMAHasAppearance() )
692 SetControlVisibility( inControl
, true , false ) ;
694 InvalWindowRect(GetControlOwner(inControl
),GetControlBounds(inControl
,&ctrlBounds
) ) ;
698 // Hides the control and adds the region to the update region
699 void UMAHideControl (ControlHandle inControl
)
701 if ( UMAHasAppearance() )
703 ::HideControl( inControl
) ;
707 ::HideControl( inControl
) ;
712 void UMASetControlVisibility (ControlHandle inControl
,
716 if ( UMAHasAppearance() )
718 #if UMA_USE_APPEARANCE
719 ::SetControlVisibility( inControl
, inIsVisible
, inDoDraw
) ;
726 bool UMAIsControlActive (ControlHandle inControl
)
729 return IsControlActive( inControl
) ;
731 #if UMA_USE_APPEARANCE
732 if ( UMAHasAppearance() )
734 return IsControlActive( inControl
) ;
738 return (**inControl
).contrlHilite
== 0 ;
743 bool UMAIsControlVisible (ControlHandle inControl
)
745 #if UMA_USE_APPEARANCE
746 if ( UMAHasAppearance() )
748 return IsControlVisible( inControl
) ;
754 return (**inControl
).contrlVis
== 255 ;
760 OSErr
UMAGetBestControlRect (ControlHandle inControl
,
762 SInt16
* outBaseLineOffset
)
764 #if UMA_USE_APPEARANCE
765 if ( UMAHasAppearance() )
767 return GetBestControlRect( inControl
, outRect
, outBaseLineOffset
) ;
773 return AGAGetBestControlRect( inControl
, outRect
, outBaseLineOffset
) ;
783 OSErr
UMASetControlFontStyle (ControlHandle inControl
,
784 const ControlFontStyleRec
* inStyle
)
786 #if UMA_USE_APPEARANCE
787 if ( UMAHasAppearance() )
789 return ::SetControlFontStyle( inControl
, inStyle
) ;
794 return AGASetControlFontStyle( inControl
, inStyle
) ;
806 OSErr
UMACreateRootControl (WindowPtr inWindow
,
807 ControlHandle
* outControl
)
809 #if UMA_USE_APPEARANCE
810 if ( UMAHasAppearance() )
812 return CreateRootControl( inWindow
, outControl
) ;
817 return AGACreateRootControl( inWindow
, outControl
) ;
827 OSErr
UMAEmbedControl (ControlHandle inControl
,
828 ControlHandle inContainer
)
830 #if UMA_USE_APPEARANCE
831 if ( UMAHasAppearance() )
833 return EmbedControl( inControl
, inContainer
) ;
838 return AGAEmbedControl( inControl
, inContainer
) ; ;
849 OSErr
UMASetKeyboardFocus (WindowPtr inWindow
,
850 ControlHandle inControl
,
851 ControlFocusPart inPart
)
857 SetPort( GetWindowPort( inWindow
) ) ;
859 SetPort( inWindow
) ;
862 #if UMA_USE_APPEARANCE
863 if ( UMAHasAppearance() )
865 err
= SetKeyboardFocus( inWindow
, inControl
, inPart
) ;
870 err
= AGASetKeyboardFocus( inWindow
, inControl
, inPart
) ;
884 ControlPartCode
UMAHandleControlClick (ControlHandle inControl
,
887 ControlActionUPP inAction
)
889 #if UMA_USE_APPEARANCE
890 if ( UMAHasAppearance() )
892 return HandleControlClick( inControl
, inWhere
, inModifiers
, inAction
) ;
898 return AGAHandleControlClick( inControl
, inWhere
, inModifiers
, inAction
) ;
908 SInt16
UMAHandleControlKey (ControlHandle inControl
,
913 #if UMA_USE_APPEARANCE
914 if ( UMAHasAppearance() )
916 return HandleControlKey( inControl
, inKeyCode
, inCharCode
, inModifiers
) ;
922 return AGAHandleControlKey(inControl
, inKeyCode
, inCharCode
, inModifiers
) ;
933 void UMAIdleControls (WindowPtr inWindow
)
935 #if UMA_USE_APPEARANCE
936 if ( UMAHasAppearance() )
938 IdleControls( inWindow
) ;
944 AGAIdleControls( inWindow
) ;
952 void UMAUpdateControls( WindowPtr inWindow
, RgnHandle inRgn
)
954 RgnHandle updateRgn
= NewRgn() ;
956 GetWindowRegion( inWindow
, kWindowUpdateRgn
, updateRgn
) ;
958 GetWindowUpdateRgn( inWindow
, updateRgn
) ;
960 Point zero
= { 0 , 0 } ;
961 LocalToGlobal( &zero
) ;
962 OffsetRgn( updateRgn
, -zero
.h
, -zero
.v
) ;
963 #if UMA_USE_APPEARANCE
964 if ( UMAHasAppearance() )
966 UpdateControls( inWindow
, inRgn
) ;
972 AGAUpdateControls( inWindow
, inRgn
) ;
978 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
979 InvalWindowRgn( inWindow
, updateRgn
) ;
981 InvalRgn( updateRgn
) ;
983 DisposeRgn( updateRgn
) ;
987 OSErr
UMAGetRootControl( WindowPtr inWindow
, ControlHandle
*outControl
)
989 #if UMA_USE_APPEARANCE
990 if ( UMAHasAppearance() )
992 return GetRootControl( inWindow
, outControl
) ;
998 return AGAGetRootControl( inWindow
, outControl
) ;
1008 // handling control data
1010 OSErr
UMASetControlData (ControlHandle inControl
,
1011 ControlPartCode inPart
,
1016 #if UMA_USE_APPEARANCE
1017 if ( UMAHasAppearance() )
1019 return SetControlData( inControl
, inPart
, inTagName
, inSize
, inData
) ;
1024 return AGASetControlData( inControl
, inPart
, inTagName
, inSize
, inData
) ;
1034 OSErr
UMAGetControlData (ControlHandle inControl
,
1035 ControlPartCode inPart
,
1039 Size
* outActualSize
)
1041 #if UMA_USE_APPEARANCE
1042 if ( UMAHasAppearance() )
1044 return ::GetControlData( inControl
, inPart
, inTagName
, inBufferSize
, outBuffer
, outActualSize
) ;
1050 return AGAGetControlData( inControl
, inPart
, inTagName
, inBufferSize
, outBuffer
, outActualSize
) ;
1060 OSErr
UMAGetControlDataSize (ControlHandle inControl
,
1061 ControlPartCode inPart
,
1065 #if UMA_USE_APPEARANCE
1066 if ( UMAHasAppearance() )
1068 return GetControlDataSize( inControl
, inPart
, inTagName
, outMaxSize
) ;
1074 return AGAGetControlDataSize( inControl
, inPart
, inTagName
, outMaxSize
) ;
1087 // system 8.0 changes
1089 short UMAFindWindow( Point inPoint
, WindowRef
*outWindow
)
1091 // todo add the additional area codes
1092 return FindWindow( inPoint
, outWindow
) ;
1095 OSStatus
UMAGetWindowFeatures( WindowRef inWindowRef
, UInt32
*outFeatures
)
1097 #if UMA_USE_WINDOWMGR
1098 return GetWindowFeatures( inWindowRef
, outFeatures
) ;
1104 OSStatus
UMAGetWindowRegion( WindowRef inWindowRef
, WindowRegionCode inRegionCode
, RgnHandle ioWinRgn
)
1106 #if UMA_USE_WINDOWMGR
1107 return GetWindowRegion( inWindowRef
, inRegionCode
, ioWinRgn
) ;
1113 void UMADrawGrowIcon( WindowRef inWindowRef
)
1115 DrawGrowIcon( inWindowRef
) ;
1118 OSStatus
UMACollapseWindow( WindowRef inWindowRef
, Boolean inCollapseIt
)
1120 return CollapseWindow( inWindowRef
, inCollapseIt
) ;
1123 OSStatus
UMACollapseAllWindows( Boolean inCollapseEm
)
1125 return CollapseAllWindows( inCollapseEm
) ;
1128 Boolean
UMAIsWindowCollapsed( WindowRef inWindowRef
)
1130 return IsWindowCollapsed( inWindowRef
) ;
1133 Boolean
UMAIsWindowCollapsable( WindowRef inWindowRef
)
1135 return IsWindowCollapsable( inWindowRef
) ;
1138 // system 8.5 changes<MacWindows.h>
1139 OSStatus
UMACreateNewWindow( WindowClass windowClass
, WindowAttributes attributes
, const Rect
*bounds
, WindowRef
*outWindow
)
1141 #if UMA_USE_WINDOWMGR
1142 if ( UMAHasWindowManager() )
1144 return CreateNewWindow( windowClass
, attributes
, bounds
, outWindow
) ;
1150 if ( UMAHasAppearance() )
1152 switch( windowClass
)
1154 case kMovableModalWindowClass
:
1155 procID
= kWindowMovableModalDialogProc
;
1157 case kModalWindowClass
:
1158 procID
= kWindowShadowDialogProc
;
1160 case kFloatingWindowClass
:
1161 if ( attributes
& kWindowSideTitlebarAttribute
)
1163 if( ( attributes
& kWindowResizableAttribute
) &&
1164 ( attributes
& kWindowFullZoomAttribute
) )
1166 procID
= kWindowFloatSideFullZoomGrowProc
;
1168 else if( attributes
& kWindowFullZoomAttribute
)
1170 procID
= kWindowFloatSideFullZoomProc
;
1172 else if ( attributes
& kWindowResizableAttribute
)
1174 procID
= kWindowFloatSideGrowProc
;
1178 procID
= kWindowFloatSideProc
;
1183 if( ( attributes
& kWindowResizableAttribute
) &&
1184 ( attributes
& kWindowFullZoomAttribute
) )
1186 procID
= kWindowFloatFullZoomGrowProc
;
1188 else if( attributes
& kWindowFullZoomAttribute
)
1190 procID
= kWindowFloatFullZoomProc
;
1192 else if ( attributes
& kWindowResizableAttribute
)
1194 procID
= kWindowFloatGrowProc
;
1198 procID
= kWindowFloatProc
;
1202 case kDocumentWindowClass
:
1204 if( ( attributes
& kWindowResizableAttribute
) &&
1205 ( attributes
& kWindowFullZoomAttribute
) )
1207 procID
= kWindowFullZoomGrowDocumentProc
;
1209 else if( attributes
& kWindowFullZoomAttribute
)
1211 procID
= kWindowFullZoomDocumentProc
;
1213 else if ( attributes
& kWindowResizableAttribute
)
1215 procID
= kWindowGrowDocumentProc
;
1219 procID
= kWindowDocumentProc
;
1226 switch( windowClass
)
1228 case kMovableModalWindowClass
:
1229 procID
= movableDBoxProc
;
1231 case kModalWindowClass
:
1232 procID
= altDBoxProc
;
1234 case kFloatingWindowClass
:
1235 if ( attributes
& kWindowSideTitlebarAttribute
)
1237 if( ( attributes
& kWindowResizableAttribute
) &&
1238 ( attributes
& kWindowFullZoomAttribute
) )
1240 procID
= floatSideZoomGrowProc
;
1242 else if( attributes
& kWindowFullZoomAttribute
)
1244 procID
= floatSideZoomProc
;
1246 else if ( attributes
& kWindowResizableAttribute
)
1248 procID
= floatSideGrowProc
;
1252 procID
= floatSideProc
;
1257 if( ( attributes
& kWindowResizableAttribute
) &&
1258 ( attributes
& kWindowFullZoomAttribute
) )
1260 procID
= floatZoomGrowProc
;
1262 else if( attributes
& kWindowFullZoomAttribute
)
1264 procID
= floatZoomProc
;
1266 else if ( attributes
& kWindowResizableAttribute
)
1268 procID
= floatGrowProc
;
1276 case kDocumentWindowClass
:
1278 if( ( attributes
& kWindowResizableAttribute
) &&
1279 ( attributes
& kWindowFullZoomAttribute
) )
1281 procID
= zoomDocProc
;
1283 else if( attributes
& kWindowFullZoomAttribute
)
1285 procID
= zoomNoGrow
;
1287 else if ( attributes
& kWindowResizableAttribute
)
1289 procID
= documentProc
;
1293 procID
= noGrowDocProc
;
1299 *outWindow
= NewCWindow(nil
, bounds
, "\p", false, procID
, (WindowRef
) -1 /*behind*/,
1300 attributes
& kWindowCloseBoxAttribute
, (long)NULL
);
1305 OSStatus
UMAGetWindowClass( WindowRef inWindowRef
, WindowClass
*outWindowClass
)
1307 #if UMA_USE_WINDOWMGR
1308 if ( UMAHasWindowManager() )
1310 return GetWindowClass( inWindowRef
, outWindowClass
) ;
1314 return kDocumentWindowClass
;
1317 OSStatus
UMAGetWindowAttributes( WindowRef inWindowRef
, WindowAttributes
*outAttributes
)
1319 #if UMA_USE_WINDOWMGR
1320 if ( UMAHasWindowManager() )
1322 return GetWindowAttributes( inWindowRef
, outAttributes
) ;
1325 return kWindowNoAttributes
;
1328 void UMAShowFloatingWindows()
1330 #if UMA_USE_WINDOWMGR
1331 if ( UMAHasWindowManager() )
1333 ShowFloatingWindows() ;
1338 void UMAHideFloatingWindows()
1340 #if UMA_USE_WINDOWMGR
1341 if ( UMAHasWindowManager() )
1343 HideFloatingWindows() ;
1348 Boolean
UMAAreFloatingWindowsVisible()
1350 #if UMA_USE_WINDOWMGR
1351 if ( UMAHasWindowManager() )
1353 return AreFloatingWindowsVisible() ;
1359 WindowRef
UMAFrontNonFloatingWindow()
1361 #if UMA_USE_WINDOWMGR
1362 if ( UMAHasWindowManager() )
1364 return FrontNonFloatingWindow() ;
1369 return FrontWindow() ;
1373 WindowRef
UMAFrontWindow()
1375 #if UMA_USE_WINDOWMGR
1376 if ( UMAHasWindowManager() )
1378 return FrontWindow() ;
1383 return FrontWindow() ;
1387 WindowRef
UMAGetActiveNonFloatingWindow()
1392 bool UMAIsWindowFloating( WindowRef inWindow
)
1396 UMAGetWindowClass( inWindow
, &cl
) ;
1397 return cl
== kFloatingWindowClass
;
1400 bool UMAIsWindowModal( WindowRef inWindow
)
1404 UMAGetWindowClass( inWindow
, &cl
) ;
1405 return cl
< kFloatingWindowClass
;
1410 void UMAHighlightAndActivateWindow( WindowRef inWindowRef
, bool inActivate
)
1414 // bool isHighlighted = IsWindowHighlited( inWindowRef ) ;
1415 // if ( inActivate != isHightlited )
1419 SetPort( GetWindowPort( inWindowRef
) ) ;
1421 SetPort( inWindowRef
) ;
1423 SetOrigin( 0 , 0 ) ;
1424 HiliteWindow( inWindowRef
, inActivate
) ;
1425 ControlHandle control
= NULL
;
1426 UMAGetRootControl( inWindowRef
, & control
) ;
1430 UMAActivateControl( control
) ;
1432 UMADeactivateControl( control
) ;
1437 OSStatus
UMADrawThemePlacard( const Rect
*inRect
, ThemeDrawState inState
)
1439 #if UMA_USE_APPEARANCE
1440 if ( UMAHasAppearance() )
1442 ::DrawThemePlacard( inRect
, inState
) ;