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 OSStatus
UMAPrOpen(void *macPrintSession
) ;
58 OSStatus
UMAPrClose(void *macPrintSession
) ;
62 GrafPtr
UMAGetWindowPort( WindowRef inWindowRef
) ;
63 void UMADisposeWindow( WindowRef inWindowRef
) ;
64 void UMASetWTitleC( WindowRef inWindowRef
, const char *title
) ;
65 void UMAGetWTitleC( WindowRef inWindowRef
, char *title
) ;
67 void UMADrawGrowIcon( WindowRef inWindowRef
) ;
68 //void UMAShowWindow( WindowRef inWindowRef ) ;
69 //void UMAHideWindow( WindowRef inWindowRef ) ;
70 void UMAShowHide( WindowRef inWindowRef
, Boolean show
) ;
71 //void UMASelectWindow( WindowRef inWindowRef ) ;
72 //void UMABringToFront( WindowRef inWindowRef ) ;
73 //void UMASendBehind( WindowRef inWindowRef , WindowRef behindWindow ) ;
74 // void UMACloseWindow(WindowRef inWindowRef) ;
78 void UMADrawControl( ControlHandle inControl
) ;
80 void UMAEnableControl( ControlHandle inControl
) ;
81 void UMADisableControl( ControlHandle inControl
) ;
82 void UMAActivateControl( ControlHandle inControl
) ;
83 void UMADeactivateControl( ControlHandle inControl
) ;
84 //void UMAApplyThemeBackground (ThemeBackgroundKind inKind,
85 // const Rect * bounds,
86 // ThemeDrawState inState,
88 // Boolean inColorDev);
89 //void UMASetThemeWindowBackground (WindowRef inWindow,
90 // ThemeBrush inBrush,
91 // Boolean inUpdate) ;
93 ControlHandle ::NewControl(WindowPtr owningWindow,
94 const Rect * boundsRect,
95 ConstStr255Param controlTitle,
96 Boolean initiallyVisible,
101 SInt32 controlReference) ;
103 //void UMADisposeControl (ControlHandle theControl) ;
104 //void UMAHiliteControl (ControlHandle theControl,
105 // ControlPartCode hiliteState) ;
106 void UMAShowControl (ControlHandle theControl
) ;
107 void UMAHideControl (ControlHandle theControl
);
108 //void UMASetControlVisibility (ControlHandle inControl,
109 // Boolean inIsVisible,
110 // Boolean inDoDraw);
112 //bool UMAIsControlActive (ControlHandle inControl);
113 //bool UMAIsControlVisible (ControlHandle inControl);
114 void UMAActivateControl (ControlHandle inControl
);
115 void UMADeactivateControl (ControlHandle inControl
);
117 //OSErr UMAGetBestControlRect (ControlHandle inControl,
119 // SInt16 * outBaseLineOffset);
120 //OSErr UMASetControlFontStyle (ControlHandle inControl,
121 // const ControlFontStyleRec * inStyle) ;
124 void UMAMoveControl( ControlHandle inControl
, short x
, short y
) ;
125 void UMASizeControl( ControlHandle inControl
, short x
, short y
) ;
128 //OSErr UMACreateRootControl (WindowPtr inWindow,
129 // ControlHandle * outControl) ;
131 //OSErr UMAEmbedControl (ControlHandle inControl,
132 // ControlHandle inContainer);
135 OSErr
UMASetKeyboardFocus (WindowPtr inWindow
,
136 ControlHandle inControl
,
137 ControlFocusPart inPart
) ;
142 //ControlPartCode UMAHandleControlClick (ControlHandle inControl,
144 // SInt16 inModifiers,
145 // ControlActionUPP inAction) ;
146 //SInt16 UMAHandleControlKey (ControlHandle inControl,
148 // SInt16 inCharCode,
149 // SInt16 inModifiers);
151 //void UMAIdleControls (WindowPtr inWindow) ;
153 void UMAUpdateControls( WindowPtr inWindow
, RgnHandle inRgn
) ;
154 OSErr
UMAGetRootControl( WindowPtr inWindow
, ControlHandle
*outControl
) ;
156 // handling control data
158 OSErr ::SetControlData (ControlHandle inControl,
159 ControlPartCode inPart,
164 OSErr ::GetControlData (ControlHandle inControl,
165 ControlPartCode inPart,
169 Size * outActualSize) ;
170 OSErr ::GetControlDataSize (ControlHandle inControl,
171 ControlPartCode inPart,
178 short UMAFindWindow( Point inPoint , WindowRef *outWindow ) ;
179 OSStatus UMAGetWindowFeatures( WindowRef inWindowRef , UInt32 *outFeatures ) ;
180 OSStatus UMAGetWindowRegion( WindowRef inWindowRef , WindowRegionCode inRegionCode , RgnHandle ioWinRgn ) ;
181 OSStatus UMACollapseWindow( WindowRef inWindowRef , Boolean inCollapseIt ) ;
182 OSStatus UMACollapseAllWindows( Boolean inCollapseEm ) ;
183 Boolean UMAIsWindowCollapsed( WindowRef inWindowRef ) ;
184 Boolean UMAIsWindowCollapsable( WindowRef inWindowRef ) ;
188 OSStatus UMACreateNewWindow( WindowClass windowClass , WindowAttributes attributes , const Rect *bounds, WindowRef *outWindow ) ;
189 OSStatus UMAGetWindowClass( WindowRef inWindowRef , WindowClass *outWindowClass ) ;
190 OSStatus UMAGetWindowAttributes( WindowRef inWindowRef , WindowAttributes *outAttributes ) ;
192 void UMAShowFloatingWindows() ;
193 void UMAHideFloatingWindows() ;
194 Boolean UMAAreFloatingWindowsVisible() ;
195 WindowRef UMAFrontWindow() ;
196 WindowRef UMAFrontNonFloatingWindow() ;
200 bool UMAIsWindowFloating( WindowRef inWindow
) ;
201 bool UMAIsWindowModal( WindowRef inWindow
) ;
203 WindowRef UMAGetActiveWindow() ;
204 WindowRef UMAGetActiveNonFloatingWindow() ;
206 void UMAHighlightAndActivateWindow( WindowRef inWindowRef
, bool inActivate
) ;
208 OSStatus
UMAGetHelpMenu(
209 MenuRef
* outHelpMenu
,
210 MenuItemIndex
* outFirstCustomItemIndex
); /* can be NULL */
212 // Appearance Drawing
214 OSStatus
UMADrawThemePlacard( const Rect
*inRect
, ThemeDrawState inState
) ;
219 #define ClearCurrentScrap() ZeroScrap() ;
221 #define GetPortTextFont( p) ((p)->txFont )
222 #define GetPortTextSize( p) ((p)->txSize )
223 #define GetPortTextFace( p) ((p)->txFace )
224 #define GetPortTextMode( p) ((p)->txMode )
225 #define GetRegionBounds( r , b) ((*b) = (**r).rgnBBox)
226 #define GetPortBounds( p , b) ((*b) = p->portRect )
227 #define GetWindowPortBounds( p , b) ((*b) = p->portRect )
228 #define GetPortVisibleRegion( p, r ) CopyRgn( p->visRgn , r )
229 #define GetQDGlobalsWhite( a ) (&((*a) = qd.white))
230 #define GetQDGlobalsBlack( a ) (&((*a) = qd.black))
231 #define GetQDGlobalsScreenBits( a ) ((*a) = qd.screenBits)
232 #define GetQDGlobalsArrow( a ) (&((*a) = qd.arrow))
233 #define GetControlBounds( c , b ) &((*b) = (**c).contrlRect )
234 #define GetPortBitMapForCopyBits( p ) ((BitMap*) &(((CGrafPtr)p)->portPixMap ))
235 #define GetControlOwner( control ) ((**control).contrlOwner)
237 #define GetPortPenMode( p ) (p->pnMode)
238 #define SetPortPenMode( p , mode ) (p->pnMode = mode )
241 #define GetControlReference( control ) ((**control).contrlRfCon)
245 #define SetListSelectionFlags( list , options ) (**list).selFlags = options
246 #define GetListRefCon( list ) (**list).refCon
250 // calls not in carbon
254 #define GetWindowUpdateRgn( inWindow , updateRgn ) GetWindowRegion( inWindow , kWindowUpdateRgn, updateRgn )