]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/uma.h
getting rid of several graf port handling routines
[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 #if defined(__POWERPC__)
16 #if defined(__DARWIN__)
17 #include <Carbon/Carbon.h>
18 #endif
19 #endif
20
21 #if !TARGET_CARBON
22 // this is now defined in the latest headers
23 // typedef short MenuItemIndex ;
24 #endif
25
26 void UMAInitToolbox( UInt16 inMoreMastersCalls) ;
27 void UMACleanupToolbox() ;
28 bool UMAHasAppearance() ;
29 long UMAGetAppearanceVersion() ;
30 bool UMAHasWindowManager() ;
31 long UMAGetWindowManagerAttr() ;
32
33 // process manager
34
35 long UMAGetProcessMode() ;
36 bool UMAGetProcessModeDoesActivateOnFGSwitch() ;
37
38 // menu manager
39
40 void UMASetMenuTitle( MenuRef menu , StringPtr title ) ;
41 UInt32 UMAMenuEvent( EventRecord *inEvent ) ;
42 void UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex item ) ;
43 void UMADisableMenuItem( MenuRef inMenu , MenuItemIndex item ) ;
44 void UMAAppendSubMenuItem( MenuRef menu , StringPtr label , SInt16 submenuid ) ;
45 void UMAInsertSubMenuItem( MenuRef menu , StringPtr label , MenuItemIndex item , SInt16 submenuid ) ;
46 void UMAAppendMenuItem( MenuRef menu , StringPtr label , SInt16 key= 0, UInt8 modifiers = 0 ) ;
47 void UMAInsertMenuItem( MenuRef menu , StringPtr label , MenuItemIndex item , SInt16 key = 0 , UInt8 modifiers = 0 ) ;
48 // void UMASetMenuItemText( MenuRef menu , MenuItemIndex item , StringPtr label ) ;
49
50 // MenuRef ::NewMenu( SInt16 menuid , StringPtr label ) ;
51 // void UMADisposeMenu( MenuRef menu ) ;
52
53 // handling the menubar
54
55 // void UMADeleteMenu( SInt16 menuId ) ;
56 // void UMAInsertMenu( MenuRef insertMenu , SInt16 afterId ) ;
57 // void UMADrawMenuBar() ;
58
59 // quickdraw
60
61 void UMAShowWatchCursor() ;
62 void UMAShowArrowCursor() ;
63
64 #if TARGET_CARBON && PM_USE_SESSION_APIS
65 OSStatus UMAPrOpen(PMPrintSession *macPrintSession) ;
66 OSStatus UMAPrClose(PMPrintSession *macPrintSession) ;
67 #else
68 OSStatus UMAPrOpen() ;
69 OSStatus UMAPrClose() ;
70 #endif
71
72 // window manager
73
74 GrafPtr UMAGetWindowPort( WindowRef inWindowRef ) ;
75 void UMADisposeWindow( WindowRef inWindowRef ) ;
76 void UMASetWTitleC( WindowRef inWindowRef , const char *title ) ;
77 void UMAGetWTitleC( WindowRef inWindowRef , char *title ) ;
78
79 void UMADrawGrowIcon( WindowRef inWindowRef ) ;
80 //void UMAShowWindow( WindowRef inWindowRef ) ;
81 //void UMAHideWindow( WindowRef inWindowRef ) ;
82 void UMAShowHide( WindowRef inWindowRef , Boolean show) ;
83 //void UMASelectWindow( WindowRef inWindowRef ) ;
84 //void UMABringToFront( WindowRef inWindowRef ) ;
85 //void UMASendBehind( WindowRef inWindowRef , WindowRef behindWindow ) ;
86 // void UMACloseWindow(WindowRef inWindowRef) ;
87
88 // appearance manager
89
90 void UMADrawControl( ControlHandle inControl ) ;
91
92 void UMAEnableControl( ControlHandle inControl ) ;
93 void UMADisableControl( ControlHandle inControl ) ;
94 void UMAActivateControl( ControlHandle inControl ) ;
95 void UMADeactivateControl( ControlHandle inControl ) ;
96 //void UMAApplyThemeBackground (ThemeBackgroundKind inKind,
97 // const Rect * bounds,
98 // ThemeDrawState inState,
99 // SInt16 inDepth,
100 // Boolean inColorDev);
101 //void UMASetThemeWindowBackground (WindowRef inWindow,
102 // ThemeBrush inBrush,
103 // Boolean inUpdate) ;
104 /*
105 ControlHandle ::NewControl(WindowPtr owningWindow,
106 const Rect * boundsRect,
107 ConstStr255Param controlTitle,
108 Boolean initiallyVisible,
109 SInt16 initialValue,
110 SInt16 minimumValue,
111 SInt16 maximumValue,
112 SInt16 procID,
113 SInt32 controlReference) ;
114 */
115 //void UMADisposeControl (ControlHandle theControl) ;
116 //void UMAHiliteControl (ControlHandle theControl,
117 // ControlPartCode hiliteState) ;
118 void UMAShowControl (ControlHandle theControl) ;
119 void UMAHideControl (ControlHandle theControl);
120 //void UMASetControlVisibility (ControlHandle inControl,
121 // Boolean inIsVisible,
122 // Boolean inDoDraw);
123
124 //bool UMAIsControlActive (ControlHandle inControl);
125 //bool UMAIsControlVisible (ControlHandle inControl);
126 void UMAActivateControl (ControlHandle inControl);
127 void UMADeactivateControl (ControlHandle inControl);
128
129 //OSErr UMAGetBestControlRect (ControlHandle inControl,
130 // Rect * outRect,
131 // SInt16 * outBaseLineOffset);
132 //OSErr UMASetControlFontStyle (ControlHandle inControl,
133 // const ControlFontStyleRec * inStyle) ;
134
135
136 void UMAMoveControl( ControlHandle inControl , short x , short y ) ;
137 void UMASizeControl( ControlHandle inControl , short x , short y ) ;
138 // control hierarchy
139
140 //OSErr UMACreateRootControl (WindowPtr inWindow,
141 // ControlHandle * outControl) ;
142
143 //OSErr UMAEmbedControl (ControlHandle inControl,
144 // ControlHandle inContainer);
145
146 // keyboard focus
147 OSErr UMASetKeyboardFocus (WindowPtr inWindow,
148 ControlHandle inControl,
149 ControlFocusPart inPart) ;
150
151
152 // events
153
154 //ControlPartCode UMAHandleControlClick (ControlHandle inControl,
155 // Point inWhere,
156 // SInt16 inModifiers,
157 // ControlActionUPP inAction) ;
158 //SInt16 UMAHandleControlKey (ControlHandle inControl,
159 // SInt16 inKeyCode,
160 // SInt16 inCharCode,
161 // SInt16 inModifiers);
162
163 //void UMAIdleControls (WindowPtr inWindow) ;
164
165 void UMAUpdateControls( WindowPtr inWindow , RgnHandle inRgn ) ;
166 OSErr UMAGetRootControl( WindowPtr inWindow , ControlHandle *outControl ) ;
167
168 // handling control data
169 /*
170 OSErr ::SetControlData (ControlHandle inControl,
171 ControlPartCode inPart,
172 ResType inTagName,
173 Size inSize,
174 Ptr inData) ;
175
176 OSErr ::GetControlData (ControlHandle inControl,
177 ControlPartCode inPart,
178 ResType inTagName,
179 Size inBufferSize,
180 Ptr outBuffer,
181 Size * outActualSize) ;
182 OSErr ::GetControlDataSize (ControlHandle inControl,
183 ControlPartCode inPart,
184 ResType inTagName,
185 Size * outMaxSize);
186
187
188 // system 8.0
189
190 short UMAFindWindow( Point inPoint , WindowRef *outWindow ) ;
191 OSStatus UMAGetWindowFeatures( WindowRef inWindowRef , UInt32 *outFeatures ) ;
192 OSStatus UMAGetWindowRegion( WindowRef inWindowRef , WindowRegionCode inRegionCode , RgnHandle ioWinRgn ) ;
193 OSStatus UMACollapseWindow( WindowRef inWindowRef , Boolean inCollapseIt ) ;
194 OSStatus UMACollapseAllWindows( Boolean inCollapseEm ) ;
195 Boolean UMAIsWindowCollapsed( WindowRef inWindowRef ) ;
196 Boolean UMAIsWindowCollapsable( WindowRef inWindowRef ) ;
197
198 // system 8.5
199
200 OSStatus UMACreateNewWindow( WindowClass windowClass , WindowAttributes attributes , const Rect *bounds, WindowRef *outWindow ) ;
201 OSStatus UMAGetWindowClass( WindowRef inWindowRef , WindowClass *outWindowClass ) ;
202 OSStatus UMAGetWindowAttributes( WindowRef inWindowRef , WindowAttributes *outAttributes ) ;
203
204 void UMAShowFloatingWindows() ;
205 void UMAHideFloatingWindows() ;
206 Boolean UMAAreFloatingWindowsVisible() ;
207 WindowRef UMAFrontWindow() ;
208 WindowRef UMAFrontNonFloatingWindow() ;
209
210 // floaters support
211 */
212 bool UMAIsWindowFloating( WindowRef inWindow ) ;
213 bool UMAIsWindowModal( WindowRef inWindow ) ;
214 /*
215 WindowRef UMAGetActiveWindow() ;
216 WindowRef UMAGetActiveNonFloatingWindow() ;
217 */
218 void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate ) ;
219
220 OSStatus UMAGetHelpMenu(
221 MenuRef * outHelpMenu,
222 MenuItemIndex * outFirstCustomItemIndex); /* can be NULL */
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 #define GetControlOwner( control ) ((**control).contrlOwner)
240 #define InvalWindowRgn( window , rgn ) InvalRgn( rgn )
241 #define GetPortPenMode( p ) (p->pnMode)
242 #define SetPortPenMode( p , mode ) (p->pnMode = mode )
243 #define ClearCurrentScrap() ZeroScrap() ;
244 // control manager
245
246 #define GetControlReference( control ) ((**control).contrlRfCon)
247
248 // list manager
249
250 #define SetListSelectionFlags( list , options ) (**list).selFlags = options
251 #define GetListRefCon( list ) (**list).refCon
252
253 #endif
254 #if TARGET_CARBON
255 #define GetWindowUpdateRgn( inWindow , updateRgn ) GetWindowRegion( inWindow , kWindowUpdateRgn, updateRgn )
256 #endif
257 // Appearance Drawing
258
259 OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState ) ;
260
261 #endif