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