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() ;
24 bool UMASystemIsInitialized() ;
28 long UMAGetProcessMode() ;
29 bool UMAGetProcessModeDoesActivateOnFGSwitch() ;
33 void UMASetMenuTitle( MenuRef menu
, StringPtr title
) ;
34 UInt32
UMAMenuEvent( EventRecord
*inEvent
) ;
35 void UMAEnableMenuItem( MenuRef inMenu
, MenuItemIndex item
) ;
36 void UMADisableMenuItem( MenuRef inMenu
, MenuItemIndex item
) ;
37 void UMAAppendSubMenuItem( MenuRef menu
, StringPtr label
, SInt16 submenuid
) ;
38 void UMAInsertSubMenuItem( MenuRef menu
, StringPtr label
, MenuItemIndex item
, SInt16 submenuid
) ;
39 void UMAAppendMenuItem( MenuRef menu
, StringPtr label
, SInt16 key
= 0, UInt8 modifiers
= 0 ) ;
40 void UMAInsertMenuItem( MenuRef menu
, StringPtr label
, MenuItemIndex item
, SInt16 key
= 0 , UInt8 modifiers
= 0 ) ;
41 // void UMASetMenuItemText( MenuRef menu , MenuItemIndex item , StringPtr label ) ;
43 // MenuRef ::NewMenu( SInt16 menuid , StringPtr label ) ;
44 // void UMADisposeMenu( MenuRef menu ) ;
46 // handling the menubar
48 // void UMADeleteMenu( SInt16 menuId ) ;
49 // void UMAInsertMenu( MenuRef insertMenu , SInt16 afterId ) ;
50 // void UMADrawMenuBar() ;
54 void UMAShowWatchCursor() ;
55 void UMAShowArrowCursor() ;
57 #if TARGET_CARBON && PM_USE_SESSION_APIS
58 OSStatus
UMAPrOpen(PMPrintSession
*macPrintSession
) ;
59 OSStatus
UMAPrClose(PMPrintSession
*macPrintSession
) ;
61 OSStatus
UMAPrOpen() ;
62 OSStatus
UMAPrClose() ;
67 GrafPtr
UMAGetWindowPort( WindowRef inWindowRef
) ;
68 void UMADisposeWindow( WindowRef inWindowRef
) ;
69 void UMASetWTitleC( WindowRef inWindowRef
, const char *title
) ;
70 void UMAGetWTitleC( WindowRef inWindowRef
, char *title
) ;
72 void UMADrawGrowIcon( WindowRef inWindowRef
) ;
73 //void UMAShowWindow( WindowRef inWindowRef ) ;
74 //void UMAHideWindow( WindowRef inWindowRef ) ;
75 void UMAShowHide( WindowRef inWindowRef
, Boolean show
) ;
76 //void UMASelectWindow( WindowRef inWindowRef ) ;
77 //void UMABringToFront( WindowRef inWindowRef ) ;
78 //void UMASendBehind( WindowRef inWindowRef , WindowRef behindWindow ) ;
79 // void UMACloseWindow(WindowRef inWindowRef) ;
83 void UMADrawControl( ControlHandle inControl
) ;
85 void UMAEnableControl( ControlHandle inControl
) ;
86 void UMADisableControl( ControlHandle inControl
) ;
87 void UMAActivateControl( ControlHandle inControl
) ;
88 void UMADeactivateControl( ControlHandle inControl
) ;
89 //void UMAApplyThemeBackground (ThemeBackgroundKind inKind,
90 // const Rect * bounds,
91 // ThemeDrawState inState,
93 // Boolean inColorDev);
94 //void UMASetThemeWindowBackground (WindowRef inWindow,
95 // ThemeBrush inBrush,
96 // Boolean inUpdate) ;
98 ControlHandle ::NewControl(WindowPtr owningWindow,
99 const Rect * boundsRect,
100 ConstStr255Param controlTitle,
101 Boolean initiallyVisible,
106 SInt32 controlReference) ;
108 //void UMADisposeControl (ControlHandle theControl) ;
109 //void UMAHiliteControl (ControlHandle theControl,
110 // ControlPartCode hiliteState) ;
111 void UMAShowControl (ControlHandle theControl
) ;
112 void UMAHideControl (ControlHandle theControl
);
113 //void UMASetControlVisibility (ControlHandle inControl,
114 // Boolean inIsVisible,
115 // Boolean inDoDraw);
117 //bool UMAIsControlActive (ControlHandle inControl);
118 //bool UMAIsControlVisible (ControlHandle inControl);
119 void UMAActivateControl (ControlHandle inControl
);
120 void UMADeactivateControl (ControlHandle inControl
);
122 //OSErr UMAGetBestControlRect (ControlHandle inControl,
124 // SInt16 * outBaseLineOffset);
125 //OSErr UMASetControlFontStyle (ControlHandle inControl,
126 // const ControlFontStyleRec * inStyle) ;
129 void UMAMoveControl( ControlHandle inControl
, short x
, short y
) ;
130 void UMASizeControl( ControlHandle inControl
, short x
, short y
) ;
133 //OSErr UMACreateRootControl (WindowPtr inWindow,
134 // ControlHandle * outControl) ;
136 //OSErr UMAEmbedControl (ControlHandle inControl,
137 // ControlHandle inContainer);
140 OSErr
UMASetKeyboardFocus (WindowPtr inWindow
,
141 ControlHandle inControl
,
142 ControlFocusPart inPart
) ;
147 //ControlPartCode UMAHandleControlClick (ControlHandle inControl,
149 // SInt16 inModifiers,
150 // ControlActionUPP inAction) ;
151 //SInt16 UMAHandleControlKey (ControlHandle inControl,
153 // SInt16 inCharCode,
154 // SInt16 inModifiers);
156 //void UMAIdleControls (WindowPtr inWindow) ;
158 void UMAUpdateControls( WindowPtr inWindow
, RgnHandle inRgn
) ;
159 OSErr
UMAGetRootControl( WindowPtr inWindow
, ControlHandle
*outControl
) ;
161 // handling control data
163 OSErr ::SetControlData (ControlHandle inControl,
164 ControlPartCode inPart,
169 OSErr ::GetControlData (ControlHandle inControl,
170 ControlPartCode inPart,
174 Size * outActualSize) ;
175 OSErr ::GetControlDataSize (ControlHandle inControl,
176 ControlPartCode inPart,
183 short UMAFindWindow( Point inPoint , WindowRef *outWindow ) ;
184 OSStatus UMAGetWindowFeatures( WindowRef inWindowRef , UInt32 *outFeatures ) ;
185 OSStatus UMAGetWindowRegion( WindowRef inWindowRef , WindowRegionCode inRegionCode , RgnHandle ioWinRgn ) ;
186 OSStatus UMACollapseWindow( WindowRef inWindowRef , Boolean inCollapseIt ) ;
187 OSStatus UMACollapseAllWindows( Boolean inCollapseEm ) ;
188 Boolean UMAIsWindowCollapsed( WindowRef inWindowRef ) ;
189 Boolean UMAIsWindowCollapsable( WindowRef inWindowRef ) ;
193 OSStatus UMACreateNewWindow( WindowClass windowClass , WindowAttributes attributes , const Rect *bounds, WindowRef *outWindow ) ;
194 OSStatus UMAGetWindowClass( WindowRef inWindowRef , WindowClass *outWindowClass ) ;
195 OSStatus UMAGetWindowAttributes( WindowRef inWindowRef , WindowAttributes *outAttributes ) ;
197 void UMAShowFloatingWindows() ;
198 void UMAHideFloatingWindows() ;
199 Boolean UMAAreFloatingWindowsVisible() ;
200 WindowRef UMAFrontWindow() ;
201 WindowRef UMAFrontNonFloatingWindow() ;
205 bool UMAIsWindowFloating( WindowRef inWindow
) ;
206 bool UMAIsWindowModal( WindowRef inWindow
) ;
208 WindowRef UMAGetActiveWindow() ;
209 WindowRef UMAGetActiveNonFloatingWindow() ;
211 void UMAHighlightAndActivateWindow( WindowRef inWindowRef
, bool inActivate
) ;
213 OSStatus
UMAGetHelpMenu(
214 MenuRef
* outHelpMenu
,
215 MenuItemIndex
* outFirstCustomItemIndex
); /* can be NULL */
217 // Appearance Drawing
219 OSStatus
UMADrawThemePlacard( const Rect
*inRect
, ThemeDrawState inState
) ;
224 #define ClearCurrentScrap() ZeroScrap() ;
226 #define GetPortTextFont( p) ((p)->txFont )
227 #define GetPortTextSize( p) ((p)->txSize )
228 #define GetPortTextFace( p) ((p)->txFace )
229 #define GetPortTextMode( p) ((p)->txMode )
230 #define GetRegionBounds( r , b) ((*b) = (**r).rgnBBox)
231 #define GetPortBounds( p , b) ((*b) = p->portRect )
232 #define GetWindowPortBounds( p , b) ((*b) = p->portRect )
233 #define GetPortVisibleRegion( p, r ) CopyRgn( p->visRgn , r )
234 #define GetQDGlobalsWhite( a ) (&((*a) = qd.white))
235 #define GetQDGlobalsBlack( a ) (&((*a) = qd.black))
236 #define GetQDGlobalsScreenBits( a ) ((*a) = qd.screenBits)
237 #define GetQDGlobalsArrow( a ) (&((*a) = qd.arrow))
238 #define GetControlBounds( c , b ) &((*b) = (**c).contrlRect )
239 #define GetPortBitMapForCopyBits( p ) ((BitMap*) &(((CGrafPtr)p)->portPixMap ))
240 #define GetControlOwner( control ) ((**control).contrlOwner)
242 #define GetPortPenMode( p ) (p->pnMode)
243 #define SetPortPenMode( p , mode ) (p->pnMode = mode )
246 #define GetControlReference( control ) ((**control).contrlRfCon)
250 #define SetListSelectionFlags( list , options ) (**list).selFlags = options
251 #define GetListRefCon( list ) (**list).refCon
255 // calls not in carbon
259 #define GetWindowUpdateRgn( inWindow , updateRgn ) GetWindowRegion( inWindow , kWindowUpdateRgn, updateRgn )