1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Universal MacOS API
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 // define this to be 1 if you have the 8.6 libs (weak linked)
19 #if defined(__POWERPC__) || defined(__MACH__)
20 #define UMA_USE_APPEARANCE 1
21 #define UMA_USE_WINDOWMGR 1
23 #define UMA_USE_APPEARANCE 0
24 #define UMA_USE_WINDOWMGR 0
27 #if !UMA_USE_8_6 && UMA_USE_WINDOWMGR
28 #undef UMA_USE_WINDOWMGR
29 #define UMA_USE_WINDOWMGR 0
33 // this is now defined in the latest headers
34 // typedef short MenuItemIndex ;
37 void UMAInitToolbox( UInt16 inMoreMastersCalls
) ;
38 bool UMAHasAppearance() ;
39 long UMAGetAppearanceVersion() ;
43 long UMAGetProcessMode() ;
44 bool UMAGetProcessModeDoesActivateOnFGSwitch() ;
48 void UMASetMenuTitle( MenuRef menu
, StringPtr title
) ;
49 UInt32
UMAMenuEvent( EventRecord
*inEvent
) ;
50 void UMAEnableMenuItem( MenuRef inMenu
, MenuItemIndex item
) ;
51 void UMADisableMenuItem( MenuRef inMenu
, MenuItemIndex item
) ;
52 void UMAAppendSubMenuItem( MenuRef menu
, StringPtr label
, SInt16 submenuid
) ;
53 void UMAInsertSubMenuItem( MenuRef menu
, StringPtr label
, MenuItemIndex item
, SInt16 submenuid
) ;
54 void UMAAppendMenuItem( MenuRef menu
, StringPtr label
, SInt16 key
= 0, UInt8 modifiers
= 0 ) ;
55 void UMAInsertMenuItem( MenuRef menu
, StringPtr label
, MenuItemIndex item
, SInt16 key
= 0 , UInt8 modifiers
= 0 ) ;
56 void UMASetMenuItemText( MenuRef menu
, MenuItemIndex item
, StringPtr label
) ;
58 MenuRef
UMANewMenu( SInt16 menuid
, StringPtr label
) ;
59 void UMADisposeMenu( MenuRef menu
) ;
61 // handling the menubar
63 void UMADeleteMenu( SInt16 menuId
) ;
64 void UMAInsertMenu( MenuRef insertMenu
, SInt16 afterId
) ;
65 void UMADrawMenuBar() ;
69 void UMAShowWatchCursor() ;
70 void UMAShowArrowCursor() ;
77 GrafPtr
UMAGetWindowPort( WindowRef inWindowRef
) ;
78 void UMADisposeWindow( WindowRef inWindowRef
) ;
79 void UMASetWTitleC( WindowRef inWindowRef
, const char *title
) ;
80 void UMAGetWTitleC( WindowRef inWindowRef
, char *title
) ;
82 void UMADrawGrowIcon( WindowRef inWindowRef
) ;
83 void UMAShowWindow( WindowRef inWindowRef
) ;
84 void UMAHideWindow( WindowRef inWindowRef
) ;
85 void UMAShowHide( WindowRef inWindowRef
, Boolean show
) ;
86 void UMASelectWindow( WindowRef inWindowRef
) ;
87 void UMABringToFront( WindowRef inWindowRef
) ;
88 void UMASendBehind( WindowRef inWindowRef
, WindowRef behindWindow
) ;
89 void UMACloseWindow(WindowRef inWindowRef
) ;
93 void UMADrawControl( ControlHandle inControl
) ;
95 void UMAActivateControl( ControlHandle inControl
) ;
96 void UMADeactivateControl( ControlHandle inControl
) ;
97 void UMAApplyThemeBackground (ThemeBackgroundKind inKind
,
99 ThemeDrawState inState
,
102 void UMASetThemeWindowBackground (WindowRef inWindow
,
105 ControlHandle
UMANewControl(WindowPtr owningWindow
,
106 const Rect
* boundsRect
,
107 ConstStr255Param controlTitle
,
108 Boolean initiallyVisible
,
113 SInt32 controlReference
) ;
114 void UMADisposeControl (ControlHandle theControl
) ;
115 void UMAHiliteControl (ControlHandle theControl
,
116 ControlPartCode hiliteState
) ;
117 void UMAShowControl (ControlHandle theControl
) ;
118 void UMAHideControl (ControlHandle theControl
);
119 void UMASetControlVisibility (ControlHandle inControl
,
123 bool UMAIsControlActive (ControlHandle inControl
);
124 bool UMAIsControlVisible (ControlHandle inControl
);
125 void UMAActivateControl (ControlHandle inControl
);
126 void UMADeactivateControl (ControlHandle inControl
);
128 OSErr
UMAGetBestControlRect (ControlHandle inControl
,
130 SInt16
* outBaseLineOffset
);
131 OSErr
UMASetControlFontStyle (ControlHandle inControl
,
132 const ControlFontStyleRec
* inStyle
) ;
135 void UMAMoveControl( ControlHandle inControl
, short x
, short y
) ;
136 void UMASizeControl( ControlHandle inControl
, short x
, short y
) ;
139 OSErr
UMACreateRootControl (WindowPtr inWindow
,
140 ControlHandle
* outControl
) ;
142 OSErr
UMAEmbedControl (ControlHandle inControl
,
143 ControlHandle inContainer
);
146 OSErr
UMASetKeyboardFocus (WindowPtr inWindow
,
147 ControlHandle inControl
,
148 ControlFocusPart inPart
) ;
153 ControlPartCode
UMAHandleControlClick (ControlHandle inControl
,
156 ControlActionUPP inAction
) ;
157 SInt16
UMAHandleControlKey (ControlHandle inControl
,
162 void UMAIdleControls (WindowPtr inWindow
) ;
164 void UMAUpdateControls( WindowPtr inWindow
, RgnHandle inRgn
) ;
165 OSErr
UMAGetRootControl( WindowPtr inWindow
, ControlHandle
*outControl
) ;
167 // handling control data
169 OSErr
UMASetControlData (ControlHandle inControl
,
170 ControlPartCode inPart
,
175 OSErr
UMAGetControlData (ControlHandle inControl
,
176 ControlPartCode inPart
,
180 Size
* outActualSize
) ;
181 OSErr
UMAGetControlDataSize (ControlHandle inControl
,
182 ControlPartCode inPart
,
189 short UMAFindWindow( Point inPoint
, WindowRef
*outWindow
) ;
190 OSStatus
UMAGetWindowFeatures( WindowRef inWindowRef
, UInt32
*outFeatures
) ;
191 OSStatus
UMAGetWindowRegion( WindowRef inWindowRef
, WindowRegionCode inRegionCode
, RgnHandle ioWinRgn
) ;
192 OSStatus
UMACollapseWindow( WindowRef inWindowRef
, Boolean inCollapseIt
) ;
193 OSStatus
UMACollapseAllWindows( Boolean inCollapseEm
) ;
194 Boolean
UMAIsWindowCollapsed( WindowRef inWindowRef
) ;
195 Boolean
UMAIsWindowCollapsable( WindowRef inWindowRef
) ;
199 OSStatus
UMACreateNewWindow( WindowClass windowClass
, WindowAttributes attributes
, const Rect
*bounds
, WindowRef
*outWindow
) ;
200 OSStatus
UMAGetWindowClass( WindowRef inWindowRef
, WindowClass
*outWindowClass
) ;
201 OSStatus
UMAGetWindowAttributes( WindowRef inWindowRef
, WindowAttributes
*outAttributes
) ;
203 void UMAShowFloatingWindows() ;
204 void UMAHideFloatingWindows() ;
205 Boolean
UMAAreFloatingWindowsVisible() ;
206 WindowRef
UMAFrontWindow() ;
207 WindowRef
UMAFrontNonFloatingWindow() ;
211 bool UMAIsWindowFloating( WindowRef inWindow
) ;
212 bool UMAIsWindowModal( WindowRef inWindow
) ;
213 WindowRef
UMAGetActiveWindow() ;
214 WindowRef
UMAGetActiveNonFloatingWindow() ;
216 void UMAHighlightAndActivateWindow( WindowRef inWindowRef
, bool inActivate
) ;
219 #define GetPortTextFont( p) ((p)->txFont )
220 #define GetPortTextSize( p) ((p)->txSize )
221 #define GetPortTextFace( p) ((p)->txFace )
222 #define GetPortTextMode( p) ((p)->txMode )
223 #define GetRegionBounds( r , b) ((*b) = (**r).rgnBBox)
224 #define GetPortBounds( p , b) ((*b) = p->portRect )
225 #define GetWindowPortBounds( p , b) ((*b) = p->portRect )
226 #define GetPortVisibleRegion( p, r ) CopyRgn( p->visRgn , r )
227 #define GetQDGlobalsWhite( a ) (&((*a) = qd.white))
228 #define GetQDGlobalsBlack( a ) (&((*a) = qd.black))
229 #define GetQDGlobalsScreenBits( a ) (*a) = qd.screenBits
230 #define GetQDGlobalsArrow( a ) (&((*a) = qd.arrow))
231 #define GetControlBounds( c , b ) ((*b) = (**c).contrlRect )
232 #define GetPortBitMapForCopyBits( p ) ((BitMap*) &(((CGrafPtr)p)->portPixMap ))
235 // Appearance Drawing
237 OSStatus
UMADrawThemePlacard( const Rect
*inRect
, ThemeDrawState inState
) ;