1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Universal MacOS API
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #include "wx/mac/private.h"
17 void UMAInitToolbox( UInt16 inMoreMastersCalls
) ;
18 void UMACleanupToolbox() ;
19 bool UMAHasAppearance() ;
20 long UMAGetAppearanceVersion() ;
21 bool UMAHasWindowManager() ;
22 long UMAGetWindowManagerAttr() ;
23 bool UMAHasAquaLayout() ;
27 long UMAGetProcessMode() ;
28 bool UMAGetProcessModeDoesActivateOnFGSwitch() ;
32 void UMASetMenuTitle( MenuRef menu
, StringPtr title
) ;
33 UInt32
UMAMenuEvent( EventRecord
*inEvent
) ;
34 void UMAEnableMenuItem( MenuRef inMenu
, MenuItemIndex item
) ;
35 void UMADisableMenuItem( MenuRef inMenu
, MenuItemIndex item
) ;
36 void UMAAppendSubMenuItem( MenuRef menu
, StringPtr label
, SInt16 submenuid
) ;
37 void UMAInsertSubMenuItem( MenuRef menu
, StringPtr label
, MenuItemIndex item
, SInt16 submenuid
) ;
38 void UMAAppendMenuItem( MenuRef menu
, StringPtr label
, SInt16 key
= 0, UInt8 modifiers
= 0 ) ;
39 void UMAInsertMenuItem( MenuRef menu
, StringPtr label
, MenuItemIndex item
, SInt16 key
= 0 , UInt8 modifiers
= 0 ) ;
40 // void UMASetMenuItemText( MenuRef menu , MenuItemIndex item , StringPtr label ) ;
42 // MenuRef ::NewMenu( SInt16 menuid , StringPtr label ) ;
43 // void UMADisposeMenu( MenuRef menu ) ;
45 // handling the menubar
47 // void UMADeleteMenu( SInt16 menuId ) ;
48 // void UMAInsertMenu( MenuRef insertMenu , SInt16 afterId ) ;
49 // void UMADrawMenuBar() ;
53 void UMAShowWatchCursor() ;
54 void UMAShowArrowCursor() ;
56 #if TARGET_CARBON && PM_USE_SESSION_APIS
57 OSStatus
UMAPrOpen(PMPrintSession
*macPrintSession
) ;
58 OSStatus
UMAPrClose(PMPrintSession
*macPrintSession
) ;
60 OSStatus
UMAPrOpen() ;
61 OSStatus
UMAPrClose() ;
66 GrafPtr
UMAGetWindowPort( WindowRef inWindowRef
) ;
67 void UMADisposeWindow( WindowRef inWindowRef
) ;
68 void UMASetWTitleC( WindowRef inWindowRef
, const char *title
) ;
69 void UMAGetWTitleC( WindowRef inWindowRef
, char *title
) ;
71 void UMADrawGrowIcon( WindowRef inWindowRef
) ;
72 //void UMAShowWindow( WindowRef inWindowRef ) ;
73 //void UMAHideWindow( WindowRef inWindowRef ) ;
74 void UMAShowHide( WindowRef inWindowRef
, Boolean show
) ;
75 //void UMASelectWindow( WindowRef inWindowRef ) ;
76 //void UMABringToFront( WindowRef inWindowRef ) ;
77 //void UMASendBehind( WindowRef inWindowRef , WindowRef behindWindow ) ;
78 // void UMACloseWindow(WindowRef inWindowRef) ;
82 void UMADrawControl( ControlHandle inControl
) ;
84 void UMAEnableControl( ControlHandle inControl
) ;
85 void UMADisableControl( ControlHandle inControl
) ;
86 void UMAActivateControl( ControlHandle inControl
) ;
87 void UMADeactivateControl( ControlHandle inControl
) ;
88 //void UMAApplyThemeBackground (ThemeBackgroundKind inKind,
89 // const Rect * bounds,
90 // ThemeDrawState inState,
92 // Boolean inColorDev);
93 //void UMASetThemeWindowBackground (WindowRef inWindow,
94 // ThemeBrush inBrush,
95 // Boolean inUpdate) ;
97 ControlHandle ::NewControl(WindowPtr owningWindow,
98 const Rect * boundsRect,
99 ConstStr255Param controlTitle,
100 Boolean initiallyVisible,
105 SInt32 controlReference) ;
107 //void UMADisposeControl (ControlHandle theControl) ;
108 //void UMAHiliteControl (ControlHandle theControl,
109 // ControlPartCode hiliteState) ;
110 void UMAShowControl (ControlHandle theControl
) ;
111 void UMAHideControl (ControlHandle theControl
);
112 //void UMASetControlVisibility (ControlHandle inControl,
113 // Boolean inIsVisible,
114 // Boolean inDoDraw);
116 //bool UMAIsControlActive (ControlHandle inControl);
117 //bool UMAIsControlVisible (ControlHandle inControl);
118 void UMAActivateControl (ControlHandle inControl
);
119 void UMADeactivateControl (ControlHandle inControl
);
121 //OSErr UMAGetBestControlRect (ControlHandle inControl,
123 // SInt16 * outBaseLineOffset);
124 //OSErr UMASetControlFontStyle (ControlHandle inControl,
125 // const ControlFontStyleRec * inStyle) ;
128 void UMAMoveControl( ControlHandle inControl
, short x
, short y
) ;
129 void UMASizeControl( ControlHandle inControl
, short x
, short y
) ;
132 //OSErr UMACreateRootControl (WindowPtr inWindow,
133 // ControlHandle * outControl) ;
135 //OSErr UMAEmbedControl (ControlHandle inControl,
136 // ControlHandle inContainer);
139 OSErr
UMASetKeyboardFocus (WindowPtr inWindow
,
140 ControlHandle inControl
,
141 ControlFocusPart inPart
) ;
146 //ControlPartCode UMAHandleControlClick (ControlHandle inControl,
148 // SInt16 inModifiers,
149 // ControlActionUPP inAction) ;
150 //SInt16 UMAHandleControlKey (ControlHandle inControl,
152 // SInt16 inCharCode,
153 // SInt16 inModifiers);
155 //void UMAIdleControls (WindowPtr inWindow) ;
157 void UMAUpdateControls( WindowPtr inWindow
, RgnHandle inRgn
) ;
158 OSErr
UMAGetRootControl( WindowPtr inWindow
, ControlHandle
*outControl
) ;
160 // handling control data
162 OSErr ::SetControlData (ControlHandle inControl,
163 ControlPartCode inPart,
168 OSErr ::GetControlData (ControlHandle inControl,
169 ControlPartCode inPart,
173 Size * outActualSize) ;
174 OSErr ::GetControlDataSize (ControlHandle inControl,
175 ControlPartCode inPart,
182 short UMAFindWindow( Point inPoint , WindowRef *outWindow ) ;
183 OSStatus UMAGetWindowFeatures( WindowRef inWindowRef , UInt32 *outFeatures ) ;
184 OSStatus UMAGetWindowRegion( WindowRef inWindowRef , WindowRegionCode inRegionCode , RgnHandle ioWinRgn ) ;
185 OSStatus UMACollapseWindow( WindowRef inWindowRef , Boolean inCollapseIt ) ;
186 OSStatus UMACollapseAllWindows( Boolean inCollapseEm ) ;
187 Boolean UMAIsWindowCollapsed( WindowRef inWindowRef ) ;
188 Boolean UMAIsWindowCollapsable( WindowRef inWindowRef ) ;
192 OSStatus UMACreateNewWindow( WindowClass windowClass , WindowAttributes attributes , const Rect *bounds, WindowRef *outWindow ) ;
193 OSStatus UMAGetWindowClass( WindowRef inWindowRef , WindowClass *outWindowClass ) ;
194 OSStatus UMAGetWindowAttributes( WindowRef inWindowRef , WindowAttributes *outAttributes ) ;
196 void UMAShowFloatingWindows() ;
197 void UMAHideFloatingWindows() ;
198 Boolean UMAAreFloatingWindowsVisible() ;
199 WindowRef UMAFrontWindow() ;
200 WindowRef UMAFrontNonFloatingWindow() ;
204 bool UMAIsWindowFloating( WindowRef inWindow
) ;
205 bool UMAIsWindowModal( WindowRef inWindow
) ;
207 WindowRef UMAGetActiveWindow() ;
208 WindowRef UMAGetActiveNonFloatingWindow() ;
210 void UMAHighlightAndActivateWindow( WindowRef inWindowRef
, bool inActivate
) ;
212 OSStatus
UMAGetHelpMenu(
213 MenuRef
* outHelpMenu
,
214 MenuItemIndex
* outFirstCustomItemIndex
); /* can be NULL */
216 // Appearance Drawing
218 OSStatus
UMADrawThemePlacard( const Rect
*inRect
, ThemeDrawState inState
) ;
223 #define ClearCurrentScrap() ZeroScrap() ;
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 ))
239 #define GetControlOwner( control ) ((**control).contrlOwner)
241 #define GetPortPenMode( p ) (p->pnMode)
242 #define SetPortPenMode( p , mode ) (p->pnMode = mode )
245 #define GetControlReference( control ) ((**control).contrlRfCon)
249 #define SetListSelectionFlags( list , options ) (**list).selFlags = options
250 #define GetListRefCon( list ) (**list).refCon
254 // calls not in carbon
258 #define GetWindowUpdateRgn( inWindow , updateRgn ) GetWindowRegion( inWindow , kWindowUpdateRgn, updateRgn )