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 RgnHandle updateRgn
= NewRgn() ;
461 GetWindowUpdateRgn( GetControlOwner(inControl
) , updateRgn
) ;
462 #if UMA_USE_APPEARANCE
463 if ( UMAHasAppearance() )
465 ::ActivateControl( inControl
) ;
471 AGAActivateControl( inControl
) ;
477 InvalRgn( updateRgn
) ;
480 void UMADrawControl( ControlHandle inControl
)
482 RgnHandle updateRgn
= NewRgn() ;
483 GetWindowUpdateRgn( GetControlOwner(inControl
) , updateRgn
) ;
484 #if UMA_USE_APPEARANCE
485 if ( UMAHasAppearance() )
487 ::DrawControlInCurrentPort( inControl
) ;
493 AGADrawControl( inControl
) ;
499 InvalRgn( updateRgn
) ;
502 void UMAMoveControl( ControlHandle inControl
, short x
, short y
)
504 RgnHandle updateRgn
= NewRgn() ;
505 GetWindowUpdateRgn( GetControlOwner(inControl
) , updateRgn
) ;
506 #if UMA_USE_APPEARANCE
507 if ( UMAHasAppearance() )
509 ::MoveControl( inControl
, x
, y
) ;
515 AGAMoveControl( inControl
, x
,y
) ;
521 InvalRgn( updateRgn
) ;
524 void UMASizeControl( ControlHandle inControl
, short x
, short y
)
526 RgnHandle updateRgn
= NewRgn() ;
527 GetWindowUpdateRgn( GetControlOwner(inControl
) , updateRgn
) ;
528 #if UMA_USE_APPEARANCE
529 if ( UMAHasAppearance() )
531 ::SizeControl( inControl
, x
, y
) ;
537 AGASizeControl( inControl
, x
,y
) ;
543 InvalRgn( updateRgn
) ;
546 void UMADeactivateControl( ControlHandle inControl
)
548 RgnHandle updateRgn
= NewRgn() ;
549 GetWindowUpdateRgn( GetControlOwner(inControl
) , updateRgn
) ;
550 #if UMA_USE_APPEARANCE
551 if ( UMAHasAppearance() )
553 ::DeactivateControl( inControl
) ;
559 AGADeactivateControl( inControl
) ;
565 InvalRgn( updateRgn
) ;
568 void UMASetThemeWindowBackground (WindowRef inWindow
,
572 #if UMA_USE_APPEARANCE
573 if ( UMAHasAppearance() )
575 ::SetThemeWindowBackground( inWindow
,inBrush
, inUpdate
) ;
581 AGASetThemeWindowBackground( inWindow
, inBrush
, inUpdate
) ;
589 void UMAApplyThemeBackground (ThemeBackgroundKind inKind
,
591 ThemeDrawState inState
,
595 #if UMA_USE_APPEARANCE
596 if ( UMAHasAppearance() )
599 if ( sUMAAppearanceVersion >= 0x0110 )
600 ::ApplyThemeBackground( inKind ,bounds , inState , inDepth , inColorDev ) ;
607 AGAApplyThemeBackground( inKind
,bounds
, inState
, inDepth
, inColorDev
) ;
615 ControlHandle
UMANewControl(WindowPtr owningWindow
,
616 const Rect
* boundsRect
,
617 ConstStr255Param controlTitle
,
618 Boolean initiallyVisible
,
623 SInt32 controlReference
)
625 ControlHandle theControl
= NULL
;
626 #if UMA_USE_APPEARANCE
627 if ( UMAHasAppearance() )
629 theControl
= NewControl( owningWindow
, boundsRect
, controlTitle
, initiallyVisible
,
630 initialValue
, minimumValue
, maximumValue
, procID
, controlReference
) ;
636 theControl
= AGANewControl( owningWindow
, boundsRect
, controlTitle
, initiallyVisible
,
637 initialValue
, minimumValue
, maximumValue
, procID
, controlReference
) ;
646 void UMADisposeControl (ControlHandle theControl
)
648 if ( UMAHasAppearance() )
650 ::DisposeControl( theControl
) ;
654 ::DisposeControl( theControl
) ;
659 void UMAHiliteControl (ControlHandle theControl
,
660 ControlPartCode hiliteState
)
662 RgnHandle updateRgn
= NewRgn() ;
663 GetWindowUpdateRgn( GetControlOwner(theControl
) , updateRgn
) ;
664 if ( UMAHasAppearance() )
666 ::HiliteControl( theControl
, hiliteState
) ;
670 ::HiliteControl( theControl
, hiliteState
) ;
672 InvalRgn( updateRgn
) ;
676 void UMAShowControl (ControlHandle theControl
)
678 RgnHandle updateRgn
= NewRgn() ;
679 GetWindowUpdateRgn( GetControlOwner(theControl
) , updateRgn
) ;
680 if ( UMAHasAppearance() )
682 ::ShowControl( theControl
) ;
686 ::ShowControl( theControl
) ;
688 InvalRgn( updateRgn
) ;
692 void UMAHideControl (ControlHandle theControl
)
694 if ( UMAHasAppearance() )
696 ::HideControl( theControl
) ;
700 ::HideControl( theControl
) ;
705 void UMASetControlVisibility (ControlHandle inControl
,
709 if ( UMAHasAppearance() )
711 #if UMA_USE_APPEARANCE
712 ::SetControlVisibility( inControl
, inIsVisible
, inDoDraw
) ;
719 bool UMAIsControlActive (ControlHandle inControl
)
722 return IsControlActive( inControl
) ;
724 #if UMA_USE_APPEARANCE
725 if ( UMAHasAppearance() )
727 return IsControlActive( inControl
) ;
731 return (**inControl
).contrlHilite
== 0 ;
736 bool UMAIsControlVisible (ControlHandle inControl
)
738 #if UMA_USE_APPEARANCE
739 if ( UMAHasAppearance() )
741 return IsControlVisible( inControl
) ;
747 OSErr
UMAGetBestControlRect (ControlHandle inControl
,
749 SInt16
* outBaseLineOffset
)
751 #if UMA_USE_APPEARANCE
752 if ( UMAHasAppearance() )
754 return GetBestControlRect( inControl
, outRect
, outBaseLineOffset
) ;
760 return AGAGetBestControlRect( inControl
, outRect
, outBaseLineOffset
) ;
770 OSErr
UMASetControlFontStyle (ControlHandle inControl
,
771 const ControlFontStyleRec
* inStyle
)
773 #if UMA_USE_APPEARANCE
774 if ( UMAHasAppearance() )
776 return ::SetControlFontStyle( inControl
, inStyle
) ;
781 return AGASetControlFontStyle( inControl
, inStyle
) ;
793 OSErr
UMACreateRootControl (WindowPtr inWindow
,
794 ControlHandle
* outControl
)
796 #if UMA_USE_APPEARANCE
797 if ( UMAHasAppearance() )
799 return CreateRootControl( inWindow
, outControl
) ;
804 return AGACreateRootControl( inWindow
, outControl
) ;
814 OSErr
UMAEmbedControl (ControlHandle inControl
,
815 ControlHandle inContainer
)
817 #if UMA_USE_APPEARANCE
818 if ( UMAHasAppearance() )
820 return EmbedControl( inControl
, inContainer
) ;
825 return AGAEmbedControl( inControl
, inContainer
) ; ;
836 OSErr
UMASetKeyboardFocus (WindowPtr inWindow
,
837 ControlHandle inControl
,
838 ControlFocusPart inPart
)
844 SetPort( GetWindowPort( inWindow
) ) ;
846 SetPort( inWindow
) ;
849 #if UMA_USE_APPEARANCE
850 if ( UMAHasAppearance() )
852 err
= SetKeyboardFocus( inWindow
, inControl
, inPart
) ;
857 err
= AGASetKeyboardFocus( inWindow
, inControl
, inPart
) ;
871 ControlPartCode
UMAHandleControlClick (ControlHandle inControl
,
874 ControlActionUPP inAction
)
876 #if UMA_USE_APPEARANCE
877 if ( UMAHasAppearance() )
879 return HandleControlClick( inControl
, inWhere
, inModifiers
, inAction
) ;
885 return AGAHandleControlClick( inControl
, inWhere
, inModifiers
, inAction
) ;
895 SInt16
UMAHandleControlKey (ControlHandle inControl
,
900 #if UMA_USE_APPEARANCE
901 if ( UMAHasAppearance() )
903 return HandleControlKey( inControl
, inKeyCode
, inCharCode
, inModifiers
) ;
909 return AGAHandleControlKey(inControl
, inKeyCode
, inCharCode
, inModifiers
) ;
920 void UMAIdleControls (WindowPtr inWindow
)
922 #if UMA_USE_APPEARANCE
923 if ( UMAHasAppearance() )
925 IdleControls( inWindow
) ;
931 AGAIdleControls( inWindow
) ;
939 void UMAUpdateControls( WindowPtr inWindow
, RgnHandle inRgn
)
941 RgnHandle updateRgn
= NewRgn() ;
942 GetWindowUpdateRgn( inWindow
, updateRgn
) ;
943 #if UMA_USE_APPEARANCE
944 if ( UMAHasAppearance() )
946 UpdateControls( inWindow
, inRgn
) ;
952 AGAUpdateControls( inWindow
, inRgn
) ;
958 InvalRgn( updateRgn
) ;
961 OSErr
UMAGetRootControl( WindowPtr inWindow
, ControlHandle
*outControl
)
963 #if UMA_USE_APPEARANCE
964 if ( UMAHasAppearance() )
966 return GetRootControl( inWindow
, outControl
) ;
972 return AGAGetRootControl( inWindow
, outControl
) ;
982 // handling control data
984 OSErr
UMASetControlData (ControlHandle inControl
,
985 ControlPartCode inPart
,
990 #if UMA_USE_APPEARANCE
991 if ( UMAHasAppearance() )
993 return SetControlData( inControl
, inPart
, inTagName
, inSize
, inData
) ;
998 return AGASetControlData( inControl
, inPart
, inTagName
, inSize
, inData
) ;
1008 OSErr
UMAGetControlData (ControlHandle inControl
,
1009 ControlPartCode inPart
,
1013 Size
* outActualSize
)
1015 #if UMA_USE_APPEARANCE
1016 if ( UMAHasAppearance() )
1018 return ::GetControlData( inControl
, inPart
, inTagName
, inBufferSize
, outBuffer
, outActualSize
) ;
1024 return AGAGetControlData( inControl
, inPart
, inTagName
, inBufferSize
, outBuffer
, outActualSize
) ;
1034 OSErr
UMAGetControlDataSize (ControlHandle inControl
,
1035 ControlPartCode inPart
,
1039 #if UMA_USE_APPEARANCE
1040 if ( UMAHasAppearance() )
1042 return GetControlDataSize( inControl
, inPart
, inTagName
, outMaxSize
) ;
1048 return AGAGetControlDataSize( inControl
, inPart
, inTagName
, outMaxSize
) ;
1061 // system 8.0 changes
1063 short UMAFindWindow( Point inPoint
, WindowRef
*outWindow
)
1065 // todo add the additional area codes
1066 return FindWindow( inPoint
, outWindow
) ;
1069 OSStatus
UMAGetWindowFeatures( WindowRef inWindowRef
, UInt32
*outFeatures
)
1071 #if UMA_USE_WINDOWMGR
1072 return GetWindowFeatures( inWindowRef
, outFeatures
) ;
1078 OSStatus
UMAGetWindowRegion( WindowRef inWindowRef
, WindowRegionCode inRegionCode
, RgnHandle ioWinRgn
)
1080 #if UMA_USE_WINDOWMGR
1081 return GetWindowRegion( inWindowRef
, inRegionCode
, ioWinRgn
) ;
1087 void UMADrawGrowIcon( WindowRef inWindowRef
)
1089 DrawGrowIcon( inWindowRef
) ;
1092 OSStatus
UMACollapseWindow( WindowRef inWindowRef
, Boolean inCollapseIt
)
1094 return CollapseWindow( inWindowRef
, inCollapseIt
) ;
1097 OSStatus
UMACollapseAllWindows( Boolean inCollapseEm
)
1099 return CollapseAllWindows( inCollapseEm
) ;
1102 Boolean
UMAIsWindowCollapsed( WindowRef inWindowRef
)
1104 return IsWindowCollapsed( inWindowRef
) ;
1107 Boolean
UMAIsWindowCollapsable( WindowRef inWindowRef
)
1109 return IsWindowCollapsable( inWindowRef
) ;
1112 // system 8.5 changes<MacWindows.h>
1113 OSStatus
UMACreateNewWindow( WindowClass windowClass
, WindowAttributes attributes
, const Rect
*bounds
, WindowRef
*outWindow
)
1115 #if UMA_USE_WINDOWMGR
1116 if ( UMAHasWindowManager() )
1118 return CreateNewWindow( windowClass
, attributes
, bounds
, outWindow
) ;
1124 if ( UMAHasAppearance() )
1126 switch( windowClass
)
1128 case kMovableModalWindowClass
:
1129 procID
= kWindowMovableModalDialogProc
;
1131 case kModalWindowClass
:
1132 procID
= kWindowShadowDialogProc
;
1134 case kFloatingWindowClass
:
1135 if ( attributes
& kWindowSideTitlebarAttribute
)
1137 if( ( attributes
& kWindowResizableAttribute
) &&
1138 ( attributes
& kWindowFullZoomAttribute
) )
1140 procID
= kWindowFloatSideFullZoomGrowProc
;
1142 else if( attributes
& kWindowFullZoomAttribute
)
1144 procID
= kWindowFloatSideFullZoomProc
;
1146 else if ( attributes
& kWindowResizableAttribute
)
1148 procID
= kWindowFloatSideGrowProc
;
1152 procID
= kWindowFloatSideProc
;
1157 if( ( attributes
& kWindowResizableAttribute
) &&
1158 ( attributes
& kWindowFullZoomAttribute
) )
1160 procID
= kWindowFloatFullZoomGrowProc
;
1162 else if( attributes
& kWindowFullZoomAttribute
)
1164 procID
= kWindowFloatFullZoomProc
;
1166 else if ( attributes
& kWindowResizableAttribute
)
1168 procID
= kWindowFloatGrowProc
;
1172 procID
= kWindowFloatProc
;
1176 case kDocumentWindowClass
:
1178 if( ( attributes
& kWindowResizableAttribute
) &&
1179 ( attributes
& kWindowFullZoomAttribute
) )
1181 procID
= kWindowFullZoomGrowDocumentProc
;
1183 else if( attributes
& kWindowFullZoomAttribute
)
1185 procID
= kWindowFullZoomDocumentProc
;
1187 else if ( attributes
& kWindowResizableAttribute
)
1189 procID
= kWindowGrowDocumentProc
;
1193 procID
= kWindowDocumentProc
;
1200 switch( windowClass
)
1202 case kMovableModalWindowClass
:
1203 procID
= movableDBoxProc
;
1205 case kModalWindowClass
:
1206 procID
= altDBoxProc
;
1208 case kFloatingWindowClass
:
1209 if ( attributes
& kWindowSideTitlebarAttribute
)
1211 if( ( attributes
& kWindowResizableAttribute
) &&
1212 ( attributes
& kWindowFullZoomAttribute
) )
1214 procID
= floatSideZoomGrowProc
;
1216 else if( attributes
& kWindowFullZoomAttribute
)
1218 procID
= floatSideZoomProc
;
1220 else if ( attributes
& kWindowResizableAttribute
)
1222 procID
= floatSideGrowProc
;
1226 procID
= floatSideProc
;
1231 if( ( attributes
& kWindowResizableAttribute
) &&
1232 ( attributes
& kWindowFullZoomAttribute
) )
1234 procID
= floatZoomGrowProc
;
1236 else if( attributes
& kWindowFullZoomAttribute
)
1238 procID
= floatZoomProc
;
1240 else if ( attributes
& kWindowResizableAttribute
)
1242 procID
= floatGrowProc
;
1250 case kDocumentWindowClass
:
1252 if( ( attributes
& kWindowResizableAttribute
) &&
1253 ( attributes
& kWindowFullZoomAttribute
) )
1255 procID
= zoomDocProc
;
1257 else if( attributes
& kWindowFullZoomAttribute
)
1259 procID
= zoomNoGrow
;
1261 else if ( attributes
& kWindowResizableAttribute
)
1263 procID
= documentProc
;
1267 procID
= noGrowDocProc
;
1273 *outWindow
= NewCWindow(nil
, bounds
, "\p", false, procID
, (WindowRef
) -1 /*behind*/,
1274 attributes
& kWindowCloseBoxAttribute
, (long)NULL
);
1279 OSStatus
UMAGetWindowClass( WindowRef inWindowRef
, WindowClass
*outWindowClass
)
1281 #if UMA_USE_WINDOWMGR
1282 if ( UMAHasWindowManager() )
1284 return GetWindowClass( inWindowRef
, outWindowClass
) ;
1288 return kDocumentWindowClass
;
1291 OSStatus
UMAGetWindowAttributes( WindowRef inWindowRef
, WindowAttributes
*outAttributes
)
1293 #if UMA_USE_WINDOWMGR
1294 if ( UMAHasWindowManager() )
1296 return GetWindowAttributes( inWindowRef
, outAttributes
) ;
1299 return kWindowNoAttributes
;
1302 void UMAShowFloatingWindows()
1304 #if UMA_USE_WINDOWMGR
1305 if ( UMAHasWindowManager() )
1307 ShowFloatingWindows() ;
1312 void UMAHideFloatingWindows()
1314 #if UMA_USE_WINDOWMGR
1315 if ( UMAHasWindowManager() )
1317 HideFloatingWindows() ;
1322 Boolean
UMAAreFloatingWindowsVisible()
1324 #if UMA_USE_WINDOWMGR
1325 if ( UMAHasWindowManager() )
1327 return AreFloatingWindowsVisible() ;
1333 WindowRef
UMAFrontNonFloatingWindow()
1335 #if UMA_USE_WINDOWMGR
1336 if ( UMAHasWindowManager() )
1338 return FrontNonFloatingWindow() ;
1343 return FrontWindow() ;
1347 WindowRef
UMAFrontWindow()
1349 #if UMA_USE_WINDOWMGR
1350 if ( UMAHasWindowManager() )
1352 return FrontWindow() ;
1357 return FrontWindow() ;
1361 WindowRef
UMAGetActiveNonFloatingWindow()
1366 bool UMAIsWindowFloating( WindowRef inWindow
)
1370 UMAGetWindowClass( inWindow
, &cl
) ;
1371 return cl
== kFloatingWindowClass
;
1374 bool UMAIsWindowModal( WindowRef inWindow
)
1378 UMAGetWindowClass( inWindow
, &cl
) ;
1379 return cl
< kFloatingWindowClass
;
1384 void UMAHighlightAndActivateWindow( WindowRef inWindowRef
, bool inActivate
)
1388 // bool isHighlighted = IsWindowHighlited( inWindowRef ) ;
1389 // if ( inActivate != isHightlited )
1393 SetPort( GetWindowPort( inWindowRef
) ) ;
1395 SetPort( inWindowRef
) ;
1397 SetOrigin( 0 , 0 ) ;
1398 HiliteWindow( inWindowRef
, inActivate
) ;
1399 ControlHandle control
= NULL
;
1400 UMAGetRootControl( inWindowRef
, & control
) ;
1404 UMAActivateControl( control
) ;
1406 UMADeactivateControl( control
) ;
1411 OSStatus
UMADrawThemePlacard( const Rect
*inRect
, ThemeDrawState inState
)
1413 #if UMA_USE_APPEARANCE
1414 if ( UMAHasAppearance() )
1416 ::DrawThemePlacard( inRect
, inState
) ;