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(__APPLE__)
25 #define UMA_USE_APPEARANCE 1
26 #define UMA_USE_WINDOWMGR 1
27 #if defined(__APPLE__)
28 #include <Carbon/Carbon.h>
31 #define UMA_USE_APPEARANCE 1
32 #define UMA_USE_WINDOWMGR 0
35 #if UMA_USE_APPEARANCE == 0
36 #pragma error "wxMac needs appearance"
39 #if !UMA_USE_8_6 && UMA_USE_WINDOWMGR
40 #undef UMA_USE_WINDOWMGR
41 #define UMA_USE_WINDOWMGR 0
45 // this is now defined in the latest headers
46 // typedef short MenuItemIndex ;
49 void UMAInitToolbox( UInt16 inMoreMastersCalls
) ;
50 void UMACleanupToolbox() ;
51 bool UMAHasAppearance() ;
52 long UMAGetAppearanceVersion() ;
56 long UMAGetProcessMode() ;
57 bool UMAGetProcessModeDoesActivateOnFGSwitch() ;
61 void UMASetMenuTitle( MenuRef menu
, StringPtr title
) ;
62 UInt32
UMAMenuEvent( EventRecord
*inEvent
) ;
63 void UMAEnableMenuItem( MenuRef inMenu
, MenuItemIndex item
) ;
64 void UMADisableMenuItem( MenuRef inMenu
, MenuItemIndex item
) ;
65 void UMAAppendSubMenuItem( MenuRef menu
, StringPtr label
, SInt16 submenuid
) ;
66 void UMAInsertSubMenuItem( MenuRef menu
, StringPtr label
, MenuItemIndex item
, SInt16 submenuid
) ;
67 void UMAAppendMenuItem( MenuRef menu
, StringPtr label
, SInt16 key
= 0, UInt8 modifiers
= 0 ) ;
68 void UMAInsertMenuItem( MenuRef menu
, StringPtr label
, MenuItemIndex item
, SInt16 key
= 0 , UInt8 modifiers
= 0 ) ;
69 void UMASetMenuItemText( MenuRef menu
, MenuItemIndex item
, StringPtr label
) ;
71 MenuRef
UMANewMenu( SInt16 menuid
, StringPtr label
) ;
72 void UMADisposeMenu( MenuRef menu
) ;
74 // handling the menubar
76 void UMADeleteMenu( SInt16 menuId
) ;
77 void UMAInsertMenu( MenuRef insertMenu
, SInt16 afterId
) ;
78 void UMADrawMenuBar() ;
82 void UMAShowWatchCursor() ;
83 void UMAShowArrowCursor() ;
85 OSStatus
UMAPrOpen() ;
86 OSStatus
UMAPrClose() ;
90 GrafPtr
UMAGetWindowPort( WindowRef inWindowRef
) ;
91 void UMADisposeWindow( WindowRef inWindowRef
) ;
92 void UMASetWTitleC( WindowRef inWindowRef
, const char *title
) ;
93 void UMAGetWTitleC( WindowRef inWindowRef
, char *title
) ;
95 void UMADrawGrowIcon( WindowRef inWindowRef
) ;
96 void UMAShowWindow( WindowRef inWindowRef
) ;
97 void UMAHideWindow( WindowRef inWindowRef
) ;
98 void UMAShowHide( WindowRef inWindowRef
, Boolean show
) ;
99 void UMASelectWindow( WindowRef inWindowRef
) ;
100 void UMABringToFront( WindowRef inWindowRef
) ;
101 void UMASendBehind( WindowRef inWindowRef
, WindowRef behindWindow
) ;
102 void UMACloseWindow(WindowRef inWindowRef
) ;
104 // appearance manager
106 void UMADrawControl( ControlHandle inControl
) ;
108 void UMAEnableControl( ControlHandle inControl
) ;
109 void UMADisableControl( ControlHandle inControl
) ;
110 void UMAActivateControl( ControlHandle inControl
) ;
111 void UMADeactivateControl( ControlHandle inControl
) ;
112 void UMAApplyThemeBackground (ThemeBackgroundKind inKind
,
114 ThemeDrawState inState
,
117 void UMASetThemeWindowBackground (WindowRef inWindow
,
120 ControlHandle
UMANewControl(WindowPtr owningWindow
,
121 const Rect
* boundsRect
,
122 ConstStr255Param controlTitle
,
123 Boolean initiallyVisible
,
128 SInt32 controlReference
) ;
129 void UMADisposeControl (ControlHandle theControl
) ;
130 void UMAHiliteControl (ControlHandle theControl
,
131 ControlPartCode hiliteState
) ;
132 void UMAShowControl (ControlHandle theControl
) ;
133 void UMAHideControl (ControlHandle theControl
);
134 void UMASetControlVisibility (ControlHandle inControl
,
138 bool UMAIsControlActive (ControlHandle inControl
);
139 bool UMAIsControlVisible (ControlHandle inControl
);
140 void UMAActivateControl (ControlHandle inControl
);
141 void UMADeactivateControl (ControlHandle inControl
);
143 OSErr
UMAGetBestControlRect (ControlHandle inControl
,
145 SInt16
* outBaseLineOffset
);
146 OSErr
UMASetControlFontStyle (ControlHandle inControl
,
147 const ControlFontStyleRec
* inStyle
) ;
150 void UMAMoveControl( ControlHandle inControl
, short x
, short y
) ;
151 void UMASizeControl( ControlHandle inControl
, short x
, short y
) ;
154 OSErr
UMACreateRootControl (WindowPtr inWindow
,
155 ControlHandle
* outControl
) ;
157 OSErr
UMAEmbedControl (ControlHandle inControl
,
158 ControlHandle inContainer
);
161 OSErr
UMASetKeyboardFocus (WindowPtr inWindow
,
162 ControlHandle inControl
,
163 ControlFocusPart inPart
) ;
168 ControlPartCode
UMAHandleControlClick (ControlHandle inControl
,
171 ControlActionUPP inAction
) ;
172 SInt16
UMAHandleControlKey (ControlHandle inControl
,
177 void UMAIdleControls (WindowPtr inWindow
) ;
179 void UMAUpdateControls( WindowPtr inWindow
, RgnHandle inRgn
) ;
180 OSErr
UMAGetRootControl( WindowPtr inWindow
, ControlHandle
*outControl
) ;
182 // handling control data
184 OSErr
UMASetControlData (ControlHandle inControl
,
185 ControlPartCode inPart
,
190 OSErr
UMAGetControlData (ControlHandle inControl
,
191 ControlPartCode inPart
,
195 Size
* outActualSize
) ;
196 OSErr
UMAGetControlDataSize (ControlHandle inControl
,
197 ControlPartCode inPart
,
204 short UMAFindWindow( Point inPoint
, WindowRef
*outWindow
) ;
205 OSStatus
UMAGetWindowFeatures( WindowRef inWindowRef
, UInt32
*outFeatures
) ;
206 OSStatus
UMAGetWindowRegion( WindowRef inWindowRef
, WindowRegionCode inRegionCode
, RgnHandle ioWinRgn
) ;
207 OSStatus
UMACollapseWindow( WindowRef inWindowRef
, Boolean inCollapseIt
) ;
208 OSStatus
UMACollapseAllWindows( Boolean inCollapseEm
) ;
209 Boolean
UMAIsWindowCollapsed( WindowRef inWindowRef
) ;
210 Boolean
UMAIsWindowCollapsable( WindowRef inWindowRef
) ;
214 OSStatus
UMACreateNewWindow( WindowClass windowClass
, WindowAttributes attributes
, const Rect
*bounds
, WindowRef
*outWindow
) ;
215 OSStatus
UMAGetWindowClass( WindowRef inWindowRef
, WindowClass
*outWindowClass
) ;
216 OSStatus
UMAGetWindowAttributes( WindowRef inWindowRef
, WindowAttributes
*outAttributes
) ;
218 void UMAShowFloatingWindows() ;
219 void UMAHideFloatingWindows() ;
220 Boolean
UMAAreFloatingWindowsVisible() ;
221 WindowRef
UMAFrontWindow() ;
222 WindowRef
UMAFrontNonFloatingWindow() ;
226 bool UMAIsWindowFloating( WindowRef inWindow
) ;
227 bool UMAIsWindowModal( WindowRef inWindow
) ;
228 WindowRef
UMAGetActiveWindow() ;
229 WindowRef
UMAGetActiveNonFloatingWindow() ;
231 void UMAHighlightAndActivateWindow( WindowRef inWindowRef
, bool inActivate
) ;
234 #define GetPortTextFont( p) ((p)->txFont )
235 #define GetPortTextSize( p) ((p)->txSize )
236 #define GetPortTextFace( p) ((p)->txFace )
237 #define GetPortTextMode( p) ((p)->txMode )
238 #define GetRegionBounds( r , b) ((*b) = (**r).rgnBBox)
239 #define GetPortBounds( p , b) ((*b) = p->portRect )
240 #define GetWindowPortBounds( p , b) ((*b) = p->portRect )
241 #define GetPortVisibleRegion( p, r ) CopyRgn( p->visRgn , r )
242 #define GetQDGlobalsWhite( a ) (&((*a) = qd.white))
243 #define GetQDGlobalsBlack( a ) (&((*a) = qd.black))
244 #define GetQDGlobalsScreenBits( a ) (*a) = qd.screenBits
245 #define GetQDGlobalsArrow( a ) (&((*a) = qd.arrow))
246 #define GetControlBounds( c , b ) &((*b) = (**c).contrlRect )
247 #define GetPortBitMapForCopyBits( p ) ((BitMap*) &(((CGrafPtr)p)->portPixMap ))
250 // Appearance Drawing
252 OSStatus
UMADrawThemePlacard( const Rect
*inRect
, ThemeDrawState inState
) ;