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 0
32 #define UMA_USE_WINDOWMGR 0
35 #if !UMA_USE_8_6 && UMA_USE_WINDOWMGR
36 #undef UMA_USE_WINDOWMGR
37 #define UMA_USE_WINDOWMGR 0
41 // this is now defined in the latest headers
42 // typedef short MenuItemIndex ;
45 void UMAInitToolbox( UInt16 inMoreMastersCalls
) ;
46 void UMACleanupToolbox() ;
47 bool UMAHasAppearance() ;
48 long UMAGetAppearanceVersion() ;
52 long UMAGetProcessMode() ;
53 bool UMAGetProcessModeDoesActivateOnFGSwitch() ;
57 void UMASetMenuTitle( MenuRef menu
, StringPtr title
) ;
58 UInt32
UMAMenuEvent( EventRecord
*inEvent
) ;
59 void UMAEnableMenuItem( MenuRef inMenu
, MenuItemIndex item
) ;
60 void UMADisableMenuItem( MenuRef inMenu
, MenuItemIndex item
) ;
61 void UMAAppendSubMenuItem( MenuRef menu
, StringPtr label
, SInt16 submenuid
) ;
62 void UMAInsertSubMenuItem( MenuRef menu
, StringPtr label
, MenuItemIndex item
, SInt16 submenuid
) ;
63 void UMAAppendMenuItem( MenuRef menu
, StringPtr label
, SInt16 key
= 0, UInt8 modifiers
= 0 ) ;
64 void UMAInsertMenuItem( MenuRef menu
, StringPtr label
, MenuItemIndex item
, SInt16 key
= 0 , UInt8 modifiers
= 0 ) ;
65 void UMASetMenuItemText( MenuRef menu
, MenuItemIndex item
, StringPtr label
) ;
67 MenuRef
UMANewMenu( SInt16 menuid
, StringPtr label
) ;
68 void UMADisposeMenu( MenuRef menu
) ;
70 // handling the menubar
72 void UMADeleteMenu( SInt16 menuId
) ;
73 void UMAInsertMenu( MenuRef insertMenu
, SInt16 afterId
) ;
74 void UMADrawMenuBar() ;
78 void UMAShowWatchCursor() ;
79 void UMAShowArrowCursor() ;
81 OSStatus
UMAPrOpen() ;
82 OSStatus
UMAPrClose() ;
86 GrafPtr
UMAGetWindowPort( WindowRef inWindowRef
) ;
87 void UMADisposeWindow( WindowRef inWindowRef
) ;
88 void UMASetWTitleC( WindowRef inWindowRef
, const char *title
) ;
89 void UMAGetWTitleC( WindowRef inWindowRef
, char *title
) ;
91 void UMADrawGrowIcon( WindowRef inWindowRef
) ;
92 void UMAShowWindow( WindowRef inWindowRef
) ;
93 void UMAHideWindow( WindowRef inWindowRef
) ;
94 void UMAShowHide( WindowRef inWindowRef
, Boolean show
) ;
95 void UMASelectWindow( WindowRef inWindowRef
) ;
96 void UMABringToFront( WindowRef inWindowRef
) ;
97 void UMASendBehind( WindowRef inWindowRef
, WindowRef behindWindow
) ;
98 void UMACloseWindow(WindowRef inWindowRef
) ;
100 // appearance manager
102 void UMADrawControl( ControlHandle inControl
) ;
104 void UMAActivateControl( ControlHandle inControl
) ;
105 void UMADeactivateControl( ControlHandle inControl
) ;
106 void UMAApplyThemeBackground (ThemeBackgroundKind inKind
,
108 ThemeDrawState inState
,
111 void UMASetThemeWindowBackground (WindowRef inWindow
,
114 ControlHandle
UMANewControl(WindowPtr owningWindow
,
115 const Rect
* boundsRect
,
116 ConstStr255Param controlTitle
,
117 Boolean initiallyVisible
,
122 SInt32 controlReference
) ;
123 void UMADisposeControl (ControlHandle theControl
) ;
124 void UMAHiliteControl (ControlHandle theControl
,
125 ControlPartCode hiliteState
) ;
126 void UMAShowControl (ControlHandle theControl
) ;
127 void UMAHideControl (ControlHandle theControl
);
128 void UMASetControlVisibility (ControlHandle inControl
,
132 bool UMAIsControlActive (ControlHandle inControl
);
133 bool UMAIsControlVisible (ControlHandle inControl
);
134 void UMAActivateControl (ControlHandle inControl
);
135 void UMADeactivateControl (ControlHandle inControl
);
137 OSErr
UMAGetBestControlRect (ControlHandle inControl
,
139 SInt16
* outBaseLineOffset
);
140 OSErr
UMASetControlFontStyle (ControlHandle inControl
,
141 const ControlFontStyleRec
* inStyle
) ;
144 void UMAMoveControl( ControlHandle inControl
, short x
, short y
) ;
145 void UMASizeControl( ControlHandle inControl
, short x
, short y
) ;
148 OSErr
UMACreateRootControl (WindowPtr inWindow
,
149 ControlHandle
* outControl
) ;
151 OSErr
UMAEmbedControl (ControlHandle inControl
,
152 ControlHandle inContainer
);
155 OSErr
UMASetKeyboardFocus (WindowPtr inWindow
,
156 ControlHandle inControl
,
157 ControlFocusPart inPart
) ;
162 ControlPartCode
UMAHandleControlClick (ControlHandle inControl
,
165 ControlActionUPP inAction
) ;
166 SInt16
UMAHandleControlKey (ControlHandle inControl
,
171 void UMAIdleControls (WindowPtr inWindow
) ;
173 void UMAUpdateControls( WindowPtr inWindow
, RgnHandle inRgn
) ;
174 OSErr
UMAGetRootControl( WindowPtr inWindow
, ControlHandle
*outControl
) ;
176 // handling control data
178 OSErr
UMASetControlData (ControlHandle inControl
,
179 ControlPartCode inPart
,
184 OSErr
UMAGetControlData (ControlHandle inControl
,
185 ControlPartCode inPart
,
189 Size
* outActualSize
) ;
190 OSErr
UMAGetControlDataSize (ControlHandle inControl
,
191 ControlPartCode inPart
,
198 short UMAFindWindow( Point inPoint
, WindowRef
*outWindow
) ;
199 OSStatus
UMAGetWindowFeatures( WindowRef inWindowRef
, UInt32
*outFeatures
) ;
200 OSStatus
UMAGetWindowRegion( WindowRef inWindowRef
, WindowRegionCode inRegionCode
, RgnHandle ioWinRgn
) ;
201 OSStatus
UMACollapseWindow( WindowRef inWindowRef
, Boolean inCollapseIt
) ;
202 OSStatus
UMACollapseAllWindows( Boolean inCollapseEm
) ;
203 Boolean
UMAIsWindowCollapsed( WindowRef inWindowRef
) ;
204 Boolean
UMAIsWindowCollapsable( WindowRef inWindowRef
) ;
208 OSStatus
UMACreateNewWindow( WindowClass windowClass
, WindowAttributes attributes
, const Rect
*bounds
, WindowRef
*outWindow
) ;
209 OSStatus
UMAGetWindowClass( WindowRef inWindowRef
, WindowClass
*outWindowClass
) ;
210 OSStatus
UMAGetWindowAttributes( WindowRef inWindowRef
, WindowAttributes
*outAttributes
) ;
212 void UMAShowFloatingWindows() ;
213 void UMAHideFloatingWindows() ;
214 Boolean
UMAAreFloatingWindowsVisible() ;
215 WindowRef
UMAFrontWindow() ;
216 WindowRef
UMAFrontNonFloatingWindow() ;
220 bool UMAIsWindowFloating( WindowRef inWindow
) ;
221 bool UMAIsWindowModal( WindowRef inWindow
) ;
222 WindowRef
UMAGetActiveWindow() ;
223 WindowRef
UMAGetActiveNonFloatingWindow() ;
225 void UMAHighlightAndActivateWindow( WindowRef inWindowRef
, bool inActivate
) ;
228 #define GetPortTextFont( p) ((p)->txFont )
229 #define GetPortTextSize( p) ((p)->txSize )
230 #define GetPortTextFace( p) ((p)->txFace )
231 #define GetPortTextMode( p) ((p)->txMode )
232 #define GetRegionBounds( r , b) ((*b) = (**r).rgnBBox)
233 #define GetPortBounds( p , b) ((*b) = p->portRect )
234 #define GetWindowPortBounds( p , b) ((*b) = p->portRect )
235 #define GetPortVisibleRegion( p, r ) CopyRgn( p->visRgn , r )
236 #define GetQDGlobalsWhite( a ) (&((*a) = qd.white))
237 #define GetQDGlobalsBlack( a ) (&((*a) = qd.black))
238 #define GetQDGlobalsScreenBits( a ) (*a) = qd.screenBits
239 #define GetQDGlobalsArrow( a ) (&((*a) = qd.arrow))
240 #define GetControlBounds( c , b ) ((*b) = (**c).contrlRect )
241 #define GetPortBitMapForCopyBits( p ) ((BitMap*) &(((CGrafPtr)p)->portPixMap ))
244 // Appearance Drawing
246 OSStatus
UMADrawThemePlacard( const Rect
*inRect
, ThemeDrawState inState
) ;