3 #include "wx/mac/uma.h"
4 #include "wx/mac/aga.h"
7 #include <Navigation.h>
13 #define GetControlOwner( control ) (**control).contrlOwner
14 // since we always call this in the right context we don't have to set and reset the port
15 #define InvalWindowRgn( window , rgn ) InvalRgn( rgn )
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 ;
292 #if PM_USE_SESSION_APIS
293 OSStatus
UMAPrOpen(PMPrintSession
*macPrintPort
)
301 if ( gPrOpenCounter
== 1 )
305 wxASSERT( err
== noErr
) ;
309 OSStatus err
= noErr
;
311 if ( gPrOpenCounter
== 1 )
313 #if PM_USE_SESSION_APIS
314 err
= PMCreateSession(macPrintPort
) ;
318 wxASSERT( err
== noErr
) ;
324 #if PM_USE_SESSION_APIS
325 OSStatus
UMAPrClose(PMPrintSession
*macPrintPort
)
327 OSStatus
UMAPrClose()
332 wxASSERT( gPrOpenCounter
>= 1 ) ;
333 if ( gPrOpenCounter
== 1 )
337 wxASSERT( err
== noErr
) ;
342 OSStatus err
= noErr
;
343 wxASSERT( gPrOpenCounter
>= 1 ) ;
344 if ( gPrOpenCounter
== 1 )
346 #if PM_USE_SESSION_APIS
347 err
= PMRelease(*macPrintPort
) ;
359 pascal QDGlobalsPtr
GetQDGlobalsPtr (void)
361 return QDGlobalsPtr (* (Ptr
*) LMGetCurrentA5 ( ) - 0xCA);
366 void UMAShowWatchCursor()
370 CursHandle watchFob
= GetCursor (watchCursor
);
377 Cursor preservedArrow
;
378 GetQDGlobalsArrow (&preservedArrow
);
379 SetQDGlobalsArrow (*watchFob
);
381 SetQDGlobalsArrow (&preservedArrow
);
383 SetCursor (*watchFob
);
388 void UMAShowArrowCursor()
392 SetCursor (GetQDGlobalsArrow (&arrow
));
394 SetCursor (&(qd
.arrow
));
400 GrafPtr
UMAGetWindowPort( WindowRef inWindowRef
)
402 wxASSERT( inWindowRef
!= NULL
) ;
404 return GetWindowPort( inWindowRef
) ;
406 return (GrafPtr
) inWindowRef
;
410 void UMADisposeWindow( WindowRef inWindowRef
)
412 wxASSERT( inWindowRef
!= NULL
) ;
413 DisposeWindow( inWindowRef
) ;
416 void UMASetWTitleC( WindowRef inWindowRef
, const char *title
)
419 strncpy( (char*)ptitle
, title
, 96 ) ;
422 c2pstrcpy( ptitle
, (char *)ptitle
) ;
424 c2pstr( (char*)ptitle
) ;
426 SetWTitle( inWindowRef
, ptitle
) ;
429 void UMAGetWTitleC( WindowRef inWindowRef
, char *title
)
431 GetWTitle( inWindowRef
, (unsigned char*)title
) ;
433 p2cstrcpy( title
, (unsigned char *)title
) ;
435 p2cstr( (unsigned char*)title
) ;
439 void UMAShowWindow( WindowRef inWindowRef
)
441 ShowWindow( inWindowRef
) ;
445 void UMAHideWindow( WindowRef inWindowRef
)
447 HideWindow( inWindowRef
) ;
450 void UMASelectWindow( WindowRef inWindowRef
)
452 SelectWindow( inWindowRef
) ;
455 void UMABringToFront( WindowRef inWindowRef
)
457 BringToFront( inWindowRef
) ;
460 void UMASendBehind( WindowRef inWindowRef
, WindowRef behindWindow
)
462 SendBehind( inWindowRef
, behindWindow
) ;
465 void UMACloseWindow(WindowRef inWindowRef
)
469 CloseWindow( inWindowRef
) ;
473 // appearance additions
475 void UMAActivateControl( ControlHandle inControl
)
477 #if UMA_USE_APPEARANCE
478 if ( UMAHasAppearance() )
480 if ( !UMAIsControlActive( inControl
) )
482 bool visible
= IsControlVisible( inControl
) ;
484 SetControlVisibility( inControl
, false , false ) ;
485 ::ActivateControl( inControl
) ;
487 SetControlVisibility( inControl
, true , false ) ;
489 InvalWindowRect(GetControlOwner(inControl
),GetControlBounds(inControl
,&ctrlBounds
) ) ;
497 AGAActivateControl( inControl
) ;
505 void UMADrawControl( ControlHandle inControl
)
507 WindowRef theWindow
= GetControlOwner(inControl
) ;
508 RgnHandle updateRgn
= NewRgn() ;
510 GetWindowRegion( theWindow
, kWindowUpdateRgn
, updateRgn
) ;
512 GetWindowUpdateRgn( theWindow
, updateRgn
) ;
514 Point zero
= { 0 , 0 } ;
515 LocalToGlobal( &zero
) ;
516 OffsetRgn( updateRgn
, -zero
.h
, -zero
.v
) ;
517 #if UMA_USE_APPEARANCE
518 if ( UMAHasAppearance() )
520 ::DrawControlInCurrentPort( inControl
) ;
526 AGADrawControl( inControl
) ;
532 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
533 InvalWindowRgn( theWindow
, updateRgn
) ;
535 InvalRgn( updateRgn
) ;
537 DisposeRgn( updateRgn
) ;
541 void UMAMoveControl( ControlHandle inControl
, short x
, short y
)
543 if ( UMAHasAppearance() )
545 bool visible
= UMAIsControlVisible( inControl
) ;
547 SetControlVisibility( inControl
, false , false ) ;
549 InvalWindowRect(GetControlOwner(inControl
),GetControlBounds(inControl
,&ctrlBounds
) ) ;
551 ::MoveControl( inControl
, x
, y
) ;
553 SetControlVisibility( inControl
, true , false ) ;
555 InvalWindowRect(GetControlOwner(inControl
),GetControlBounds(inControl
,&ctrlBounds
) ) ;
560 void UMASizeControl( ControlHandle inControl
, short x
, short y
)
562 if ( UMAHasAppearance() )
564 bool visible
= UMAIsControlVisible( inControl
) ;
566 SetControlVisibility( inControl
, false , false ) ;
568 InvalWindowRect(GetControlOwner(inControl
),GetControlBounds(inControl
,&ctrlBounds
) ) ;
570 ::SizeControl( inControl
, x
, y
) ;
572 SetControlVisibility( inControl
, true , false ) ;
574 InvalWindowRect(GetControlOwner(inControl
),GetControlBounds(inControl
,&ctrlBounds
) ) ;
579 void UMADeactivateControl( ControlHandle inControl
)
581 if ( UMAHasAppearance() )
583 if ( UMAIsControlActive( inControl
) )
585 bool visible
= IsControlVisible( inControl
) ;
587 SetControlVisibility( inControl
, false , false ) ;
588 ::DeactivateControl( inControl
) ;
590 SetControlVisibility( inControl
, true , false ) ;
592 InvalWindowRect(GetControlOwner(inControl
),GetControlBounds(inControl
,&ctrlBounds
) ) ;
598 void UMASetThemeWindowBackground (WindowRef inWindow
,
602 #if UMA_USE_APPEARANCE
603 if ( UMAHasAppearance() )
605 ::SetThemeWindowBackground( inWindow
,inBrush
, inUpdate
) ;
611 AGASetThemeWindowBackground( inWindow
, inBrush
, inUpdate
) ;
619 void UMAApplyThemeBackground (ThemeBackgroundKind inKind
,
621 ThemeDrawState inState
,
625 #if UMA_USE_APPEARANCE
626 if ( UMAHasAppearance() )
629 if ( sUMAAppearanceVersion >= 0x0110 )
630 ::ApplyThemeBackground( inKind ,bounds , inState , inDepth , inColorDev ) ;
637 AGAApplyThemeBackground( inKind
,bounds
, inState
, inDepth
, inColorDev
) ;
645 ControlHandle
UMANewControl(WindowPtr owningWindow
,
646 const Rect
* boundsRect
,
647 ConstStr255Param controlTitle
,
648 Boolean initiallyVisible
,
653 SInt32 controlReference
)
655 ControlHandle theControl
= NULL
;
656 #if UMA_USE_APPEARANCE
657 if ( UMAHasAppearance() )
659 theControl
= NewControl( owningWindow
, boundsRect
, controlTitle
, initiallyVisible
,
660 initialValue
, minimumValue
, maximumValue
, procID
, controlReference
) ;
666 theControl
= AGANewControl( owningWindow
, boundsRect
, controlTitle
, initiallyVisible
,
667 initialValue
, minimumValue
, maximumValue
, procID
, controlReference
) ;
676 void UMADisposeControl (ControlHandle theControl
)
678 if ( UMAHasAppearance() )
680 ::DisposeControl( theControl
) ;
684 ::DisposeControl( theControl
) ;
688 void UMAHiliteControl (ControlHandle inControl
,
689 ControlPartCode hiliteState
)
691 if ( UMAHasAppearance() )
693 ::HiliteControl( inControl
, hiliteState
) ;
697 ::HiliteControl( inControl
, hiliteState
) ;
701 // shows the control and adds the region to the update region
702 void UMAShowControl (ControlHandle inControl
)
704 if ( UMAHasAppearance() )
706 SetControlVisibility( inControl
, true , false ) ;
708 InvalWindowRect(GetControlOwner(inControl
),GetControlBounds(inControl
,&ctrlBounds
) ) ;
712 // Hides the control and adds the region to the update region
713 void UMAHideControl (ControlHandle inControl
)
715 if ( UMAHasAppearance() )
717 ::HideControl( inControl
) ;
721 ::HideControl( inControl
) ;
726 void UMASetControlVisibility (ControlHandle inControl
,
730 if ( UMAHasAppearance() )
732 #if UMA_USE_APPEARANCE
733 ::SetControlVisibility( inControl
, inIsVisible
, inDoDraw
) ;
740 bool UMAIsControlActive (ControlHandle inControl
)
743 return IsControlActive( inControl
) ;
745 #if UMA_USE_APPEARANCE
746 if ( UMAHasAppearance() )
748 return IsControlActive( inControl
) ;
752 return (**inControl
).contrlHilite
== 0 ;
757 bool UMAIsControlVisible (ControlHandle inControl
)
759 #if UMA_USE_APPEARANCE
760 if ( UMAHasAppearance() )
762 return IsControlVisible( inControl
) ;
768 return (**inControl
).contrlVis
== 255 ;
774 OSErr
UMAGetBestControlRect (ControlHandle inControl
,
776 SInt16
* outBaseLineOffset
)
778 #if UMA_USE_APPEARANCE
779 if ( UMAHasAppearance() )
781 return GetBestControlRect( inControl
, outRect
, outBaseLineOffset
) ;
787 return AGAGetBestControlRect( inControl
, outRect
, outBaseLineOffset
) ;
797 OSErr
UMASetControlFontStyle (ControlHandle inControl
,
798 const ControlFontStyleRec
* inStyle
)
800 #if UMA_USE_APPEARANCE
801 if ( UMAHasAppearance() )
803 return ::SetControlFontStyle( inControl
, inStyle
) ;
808 return AGASetControlFontStyle( inControl
, inStyle
) ;
820 OSErr
UMACreateRootControl (WindowPtr inWindow
,
821 ControlHandle
* outControl
)
823 #if UMA_USE_APPEARANCE
824 if ( UMAHasAppearance() )
826 return CreateRootControl( inWindow
, outControl
) ;
831 return AGACreateRootControl( inWindow
, outControl
) ;
841 OSErr
UMAEmbedControl (ControlHandle inControl
,
842 ControlHandle inContainer
)
844 #if UMA_USE_APPEARANCE
845 if ( UMAHasAppearance() )
847 return EmbedControl( inControl
, inContainer
) ;
852 return AGAEmbedControl( inControl
, inContainer
) ; ;
863 OSErr
UMASetKeyboardFocus (WindowPtr inWindow
,
864 ControlHandle inControl
,
865 ControlFocusPart inPart
)
871 SetPort( GetWindowPort( inWindow
) ) ;
873 SetPort( inWindow
) ;
876 #if UMA_USE_APPEARANCE
877 if ( UMAHasAppearance() )
879 err
= SetKeyboardFocus( inWindow
, inControl
, inPart
) ;
884 err
= AGASetKeyboardFocus( inWindow
, inControl
, inPart
) ;
898 ControlPartCode
UMAHandleControlClick (ControlHandle inControl
,
901 ControlActionUPP inAction
)
903 #if UMA_USE_APPEARANCE
904 if ( UMAHasAppearance() )
906 return HandleControlClick( inControl
, inWhere
, inModifiers
, inAction
) ;
912 return AGAHandleControlClick( inControl
, inWhere
, inModifiers
, inAction
) ;
922 SInt16
UMAHandleControlKey (ControlHandle inControl
,
927 #if UMA_USE_APPEARANCE
928 if ( UMAHasAppearance() )
930 return HandleControlKey( inControl
, inKeyCode
, inCharCode
, inModifiers
) ;
936 return AGAHandleControlKey(inControl
, inKeyCode
, inCharCode
, inModifiers
) ;
947 void UMAIdleControls (WindowPtr inWindow
)
949 #if UMA_USE_APPEARANCE
950 if ( UMAHasAppearance() )
952 IdleControls( inWindow
) ;
958 AGAIdleControls( inWindow
) ;
966 void UMAUpdateControls( WindowPtr inWindow
, RgnHandle inRgn
)
968 RgnHandle updateRgn
= NewRgn() ;
970 GetWindowRegion( inWindow
, kWindowUpdateRgn
, updateRgn
) ;
972 GetWindowUpdateRgn( inWindow
, updateRgn
) ;
974 Point zero
= { 0 , 0 } ;
975 LocalToGlobal( &zero
) ;
976 OffsetRgn( updateRgn
, -zero
.h
, -zero
.v
) ;
977 #if UMA_USE_APPEARANCE
978 if ( UMAHasAppearance() )
980 UpdateControls( inWindow
, inRgn
) ;
986 AGAUpdateControls( inWindow
, inRgn
) ;
992 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
993 InvalWindowRgn( inWindow
, updateRgn
) ;
995 InvalRgn( updateRgn
) ;
997 DisposeRgn( updateRgn
) ;
1001 OSErr
UMAGetRootControl( WindowPtr inWindow
, ControlHandle
*outControl
)
1003 #if UMA_USE_APPEARANCE
1004 if ( UMAHasAppearance() )
1006 return GetRootControl( inWindow
, outControl
) ;
1012 return AGAGetRootControl( inWindow
, outControl
) ;
1022 // handling control data
1024 OSErr
UMASetControlData (ControlHandle inControl
,
1025 ControlPartCode inPart
,
1030 #if UMA_USE_APPEARANCE
1031 if ( UMAHasAppearance() )
1033 return SetControlData( inControl
, inPart
, inTagName
, inSize
, inData
) ;
1038 return AGASetControlData( inControl
, inPart
, inTagName
, inSize
, inData
) ;
1048 OSErr
UMAGetControlData (ControlHandle inControl
,
1049 ControlPartCode inPart
,
1053 Size
* outActualSize
)
1055 #if UMA_USE_APPEARANCE
1056 if ( UMAHasAppearance() )
1058 return ::GetControlData( inControl
, inPart
, inTagName
, inBufferSize
, outBuffer
, outActualSize
) ;
1064 return AGAGetControlData( inControl
, inPart
, inTagName
, inBufferSize
, outBuffer
, outActualSize
) ;
1074 OSErr
UMAGetControlDataSize (ControlHandle inControl
,
1075 ControlPartCode inPart
,
1079 #if UMA_USE_APPEARANCE
1080 if ( UMAHasAppearance() )
1082 return GetControlDataSize( inControl
, inPart
, inTagName
, outMaxSize
) ;
1088 return AGAGetControlDataSize( inControl
, inPart
, inTagName
, outMaxSize
) ;
1101 // system 8.0 changes
1103 short UMAFindWindow( Point inPoint
, WindowRef
*outWindow
)
1105 // todo add the additional area codes
1106 return FindWindow( inPoint
, outWindow
) ;
1109 OSStatus
UMAGetWindowFeatures( WindowRef inWindowRef
, UInt32
*outFeatures
)
1111 #if UMA_USE_WINDOWMGR
1112 return GetWindowFeatures( inWindowRef
, outFeatures
) ;
1118 OSStatus
UMAGetWindowRegion( WindowRef inWindowRef
, WindowRegionCode inRegionCode
, RgnHandle ioWinRgn
)
1120 #if UMA_USE_WINDOWMGR
1121 return GetWindowRegion( inWindowRef
, inRegionCode
, ioWinRgn
) ;
1127 void UMADrawGrowIcon( WindowRef inWindowRef
)
1129 DrawGrowIcon( inWindowRef
) ;
1132 OSStatus
UMACollapseWindow( WindowRef inWindowRef
, Boolean inCollapseIt
)
1134 return CollapseWindow( inWindowRef
, inCollapseIt
) ;
1137 OSStatus
UMACollapseAllWindows( Boolean inCollapseEm
)
1139 return CollapseAllWindows( inCollapseEm
) ;
1142 Boolean
UMAIsWindowCollapsed( WindowRef inWindowRef
)
1144 return IsWindowCollapsed( inWindowRef
) ;
1147 Boolean
UMAIsWindowCollapsable( WindowRef inWindowRef
)
1149 return IsWindowCollapsable( inWindowRef
) ;
1152 // system 8.5 changes<MacWindows.h>
1153 OSStatus
UMACreateNewWindow( WindowClass windowClass
, WindowAttributes attributes
, const Rect
*bounds
, WindowRef
*outWindow
)
1155 #if UMA_USE_WINDOWMGR
1156 if ( UMAHasWindowManager() )
1158 return CreateNewWindow( windowClass
, attributes
, bounds
, outWindow
) ;
1164 if ( UMAHasAppearance() )
1166 switch( windowClass
)
1168 case kMovableModalWindowClass
:
1169 procID
= kWindowMovableModalDialogProc
;
1171 case kModalWindowClass
:
1172 procID
= kWindowShadowDialogProc
;
1174 case kFloatingWindowClass
:
1175 if ( attributes
& kWindowSideTitlebarAttribute
)
1177 if( ( attributes
& kWindowResizableAttribute
) &&
1178 ( attributes
& kWindowFullZoomAttribute
) )
1180 procID
= kWindowFloatSideFullZoomGrowProc
;
1182 else if( attributes
& kWindowFullZoomAttribute
)
1184 procID
= kWindowFloatSideFullZoomProc
;
1186 else if ( attributes
& kWindowResizableAttribute
)
1188 procID
= kWindowFloatSideGrowProc
;
1192 procID
= kWindowFloatSideProc
;
1197 if( ( attributes
& kWindowResizableAttribute
) &&
1198 ( attributes
& kWindowFullZoomAttribute
) )
1200 procID
= kWindowFloatFullZoomGrowProc
;
1202 else if( attributes
& kWindowFullZoomAttribute
)
1204 procID
= kWindowFloatFullZoomProc
;
1206 else if ( attributes
& kWindowResizableAttribute
)
1208 procID
= kWindowFloatGrowProc
;
1212 procID
= kWindowFloatProc
;
1216 case kDocumentWindowClass
:
1218 if( ( attributes
& kWindowResizableAttribute
) &&
1219 ( attributes
& kWindowFullZoomAttribute
) )
1221 procID
= kWindowFullZoomGrowDocumentProc
;
1223 else if( attributes
& kWindowFullZoomAttribute
)
1225 procID
= kWindowFullZoomDocumentProc
;
1227 else if ( attributes
& kWindowResizableAttribute
)
1229 procID
= kWindowGrowDocumentProc
;
1233 procID
= kWindowDocumentProc
;
1240 switch( windowClass
)
1242 case kMovableModalWindowClass
:
1243 procID
= movableDBoxProc
;
1245 case kModalWindowClass
:
1246 procID
= altDBoxProc
;
1248 case kFloatingWindowClass
:
1249 if ( attributes
& kWindowSideTitlebarAttribute
)
1251 if( ( attributes
& kWindowResizableAttribute
) &&
1252 ( attributes
& kWindowFullZoomAttribute
) )
1254 procID
= floatSideZoomGrowProc
;
1256 else if( attributes
& kWindowFullZoomAttribute
)
1258 procID
= floatSideZoomProc
;
1260 else if ( attributes
& kWindowResizableAttribute
)
1262 procID
= floatSideGrowProc
;
1266 procID
= floatSideProc
;
1271 if( ( attributes
& kWindowResizableAttribute
) &&
1272 ( attributes
& kWindowFullZoomAttribute
) )
1274 procID
= floatZoomGrowProc
;
1276 else if( attributes
& kWindowFullZoomAttribute
)
1278 procID
= floatZoomProc
;
1280 else if ( attributes
& kWindowResizableAttribute
)
1282 procID
= floatGrowProc
;
1290 case kDocumentWindowClass
:
1292 if( ( attributes
& kWindowResizableAttribute
) &&
1293 ( attributes
& kWindowFullZoomAttribute
) )
1295 procID
= zoomDocProc
;
1297 else if( attributes
& kWindowFullZoomAttribute
)
1299 procID
= zoomNoGrow
;
1301 else if ( attributes
& kWindowResizableAttribute
)
1303 procID
= documentProc
;
1307 procID
= noGrowDocProc
;
1313 *outWindow
= NewCWindow(nil
, bounds
, "\p", false, procID
, (WindowRef
) -1 /*behind*/,
1314 attributes
& kWindowCloseBoxAttribute
, (long)NULL
);
1319 OSStatus
UMAGetWindowClass( WindowRef inWindowRef
, WindowClass
*outWindowClass
)
1321 #if UMA_USE_WINDOWMGR
1322 if ( UMAHasWindowManager() )
1324 return GetWindowClass( inWindowRef
, outWindowClass
) ;
1328 return kDocumentWindowClass
;
1331 OSStatus
UMAGetWindowAttributes( WindowRef inWindowRef
, WindowAttributes
*outAttributes
)
1333 #if UMA_USE_WINDOWMGR
1334 if ( UMAHasWindowManager() )
1336 return GetWindowAttributes( inWindowRef
, outAttributes
) ;
1339 return kWindowNoAttributes
;
1342 void UMAShowFloatingWindows()
1344 #if UMA_USE_WINDOWMGR
1345 if ( UMAHasWindowManager() )
1347 ShowFloatingWindows() ;
1352 void UMAHideFloatingWindows()
1354 #if UMA_USE_WINDOWMGR
1355 if ( UMAHasWindowManager() )
1357 HideFloatingWindows() ;
1362 Boolean
UMAAreFloatingWindowsVisible()
1364 #if UMA_USE_WINDOWMGR
1365 if ( UMAHasWindowManager() )
1367 return AreFloatingWindowsVisible() ;
1373 WindowRef
UMAFrontNonFloatingWindow()
1375 #if UMA_USE_WINDOWMGR
1376 if ( UMAHasWindowManager() )
1378 return FrontNonFloatingWindow() ;
1383 return FrontWindow() ;
1387 WindowRef
UMAFrontWindow()
1389 #if UMA_USE_WINDOWMGR
1390 if ( UMAHasWindowManager() )
1392 return FrontWindow() ;
1397 return FrontWindow() ;
1401 WindowRef
UMAGetActiveNonFloatingWindow()
1406 bool UMAIsWindowFloating( WindowRef inWindow
)
1410 UMAGetWindowClass( inWindow
, &cl
) ;
1411 return cl
== kFloatingWindowClass
;
1414 bool UMAIsWindowModal( WindowRef inWindow
)
1418 UMAGetWindowClass( inWindow
, &cl
) ;
1419 return cl
< kFloatingWindowClass
;
1424 void UMAHighlightAndActivateWindow( WindowRef inWindowRef
, bool inActivate
)
1428 // bool isHighlighted = IsWindowHighlited( inWindowRef ) ;
1429 // if ( inActivate != isHightlited )
1433 SetPort( GetWindowPort( inWindowRef
) ) ;
1435 SetPort( inWindowRef
) ;
1437 SetOrigin( 0 , 0 ) ;
1438 HiliteWindow( inWindowRef
, inActivate
) ;
1439 ControlHandle control
= NULL
;
1440 UMAGetRootControl( inWindowRef
, & control
) ;
1444 UMAActivateControl( control
) ;
1446 UMADeactivateControl( control
) ;
1451 OSStatus
UMADrawThemePlacard( const Rect
*inRect
, ThemeDrawState inState
)
1453 #if UMA_USE_APPEARANCE
1454 if ( UMAHasAppearance() )
1456 ::DrawThemePlacard( inRect
, inState
) ;