]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mac/uma.h
added wx/defs.h include to correct compilation issues under Mac OS X
[wxWidgets.git] / include / wx / mac / uma.h
CommitLineData
cfcc3671
UJ
1/////////////////////////////////////////////////////////////////////////////
2// Name: uma.h
3// Purpose: Universal MacOS API
4// Author: Stefan Csomor
5// Modified by:
6// Created: 03/02/99
7// RCS-ID: $Id:
8// Copyright: (c) Stefan Csomor
292d1a2f 9// Licence: wxWindows licence
cfcc3671
UJ
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef H_UMA
13#define H_UMA
14
15// define this to be 1 if you have the 8.6 libs (weak linked)
16
17#define UMA_USE_8_6 0
18
5b781a67
SC
19#if TARGET_CARBON
20#undef UMA_USE_8_6
21#define UMA_USE_8_6 1
22#endif
23
6e040042 24#if defined(__POWERPC__)
03e11df5
GD
25 #define UMA_USE_APPEARANCE 1
26 #define UMA_USE_WINDOWMGR 1
6e040042 27 #if defined(__DARWIN__)
03e11df5
GD
28 #include <Carbon/Carbon.h>
29 #endif
05adb9d2 30#else
fdaf613a 31 #define UMA_USE_APPEARANCE 1
03e11df5 32 #define UMA_USE_WINDOWMGR 0
05adb9d2 33#endif
cfcc3671 34
fdaf613a
SC
35#if UMA_USE_APPEARANCE == 0
36 #pragma error "wxMac needs appearance"
37#endif
38
cfcc3671
UJ
39#if !UMA_USE_8_6 && UMA_USE_WINDOWMGR
40#undef UMA_USE_WINDOWMGR
41#define UMA_USE_WINDOWMGR 0
42#endif
43
44#if !TARGET_CARBON
05adb9d2
SC
45// this is now defined in the latest headers
46// typedef short MenuItemIndex ;
cfcc3671
UJ
47#endif
48
49void UMAInitToolbox( UInt16 inMoreMastersCalls) ;
5b781a67 50void UMACleanupToolbox() ;
cfcc3671
UJ
51bool UMAHasAppearance() ;
52long UMAGetAppearanceVersion() ;
53
54// process manager
55
56long UMAGetProcessMode() ;
57bool UMAGetProcessModeDoesActivateOnFGSwitch() ;
58
59// menu manager
60
05adb9d2
SC
61void UMASetMenuTitle( MenuRef menu , StringPtr title ) ;
62UInt32 UMAMenuEvent( EventRecord *inEvent ) ;
cfcc3671
UJ
63void UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex item ) ;
64void UMADisableMenuItem( MenuRef inMenu , MenuItemIndex item ) ;
05adb9d2
SC
65void UMAAppendSubMenuItem( MenuRef menu , StringPtr label , SInt16 submenuid ) ;
66void UMAInsertSubMenuItem( MenuRef menu , StringPtr label , MenuItemIndex item , SInt16 submenuid ) ;
67void UMAAppendMenuItem( MenuRef menu , StringPtr label , SInt16 key= 0, UInt8 modifiers = 0 ) ;
68void UMAInsertMenuItem( MenuRef menu , StringPtr label , MenuItemIndex item , SInt16 key = 0 , UInt8 modifiers = 0 ) ;
69void UMASetMenuItemText( MenuRef menu , MenuItemIndex item , StringPtr label ) ;
70
71MenuRef UMANewMenu( SInt16 menuid , StringPtr label ) ;
72void UMADisposeMenu( MenuRef menu ) ;
73
74// handling the menubar
75
76void UMADeleteMenu( SInt16 menuId ) ;
77void UMAInsertMenu( MenuRef insertMenu , SInt16 afterId ) ;
78void UMADrawMenuBar() ;
79
cfcc3671
UJ
80// quickdraw
81
82void UMAShowWatchCursor() ;
83void UMAShowArrowCursor() ;
84
93f0fe75
GD
85#if TARGET_CARBON && PM_USE_SESSION_APIS
86OSStatus UMAPrOpen(PMPrintSession *macPrintSession) ;
87OSStatus UMAPrClose(PMPrintSession *macPrintSession) ;
0ab25937 88#else
5b781a67
SC
89OSStatus UMAPrOpen() ;
90OSStatus UMAPrClose() ;
0ab25937 91#endif
05adb9d2 92
cfcc3671
UJ
93// window manager
94
95GrafPtr UMAGetWindowPort( WindowRef inWindowRef ) ;
96void UMADisposeWindow( WindowRef inWindowRef ) ;
97void UMASetWTitleC( WindowRef inWindowRef , const char *title ) ;
98void UMAGetWTitleC( WindowRef inWindowRef , char *title ) ;
99
100void UMADrawGrowIcon( WindowRef inWindowRef ) ;
101void UMAShowWindow( WindowRef inWindowRef ) ;
102void UMAHideWindow( WindowRef inWindowRef ) ;
103void UMAShowHide( WindowRef inWindowRef , Boolean show) ;
104void UMASelectWindow( WindowRef inWindowRef ) ;
105void UMABringToFront( WindowRef inWindowRef ) ;
106void UMASendBehind( WindowRef inWindowRef , WindowRef behindWindow ) ;
107void UMACloseWindow(WindowRef inWindowRef) ;
108
109// appearance manager
110
111void UMADrawControl( ControlHandle inControl ) ;
112
fdaf613a
SC
113void UMAEnableControl( ControlHandle inControl ) ;
114void UMADisableControl( ControlHandle inControl ) ;
cfcc3671
UJ
115void UMAActivateControl( ControlHandle inControl ) ;
116void UMADeactivateControl( ControlHandle inControl ) ;
05adb9d2
SC
117void UMAApplyThemeBackground (ThemeBackgroundKind inKind,
118 const Rect * bounds,
119 ThemeDrawState inState,
120 SInt16 inDepth,
121 Boolean inColorDev);
cfcc3671
UJ
122void UMASetThemeWindowBackground (WindowRef inWindow,
123 ThemeBrush inBrush,
124 Boolean inUpdate) ;
125ControlHandle UMANewControl(WindowPtr owningWindow,
126 const Rect * boundsRect,
127 ConstStr255Param controlTitle,
128 Boolean initiallyVisible,
129 SInt16 initialValue,
130 SInt16 minimumValue,
131 SInt16 maximumValue,
132 SInt16 procID,
133 SInt32 controlReference) ;
134void UMADisposeControl (ControlHandle theControl) ;
135void UMAHiliteControl (ControlHandle theControl,
136 ControlPartCode hiliteState) ;
137void UMAShowControl (ControlHandle theControl) ;
138void UMAHideControl (ControlHandle theControl);
139void UMASetControlVisibility (ControlHandle inControl,
140 Boolean inIsVisible,
141 Boolean inDoDraw);
142
143bool UMAIsControlActive (ControlHandle inControl);
144bool UMAIsControlVisible (ControlHandle inControl);
145void UMAActivateControl (ControlHandle inControl);
146void UMADeactivateControl (ControlHandle inControl);
147
148OSErr UMAGetBestControlRect (ControlHandle inControl,
149 Rect * outRect,
150 SInt16 * outBaseLineOffset);
151OSErr UMASetControlFontStyle (ControlHandle inControl,
152 const ControlFontStyleRec * inStyle) ;
153
154
155void UMAMoveControl( ControlHandle inControl , short x , short y ) ;
156void UMASizeControl( ControlHandle inControl , short x , short y ) ;
157// control hierarchy
158
159OSErr UMACreateRootControl (WindowPtr inWindow,
160 ControlHandle * outControl) ;
161
162OSErr UMAEmbedControl (ControlHandle inControl,
163 ControlHandle inContainer);
164
165// keyboard focus
166OSErr UMASetKeyboardFocus (WindowPtr inWindow,
167 ControlHandle inControl,
168 ControlFocusPart inPart) ;
169
170
171// events
172
173ControlPartCode UMAHandleControlClick (ControlHandle inControl,
174 Point inWhere,
175 SInt16 inModifiers,
176 ControlActionUPP inAction) ;
177SInt16 UMAHandleControlKey (ControlHandle inControl,
178 SInt16 inKeyCode,
179 SInt16 inCharCode,
180 SInt16 inModifiers);
181
182void UMAIdleControls (WindowPtr inWindow) ;
183
184void UMAUpdateControls( WindowPtr inWindow , RgnHandle inRgn ) ;
185OSErr UMAGetRootControl( WindowPtr inWindow , ControlHandle *outControl ) ;
186
187// handling control data
188
189OSErr UMASetControlData (ControlHandle inControl,
190 ControlPartCode inPart,
191 ResType inTagName,
192 Size inSize,
193 Ptr inData) ;
194
195OSErr UMAGetControlData (ControlHandle inControl,
196 ControlPartCode inPart,
197 ResType inTagName,
198 Size inBufferSize,
199 Ptr outBuffer,
200 Size * outActualSize) ;
201OSErr UMAGetControlDataSize (ControlHandle inControl,
202 ControlPartCode inPart,
203 ResType inTagName,
204 Size * outMaxSize);
205
206
207// system 8.0
208
209short UMAFindWindow( Point inPoint , WindowRef *outWindow ) ;
210OSStatus UMAGetWindowFeatures( WindowRef inWindowRef , UInt32 *outFeatures ) ;
211OSStatus UMAGetWindowRegion( WindowRef inWindowRef , WindowRegionCode inRegionCode , RgnHandle ioWinRgn ) ;
212OSStatus UMACollapseWindow( WindowRef inWindowRef , Boolean inCollapseIt ) ;
213OSStatus UMACollapseAllWindows( Boolean inCollapseEm ) ;
214Boolean UMAIsWindowCollapsed( WindowRef inWindowRef ) ;
215Boolean UMAIsWindowCollapsable( WindowRef inWindowRef ) ;
216
217// system 8.5
218
219OSStatus UMACreateNewWindow( WindowClass windowClass , WindowAttributes attributes , const Rect *bounds, WindowRef *outWindow ) ;
220OSStatus UMAGetWindowClass( WindowRef inWindowRef , WindowClass *outWindowClass ) ;
221OSStatus UMAGetWindowAttributes( WindowRef inWindowRef , WindowAttributes *outAttributes ) ;
222
223void UMAShowFloatingWindows() ;
224void UMAHideFloatingWindows() ;
225Boolean UMAAreFloatingWindowsVisible() ;
226WindowRef UMAFrontWindow() ;
227WindowRef UMAFrontNonFloatingWindow() ;
228
229// floaters support
230
231bool UMAIsWindowFloating( WindowRef inWindow ) ;
232bool UMAIsWindowModal( WindowRef inWindow ) ;
233WindowRef UMAGetActiveWindow() ;
234WindowRef UMAGetActiveNonFloatingWindow() ;
235
236void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate ) ;
237
05adb9d2
SC
238#if !TARGET_CARBON
239#define GetPortTextFont( p) ((p)->txFont )
240#define GetPortTextSize( p) ((p)->txSize )
241#define GetPortTextFace( p) ((p)->txFace )
242#define GetPortTextMode( p) ((p)->txMode )
243#define GetRegionBounds( r , b) ((*b) = (**r).rgnBBox)
244#define GetPortBounds( p , b) ((*b) = p->portRect )
245#define GetWindowPortBounds( p , b) ((*b) = p->portRect )
246#define GetPortVisibleRegion( p, r ) CopyRgn( p->visRgn , r )
247#define GetQDGlobalsWhite( a ) (&((*a) = qd.white))
248#define GetQDGlobalsBlack( a ) (&((*a) = qd.black))
249#define GetQDGlobalsScreenBits( a ) (*a) = qd.screenBits
250#define GetQDGlobalsArrow( a ) (&((*a) = qd.arrow))
c36f0244 251#define GetControlBounds( c , b ) &((*b) = (**c).contrlRect )
05adb9d2
SC
252#define GetPortBitMapForCopyBits( p ) ((BitMap*) &(((CGrafPtr)p)->portPixMap ))
253#endif
254
255// Appearance Drawing
256
257OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState ) ;
cfcc3671 258
03e11df5 259#endif