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