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 #if TARGET_CARBON && PM_USE_SESSION_APIS
86 OSStatus
UMAPrOpen(PMPrintSession
*macPrintSession
) ;
87 OSStatus
UMAPrClose(PMPrintSession
*macPrintSession
) ;
89 OSStatus
UMAPrOpen() ;
90 OSStatus
UMAPrClose() ;
95 GrafPtr
UMAGetWindowPort( WindowRef inWindowRef
) ;
96 void UMADisposeWindow( WindowRef inWindowRef
) ;
97 void UMASetWTitleC( WindowRef inWindowRef
, const char *title
) ;
98 void UMAGetWTitleC( WindowRef inWindowRef
, char *title
) ;
100 void UMADrawGrowIcon( WindowRef inWindowRef
) ;
101 void UMAShowWindow( WindowRef inWindowRef
) ;
102 void UMAHideWindow( WindowRef inWindowRef
) ;
103 void UMAShowHide( WindowRef inWindowRef
, Boolean show
) ;
104 void UMASelectWindow( WindowRef inWindowRef
) ;
105 void UMABringToFront( WindowRef inWindowRef
) ;
106 void UMASendBehind( WindowRef inWindowRef
, WindowRef behindWindow
) ;
107 void UMACloseWindow(WindowRef inWindowRef
) ;
109 // appearance manager
111 void UMADrawControl( ControlHandle inControl
) ;
113 void UMAEnableControl( ControlHandle inControl
) ;
114 void UMADisableControl( ControlHandle inControl
) ;
115 void UMAActivateControl( ControlHandle inControl
) ;
116 void UMADeactivateControl( ControlHandle inControl
) ;
117 void UMAApplyThemeBackground (ThemeBackgroundKind inKind
,
119 ThemeDrawState inState
,
122 void UMASetThemeWindowBackground (WindowRef inWindow
,
125 ControlHandle
UMANewControl(WindowPtr owningWindow
,
126 const Rect
* boundsRect
,
127 ConstStr255Param controlTitle
,
128 Boolean initiallyVisible
,
133 SInt32 controlReference
) ;
134 void UMADisposeControl (ControlHandle theControl
) ;
135 void UMAHiliteControl (ControlHandle theControl
,
136 ControlPartCode hiliteState
) ;
137 void UMAShowControl (ControlHandle theControl
) ;
138 void UMAHideControl (ControlHandle theControl
);
139 void UMASetControlVisibility (ControlHandle inControl
,
143 bool UMAIsControlActive (ControlHandle inControl
);
144 bool UMAIsControlVisible (ControlHandle inControl
);
145 void UMAActivateControl (ControlHandle inControl
);
146 void UMADeactivateControl (ControlHandle inControl
);
148 OSErr
UMAGetBestControlRect (ControlHandle inControl
,
150 SInt16
* outBaseLineOffset
);
151 OSErr
UMASetControlFontStyle (ControlHandle inControl
,
152 const ControlFontStyleRec
* inStyle
) ;
155 void UMAMoveControl( ControlHandle inControl
, short x
, short y
) ;
156 void UMASizeControl( ControlHandle inControl
, short x
, short y
) ;
159 OSErr
UMACreateRootControl (WindowPtr inWindow
,
160 ControlHandle
* outControl
) ;
162 OSErr
UMAEmbedControl (ControlHandle inControl
,
163 ControlHandle inContainer
);
166 OSErr
UMASetKeyboardFocus (WindowPtr inWindow
,
167 ControlHandle inControl
,
168 ControlFocusPart inPart
) ;
173 ControlPartCode
UMAHandleControlClick (ControlHandle inControl
,
176 ControlActionUPP inAction
) ;
177 SInt16
UMAHandleControlKey (ControlHandle inControl
,
182 void UMAIdleControls (WindowPtr inWindow
) ;
184 void UMAUpdateControls( WindowPtr inWindow
, RgnHandle inRgn
) ;
185 OSErr
UMAGetRootControl( WindowPtr inWindow
, ControlHandle
*outControl
) ;
187 // handling control data
189 OSErr
UMASetControlData (ControlHandle inControl
,
190 ControlPartCode inPart
,
195 OSErr
UMAGetControlData (ControlHandle inControl
,
196 ControlPartCode inPart
,
200 Size
* outActualSize
) ;
201 OSErr
UMAGetControlDataSize (ControlHandle inControl
,
202 ControlPartCode inPart
,
209 short UMAFindWindow( Point inPoint
, WindowRef
*outWindow
) ;
210 OSStatus
UMAGetWindowFeatures( WindowRef inWindowRef
, UInt32
*outFeatures
) ;
211 OSStatus
UMAGetWindowRegion( WindowRef inWindowRef
, WindowRegionCode inRegionCode
, RgnHandle ioWinRgn
) ;
212 OSStatus
UMACollapseWindow( WindowRef inWindowRef
, Boolean inCollapseIt
) ;
213 OSStatus
UMACollapseAllWindows( Boolean inCollapseEm
) ;
214 Boolean
UMAIsWindowCollapsed( WindowRef inWindowRef
) ;
215 Boolean
UMAIsWindowCollapsable( WindowRef inWindowRef
) ;
219 OSStatus
UMACreateNewWindow( WindowClass windowClass
, WindowAttributes attributes
, const Rect
*bounds
, WindowRef
*outWindow
) ;
220 OSStatus
UMAGetWindowClass( WindowRef inWindowRef
, WindowClass
*outWindowClass
) ;
221 OSStatus
UMAGetWindowAttributes( WindowRef inWindowRef
, WindowAttributes
*outAttributes
) ;
223 void UMAShowFloatingWindows() ;
224 void UMAHideFloatingWindows() ;
225 Boolean
UMAAreFloatingWindowsVisible() ;
226 WindowRef
UMAFrontWindow() ;
227 WindowRef
UMAFrontNonFloatingWindow() ;
231 bool UMAIsWindowFloating( WindowRef inWindow
) ;
232 bool UMAIsWindowModal( WindowRef inWindow
) ;
233 WindowRef
UMAGetActiveWindow() ;
234 WindowRef
UMAGetActiveNonFloatingWindow() ;
236 void UMAHighlightAndActivateWindow( WindowRef inWindowRef
, bool inActivate
) ;
239 #define GetPortTextFont( p) ((p)->txFont )
240 #define GetPortTextSize( p) ((p)->txSize )
241 #define GetPortTextFace( p) ((p)->txFace )
242 #define GetPortTextMode( p) ((p)->txMode )
243 #define GetRegionBounds( r , b) ((*b) = (**r).rgnBBox)
244 #define GetPortBounds( p , b) ((*b) = p->portRect )
245 #define GetWindowPortBounds( p , b) ((*b) = p->portRect )
246 #define GetPortVisibleRegion( p, r ) CopyRgn( p->visRgn , r )
247 #define GetQDGlobalsWhite( a ) (&((*a) = qd.white))
248 #define GetQDGlobalsBlack( a ) (&((*a) = qd.black))
249 #define GetQDGlobalsScreenBits( a ) (*a) = qd.screenBits
250 #define GetQDGlobalsArrow( a ) (&((*a) = qd.arrow))
251 #define GetControlBounds( c , b ) &((*b) = (**c).contrlRect )
252 #define GetPortBitMapForCopyBits( p ) ((BitMap*) &(((CGrafPtr)p)->portPixMap ))
255 // Appearance Drawing
257 OSStatus
UMADrawThemePlacard( const Rect
*inRect
, ThemeDrawState inState
) ;