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