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)
24 #if defined(__POWERPC__) || defined(__MACH__)
25 #define UMA_USE_APPEARANCE 1
26 #define UMA_USE_WINDOWMGR 1
28 #define UMA_USE_APPEARANCE 0
29 #define UMA_USE_WINDOWMGR 0
32 #if !UMA_USE_8_6 && UMA_USE_WINDOWMGR
33 #undef UMA_USE_WINDOWMGR
34 #define UMA_USE_WINDOWMGR 0
38 // this is now defined in the latest headers
39 // typedef short MenuItemIndex ;
42 void UMAInitToolbox( UInt16 inMoreMastersCalls
) ;
43 void UMACleanupToolbox() ;
44 bool UMAHasAppearance() ;
45 long UMAGetAppearanceVersion() ;
49 long UMAGetProcessMode() ;
50 bool UMAGetProcessModeDoesActivateOnFGSwitch() ;
54 void UMASetMenuTitle( MenuRef menu
, StringPtr title
) ;
55 UInt32
UMAMenuEvent( EventRecord
*inEvent
) ;
56 void UMAEnableMenuItem( MenuRef inMenu
, MenuItemIndex item
) ;
57 void UMADisableMenuItem( MenuRef inMenu
, MenuItemIndex item
) ;
58 void UMAAppendSubMenuItem( MenuRef menu
, StringPtr label
, SInt16 submenuid
) ;
59 void UMAInsertSubMenuItem( MenuRef menu
, StringPtr label
, MenuItemIndex item
, SInt16 submenuid
) ;
60 void UMAAppendMenuItem( MenuRef menu
, StringPtr label
, SInt16 key
= 0, UInt8 modifiers
= 0 ) ;
61 void UMAInsertMenuItem( MenuRef menu
, StringPtr label
, MenuItemIndex item
, SInt16 key
= 0 , UInt8 modifiers
= 0 ) ;
62 void UMASetMenuItemText( MenuRef menu
, MenuItemIndex item
, StringPtr label
) ;
64 MenuRef
UMANewMenu( SInt16 menuid
, StringPtr label
) ;
65 void UMADisposeMenu( MenuRef menu
) ;
67 // handling the menubar
69 void UMADeleteMenu( SInt16 menuId
) ;
70 void UMAInsertMenu( MenuRef insertMenu
, SInt16 afterId
) ;
71 void UMADrawMenuBar() ;
75 void UMAShowWatchCursor() ;
76 void UMAShowArrowCursor() ;
78 OSStatus
UMAPrOpen() ;
79 OSStatus
UMAPrClose() ;
83 GrafPtr
UMAGetWindowPort( WindowRef inWindowRef
) ;
84 void UMADisposeWindow( WindowRef inWindowRef
) ;
85 void UMASetWTitleC( WindowRef inWindowRef
, const char *title
) ;
86 void UMAGetWTitleC( WindowRef inWindowRef
, char *title
) ;
88 void UMADrawGrowIcon( WindowRef inWindowRef
) ;
89 void UMAShowWindow( WindowRef inWindowRef
) ;
90 void UMAHideWindow( WindowRef inWindowRef
) ;
91 void UMAShowHide( WindowRef inWindowRef
, Boolean show
) ;
92 void UMASelectWindow( WindowRef inWindowRef
) ;
93 void UMABringToFront( WindowRef inWindowRef
) ;
94 void UMASendBehind( WindowRef inWindowRef
, WindowRef behindWindow
) ;
95 void UMACloseWindow(WindowRef inWindowRef
) ;
99 void UMADrawControl( ControlHandle inControl
) ;
101 void UMAActivateControl( ControlHandle inControl
) ;
102 void UMADeactivateControl( ControlHandle inControl
) ;
103 void UMAApplyThemeBackground (ThemeBackgroundKind inKind
,
105 ThemeDrawState inState
,
108 void UMASetThemeWindowBackground (WindowRef inWindow
,
111 ControlHandle
UMANewControl(WindowPtr owningWindow
,
112 const Rect
* boundsRect
,
113 ConstStr255Param controlTitle
,
114 Boolean initiallyVisible
,
119 SInt32 controlReference
) ;
120 void UMADisposeControl (ControlHandle theControl
) ;
121 void UMAHiliteControl (ControlHandle theControl
,
122 ControlPartCode hiliteState
) ;
123 void UMAShowControl (ControlHandle theControl
) ;
124 void UMAHideControl (ControlHandle theControl
);
125 void UMASetControlVisibility (ControlHandle inControl
,
129 bool UMAIsControlActive (ControlHandle inControl
);
130 bool UMAIsControlVisible (ControlHandle inControl
);
131 void UMAActivateControl (ControlHandle inControl
);
132 void UMADeactivateControl (ControlHandle inControl
);
134 OSErr
UMAGetBestControlRect (ControlHandle inControl
,
136 SInt16
* outBaseLineOffset
);
137 OSErr
UMASetControlFontStyle (ControlHandle inControl
,
138 const ControlFontStyleRec
* inStyle
) ;
141 void UMAMoveControl( ControlHandle inControl
, short x
, short y
) ;
142 void UMASizeControl( ControlHandle inControl
, short x
, short y
) ;
145 OSErr
UMACreateRootControl (WindowPtr inWindow
,
146 ControlHandle
* outControl
) ;
148 OSErr
UMAEmbedControl (ControlHandle inControl
,
149 ControlHandle inContainer
);
152 OSErr
UMASetKeyboardFocus (WindowPtr inWindow
,
153 ControlHandle inControl
,
154 ControlFocusPart inPart
) ;
159 ControlPartCode
UMAHandleControlClick (ControlHandle inControl
,
162 ControlActionUPP inAction
) ;
163 SInt16
UMAHandleControlKey (ControlHandle inControl
,
168 void UMAIdleControls (WindowPtr inWindow
) ;
170 void UMAUpdateControls( WindowPtr inWindow
, RgnHandle inRgn
) ;
171 OSErr
UMAGetRootControl( WindowPtr inWindow
, ControlHandle
*outControl
) ;
173 // handling control data
175 OSErr
UMASetControlData (ControlHandle inControl
,
176 ControlPartCode inPart
,
181 OSErr
UMAGetControlData (ControlHandle inControl
,
182 ControlPartCode inPart
,
186 Size
* outActualSize
) ;
187 OSErr
UMAGetControlDataSize (ControlHandle inControl
,
188 ControlPartCode inPart
,
195 short UMAFindWindow( Point inPoint
, WindowRef
*outWindow
) ;
196 OSStatus
UMAGetWindowFeatures( WindowRef inWindowRef
, UInt32
*outFeatures
) ;
197 OSStatus
UMAGetWindowRegion( WindowRef inWindowRef
, WindowRegionCode inRegionCode
, RgnHandle ioWinRgn
) ;
198 OSStatus
UMACollapseWindow( WindowRef inWindowRef
, Boolean inCollapseIt
) ;
199 OSStatus
UMACollapseAllWindows( Boolean inCollapseEm
) ;
200 Boolean
UMAIsWindowCollapsed( WindowRef inWindowRef
) ;
201 Boolean
UMAIsWindowCollapsable( WindowRef inWindowRef
) ;
205 OSStatus
UMACreateNewWindow( WindowClass windowClass
, WindowAttributes attributes
, const Rect
*bounds
, WindowRef
*outWindow
) ;
206 OSStatus
UMAGetWindowClass( WindowRef inWindowRef
, WindowClass
*outWindowClass
) ;
207 OSStatus
UMAGetWindowAttributes( WindowRef inWindowRef
, WindowAttributes
*outAttributes
) ;
209 void UMAShowFloatingWindows() ;
210 void UMAHideFloatingWindows() ;
211 Boolean
UMAAreFloatingWindowsVisible() ;
212 WindowRef
UMAFrontWindow() ;
213 WindowRef
UMAFrontNonFloatingWindow() ;
217 bool UMAIsWindowFloating( WindowRef inWindow
) ;
218 bool UMAIsWindowModal( WindowRef inWindow
) ;
219 WindowRef
UMAGetActiveWindow() ;
220 WindowRef
UMAGetActiveNonFloatingWindow() ;
222 void UMAHighlightAndActivateWindow( WindowRef inWindowRef
, bool inActivate
) ;
225 #define GetPortTextFont( p) ((p)->txFont )
226 #define GetPortTextSize( p) ((p)->txSize )
227 #define GetPortTextFace( p) ((p)->txFace )
228 #define GetPortTextMode( p) ((p)->txMode )
229 #define GetRegionBounds( r , b) ((*b) = (**r).rgnBBox)
230 #define GetPortBounds( p , b) ((*b) = p->portRect )
231 #define GetWindowPortBounds( p , b) ((*b) = p->portRect )
232 #define GetPortVisibleRegion( p, r ) CopyRgn( p->visRgn , r )
233 #define GetQDGlobalsWhite( a ) (&((*a) = qd.white))
234 #define GetQDGlobalsBlack( a ) (&((*a) = qd.black))
235 #define GetQDGlobalsScreenBits( a ) (*a) = qd.screenBits
236 #define GetQDGlobalsArrow( a ) (&((*a) = qd.arrow))
237 #define GetControlBounds( c , b ) ((*b) = (**c).contrlRect )
238 #define GetPortBitMapForCopyBits( p ) ((BitMap*) &(((CGrafPtr)p)->portPixMap ))
241 // Appearance Drawing
243 OSStatus
UMADrawThemePlacard( const Rect
*inRect
, ThemeDrawState inState
) ;