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