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 long UMAGetSystemVersion() ;
20 bool UMAHasAppearance() ;
21 long UMAGetAppearanceVersion() ;
22 bool UMAHasWindowManager() ;
23 long UMAGetWindowManagerAttr() ;
24 bool UMAHasAquaLayout() ;
25 bool UMASystemIsInitialized() ;
29 long UMAGetProcessMode() ;
30 bool UMAGetProcessModeDoesActivateOnFGSwitch() ;
34 void UMASetMenuTitle( MenuRef menu
, StringPtr title
) ;
35 UInt32
UMAMenuEvent( EventRecord
*inEvent
) ;
36 void UMAEnableMenuItem( MenuRef inMenu
, MenuItemIndex item
) ;
37 void UMADisableMenuItem( MenuRef inMenu
, MenuItemIndex item
) ;
38 void UMAAppendSubMenuItem( MenuRef menu
, StringPtr label
, SInt16 submenuid
) ;
39 void UMAInsertSubMenuItem( MenuRef menu
, StringPtr label
, MenuItemIndex item
, SInt16 submenuid
) ;
40 void UMAAppendMenuItem( MenuRef menu
, StringPtr label
, SInt16 key
= 0, UInt8 modifiers
= 0 ) ;
41 void UMAInsertMenuItem( MenuRef menu
, StringPtr label
, MenuItemIndex item
, SInt16 key
= 0 , UInt8 modifiers
= 0 ) ;
42 // void UMASetMenuItemText( MenuRef menu , MenuItemIndex item , StringPtr label ) ;
44 // MenuRef ::NewMenu( SInt16 menuid , StringPtr label ) ;
45 // void UMADisposeMenu( MenuRef menu ) ;
47 // handling the menubar
49 // void UMADeleteMenu( SInt16 menuId ) ;
50 // void UMAInsertMenu( MenuRef insertMenu , SInt16 afterId ) ;
51 // void UMADrawMenuBar() ;
55 void UMAShowWatchCursor() ;
56 void UMAShowArrowCursor() ;
58 OSStatus
UMAPrOpen(void *macPrintSession
) ;
59 OSStatus
UMAPrClose(void *macPrintSession
) ;
63 GrafPtr
UMAGetWindowPort( WindowRef inWindowRef
) ;
64 void UMADisposeWindow( WindowRef inWindowRef
) ;
65 void UMASetWTitleC( WindowRef inWindowRef
, const char *title
) ;
66 void UMAGetWTitleC( WindowRef inWindowRef
, char *title
) ;
68 void UMADrawGrowIcon( WindowRef inWindowRef
) ;
69 //void UMAShowWindow( WindowRef inWindowRef ) ;
70 //void UMAHideWindow( WindowRef inWindowRef ) ;
71 void UMAShowHide( WindowRef inWindowRef
, Boolean show
) ;
72 //void UMASelectWindow( WindowRef inWindowRef ) ;
73 //void UMABringToFront( WindowRef inWindowRef ) ;
74 //void UMASendBehind( WindowRef inWindowRef , WindowRef behindWindow ) ;
75 // void UMACloseWindow(WindowRef inWindowRef) ;
79 void UMADrawControl( ControlHandle inControl
) ;
81 void UMAEnableControl( ControlHandle inControl
) ;
82 void UMADisableControl( ControlHandle inControl
) ;
83 void UMAActivateControl( ControlHandle inControl
) ;
84 void UMADeactivateControl( ControlHandle inControl
) ;
85 //void UMAApplyThemeBackground (ThemeBackgroundKind inKind,
86 // const Rect * bounds,
87 // ThemeDrawState inState,
89 // Boolean inColorDev);
90 //void UMASetThemeWindowBackground (WindowRef inWindow,
91 // ThemeBrush inBrush,
92 // Boolean inUpdate) ;
94 ControlHandle ::NewControl(WindowPtr owningWindow,
95 const Rect * boundsRect,
96 ConstStr255Param controlTitle,
97 Boolean initiallyVisible,
102 SInt32 controlReference) ;
104 //void UMADisposeControl (ControlHandle theControl) ;
105 //void UMAHiliteControl (ControlHandle theControl,
106 // ControlPartCode hiliteState) ;
107 void UMAShowControl (ControlHandle theControl
) ;
108 void UMAHideControl (ControlHandle theControl
);
109 //void UMASetControlVisibility (ControlHandle inControl,
110 // Boolean inIsVisible,
111 // Boolean inDoDraw);
113 //bool UMAIsControlActive (ControlHandle inControl);
114 //bool UMAIsControlVisible (ControlHandle inControl);
115 void UMAActivateControl (ControlHandle inControl
);
116 void UMADeactivateControl (ControlHandle inControl
);
118 //OSErr UMAGetBestControlRect (ControlHandle inControl,
120 // SInt16 * outBaseLineOffset);
121 //OSErr UMASetControlFontStyle (ControlHandle inControl,
122 // const ControlFontStyleRec * inStyle) ;
125 void UMAMoveControl( ControlHandle inControl
, short x
, short y
) ;
126 void UMASizeControl( ControlHandle inControl
, short x
, short y
) ;
129 //OSErr UMACreateRootControl (WindowPtr inWindow,
130 // ControlHandle * outControl) ;
132 //OSErr UMAEmbedControl (ControlHandle inControl,
133 // ControlHandle inContainer);
136 OSErr
UMASetKeyboardFocus (WindowPtr inWindow
,
137 ControlHandle inControl
,
138 ControlFocusPart inPart
) ;
143 //ControlPartCode UMAHandleControlClick (ControlHandle inControl,
145 // SInt16 inModifiers,
146 // ControlActionUPP inAction) ;
147 //SInt16 UMAHandleControlKey (ControlHandle inControl,
149 // SInt16 inCharCode,
150 // SInt16 inModifiers);
152 //void UMAIdleControls (WindowPtr inWindow) ;
154 void UMAUpdateControls( WindowPtr inWindow
, RgnHandle inRgn
) ;
155 OSErr
UMAGetRootControl( WindowPtr inWindow
, ControlHandle
*outControl
) ;
157 // handling control data
159 OSErr ::SetControlData (ControlHandle inControl,
160 ControlPartCode inPart,
165 OSErr ::GetControlData (ControlHandle inControl,
166 ControlPartCode inPart,
170 Size * outActualSize) ;
171 OSErr ::GetControlDataSize (ControlHandle inControl,
172 ControlPartCode inPart,
179 short UMAFindWindow( Point inPoint , WindowRef *outWindow ) ;
180 OSStatus UMAGetWindowFeatures( WindowRef inWindowRef , UInt32 *outFeatures ) ;
181 OSStatus UMAGetWindowRegion( WindowRef inWindowRef , WindowRegionCode inRegionCode , RgnHandle ioWinRgn ) ;
182 OSStatus UMACollapseWindow( WindowRef inWindowRef , Boolean inCollapseIt ) ;
183 OSStatus UMACollapseAllWindows( Boolean inCollapseEm ) ;
184 Boolean UMAIsWindowCollapsed( WindowRef inWindowRef ) ;
185 Boolean UMAIsWindowCollapsable( WindowRef inWindowRef ) ;
189 OSStatus UMACreateNewWindow( WindowClass windowClass , WindowAttributes attributes , const Rect *bounds, WindowRef *outWindow ) ;
190 OSStatus UMAGetWindowClass( WindowRef inWindowRef , WindowClass *outWindowClass ) ;
191 OSStatus UMAGetWindowAttributes( WindowRef inWindowRef , WindowAttributes *outAttributes ) ;
193 void UMAShowFloatingWindows() ;
194 void UMAHideFloatingWindows() ;
195 Boolean UMAAreFloatingWindowsVisible() ;
196 WindowRef UMAFrontWindow() ;
197 WindowRef UMAFrontNonFloatingWindow() ;
201 bool UMAIsWindowFloating( WindowRef inWindow
) ;
202 bool UMAIsWindowModal( WindowRef inWindow
) ;
204 WindowRef UMAGetActiveWindow() ;
205 WindowRef UMAGetActiveNonFloatingWindow() ;
207 void UMAHighlightAndActivateWindow( WindowRef inWindowRef
, bool inActivate
) ;
209 OSStatus
UMAGetHelpMenu(
210 MenuRef
* outHelpMenu
,
211 MenuItemIndex
* outFirstCustomItemIndex
); /* can be NULL */
213 // Appearance Drawing
215 OSStatus
UMADrawThemePlacard( const Rect
*inRect
, ThemeDrawState inState
) ;
220 #define ClearCurrentScrap() ZeroScrap() ;
222 #define GetPortTextFont( p) ((p)->txFont )
223 #define GetPortTextSize( p) ((p)->txSize )
224 #define GetPortTextFace( p) ((p)->txFace )
225 #define GetPortTextMode( p) ((p)->txMode )
226 #define GetRegionBounds( r , b) ((*b) = (**r).rgnBBox)
227 #define GetPortBounds( p , b) ((*b) = p->portRect )
228 #define GetWindowPortBounds( p , b) ((*b) = p->portRect )
229 #define GetPortVisibleRegion( p, r ) CopyRgn( p->visRgn , r )
230 #define GetQDGlobalsWhite( a ) (&((*a) = qd.white))
231 #define GetQDGlobalsBlack( a ) (&((*a) = qd.black))
232 #define GetQDGlobalsScreenBits( a ) ((*a) = qd.screenBits)
233 #define GetQDGlobalsArrow( a ) (&((*a) = qd.arrow))
234 #define GetControlBounds( c , b ) &((*b) = (**c).contrlRect )
235 #define GetPortBitMapForCopyBits( p ) ((BitMap*) &(((CGrafPtr)p)->portPixMap ))
236 #define GetControlOwner( control ) ((**control).contrlOwner)
238 #define GetPortPenMode( p ) (p->pnMode)
239 #define SetPortPenMode( p , mode ) (p->pnMode = mode )
242 #define GetControlReference( control ) ((**control).contrlRfCon)
246 #define SetListSelectionFlags( list , options ) (**list).selFlags = options
247 #define GetListRefCon( list ) (**list).refCon
249 #define GetApplicationScript() smSystemScript
252 // calls not in carbon
256 #define GetWindowUpdateRgn( inWindow , updateRgn ) GetWindowRegion( inWindow , kWindowUpdateRgn, updateRgn )