]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/uma.h
wxDbGrid additions
[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 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 OSStatus UMAPrOpen() ;
86 OSStatus UMAPrClose() ;
87
88 // window manager
89
90 GrafPtr UMAGetWindowPort( WindowRef inWindowRef ) ;
91 void UMADisposeWindow( WindowRef inWindowRef ) ;
92 void UMASetWTitleC( WindowRef inWindowRef , const char *title ) ;
93 void UMAGetWTitleC( WindowRef inWindowRef , char *title ) ;
94
95 void UMADrawGrowIcon( WindowRef inWindowRef ) ;
96 void UMAShowWindow( WindowRef inWindowRef ) ;
97 void UMAHideWindow( WindowRef inWindowRef ) ;
98 void UMAShowHide( WindowRef inWindowRef , Boolean show) ;
99 void UMASelectWindow( WindowRef inWindowRef ) ;
100 void UMABringToFront( WindowRef inWindowRef ) ;
101 void UMASendBehind( WindowRef inWindowRef , WindowRef behindWindow ) ;
102 void UMACloseWindow(WindowRef inWindowRef) ;
103
104 // appearance manager
105
106 void UMADrawControl( ControlHandle inControl ) ;
107
108 void UMAEnableControl( ControlHandle inControl ) ;
109 void UMADisableControl( ControlHandle inControl ) ;
110 void UMAActivateControl( ControlHandle inControl ) ;
111 void UMADeactivateControl( ControlHandle inControl ) ;
112 void UMAApplyThemeBackground (ThemeBackgroundKind inKind,
113 const Rect * bounds,
114 ThemeDrawState inState,
115 SInt16 inDepth,
116 Boolean inColorDev);
117 void UMASetThemeWindowBackground (WindowRef inWindow,
118 ThemeBrush inBrush,
119 Boolean inUpdate) ;
120 ControlHandle UMANewControl(WindowPtr owningWindow,
121 const Rect * boundsRect,
122 ConstStr255Param controlTitle,
123 Boolean initiallyVisible,
124 SInt16 initialValue,
125 SInt16 minimumValue,
126 SInt16 maximumValue,
127 SInt16 procID,
128 SInt32 controlReference) ;
129 void UMADisposeControl (ControlHandle theControl) ;
130 void UMAHiliteControl (ControlHandle theControl,
131 ControlPartCode hiliteState) ;
132 void UMAShowControl (ControlHandle theControl) ;
133 void UMAHideControl (ControlHandle theControl);
134 void UMASetControlVisibility (ControlHandle inControl,
135 Boolean inIsVisible,
136 Boolean inDoDraw);
137
138 bool UMAIsControlActive (ControlHandle inControl);
139 bool UMAIsControlVisible (ControlHandle inControl);
140 void UMAActivateControl (ControlHandle inControl);
141 void UMADeactivateControl (ControlHandle inControl);
142
143 OSErr UMAGetBestControlRect (ControlHandle inControl,
144 Rect * outRect,
145 SInt16 * outBaseLineOffset);
146 OSErr UMASetControlFontStyle (ControlHandle inControl,
147 const ControlFontStyleRec * inStyle) ;
148
149
150 void UMAMoveControl( ControlHandle inControl , short x , short y ) ;
151 void UMASizeControl( ControlHandle inControl , short x , short y ) ;
152 // control hierarchy
153
154 OSErr UMACreateRootControl (WindowPtr inWindow,
155 ControlHandle * outControl) ;
156
157 OSErr UMAEmbedControl (ControlHandle inControl,
158 ControlHandle inContainer);
159
160 // keyboard focus
161 OSErr UMASetKeyboardFocus (WindowPtr inWindow,
162 ControlHandle inControl,
163 ControlFocusPart inPart) ;
164
165
166 // events
167
168 ControlPartCode UMAHandleControlClick (ControlHandle inControl,
169 Point inWhere,
170 SInt16 inModifiers,
171 ControlActionUPP inAction) ;
172 SInt16 UMAHandleControlKey (ControlHandle inControl,
173 SInt16 inKeyCode,
174 SInt16 inCharCode,
175 SInt16 inModifiers);
176
177 void UMAIdleControls (WindowPtr inWindow) ;
178
179 void UMAUpdateControls( WindowPtr inWindow , RgnHandle inRgn ) ;
180 OSErr UMAGetRootControl( WindowPtr inWindow , ControlHandle *outControl ) ;
181
182 // handling control data
183
184 OSErr UMASetControlData (ControlHandle inControl,
185 ControlPartCode inPart,
186 ResType inTagName,
187 Size inSize,
188 Ptr inData) ;
189
190 OSErr UMAGetControlData (ControlHandle inControl,
191 ControlPartCode inPart,
192 ResType inTagName,
193 Size inBufferSize,
194 Ptr outBuffer,
195 Size * outActualSize) ;
196 OSErr UMAGetControlDataSize (ControlHandle inControl,
197 ControlPartCode inPart,
198 ResType inTagName,
199 Size * outMaxSize);
200
201
202 // system 8.0
203
204 short UMAFindWindow( Point inPoint , WindowRef *outWindow ) ;
205 OSStatus UMAGetWindowFeatures( WindowRef inWindowRef , UInt32 *outFeatures ) ;
206 OSStatus UMAGetWindowRegion( WindowRef inWindowRef , WindowRegionCode inRegionCode , RgnHandle ioWinRgn ) ;
207 OSStatus UMACollapseWindow( WindowRef inWindowRef , Boolean inCollapseIt ) ;
208 OSStatus UMACollapseAllWindows( Boolean inCollapseEm ) ;
209 Boolean UMAIsWindowCollapsed( WindowRef inWindowRef ) ;
210 Boolean UMAIsWindowCollapsable( WindowRef inWindowRef ) ;
211
212 // system 8.5
213
214 OSStatus UMACreateNewWindow( WindowClass windowClass , WindowAttributes attributes , const Rect *bounds, WindowRef *outWindow ) ;
215 OSStatus UMAGetWindowClass( WindowRef inWindowRef , WindowClass *outWindowClass ) ;
216 OSStatus UMAGetWindowAttributes( WindowRef inWindowRef , WindowAttributes *outAttributes ) ;
217
218 void UMAShowFloatingWindows() ;
219 void UMAHideFloatingWindows() ;
220 Boolean UMAAreFloatingWindowsVisible() ;
221 WindowRef UMAFrontWindow() ;
222 WindowRef UMAFrontNonFloatingWindow() ;
223
224 // floaters support
225
226 bool UMAIsWindowFloating( WindowRef inWindow ) ;
227 bool UMAIsWindowModal( WindowRef inWindow ) ;
228 WindowRef UMAGetActiveWindow() ;
229 WindowRef UMAGetActiveNonFloatingWindow() ;
230
231 void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate ) ;
232
233 #if !TARGET_CARBON
234 #define GetPortTextFont( p) ((p)->txFont )
235 #define GetPortTextSize( p) ((p)->txSize )
236 #define GetPortTextFace( p) ((p)->txFace )
237 #define GetPortTextMode( p) ((p)->txMode )
238 #define GetRegionBounds( r , b) ((*b) = (**r).rgnBBox)
239 #define GetPortBounds( p , b) ((*b) = p->portRect )
240 #define GetWindowPortBounds( p , b) ((*b) = p->portRect )
241 #define GetPortVisibleRegion( p, r ) CopyRgn( p->visRgn , r )
242 #define GetQDGlobalsWhite( a ) (&((*a) = qd.white))
243 #define GetQDGlobalsBlack( a ) (&((*a) = qd.black))
244 #define GetQDGlobalsScreenBits( a ) (*a) = qd.screenBits
245 #define GetQDGlobalsArrow( a ) (&((*a) = qd.arrow))
246 #define GetControlBounds( c , b ) &((*b) = (**c).contrlRect )
247 #define GetPortBitMapForCopyBits( p ) ((BitMap*) &(((CGrafPtr)p)->portPixMap ))
248 #endif
249
250 // Appearance Drawing
251
252 OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState ) ;
253
254 #endif