]>
Commit | Line | Data |
---|---|---|
cfcc3671 UJ |
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 | |
292d1a2f | 9 | // Licence: wxWindows licence |
cfcc3671 UJ |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef H_UMA | |
13 | #define H_UMA | |
14 | ||
6e040042 | 15 | #if defined(__POWERPC__) |
6e040042 | 16 | #if defined(__DARWIN__) |
03e11df5 GD |
17 | #include <Carbon/Carbon.h> |
18 | #endif | |
cfcc3671 UJ |
19 | #endif |
20 | ||
21 | #if !TARGET_CARBON | |
05adb9d2 SC |
22 | // this is now defined in the latest headers |
23 | // typedef short MenuItemIndex ; | |
cfcc3671 UJ |
24 | #endif |
25 | ||
26 | void UMAInitToolbox( UInt16 inMoreMastersCalls) ; | |
5b781a67 | 27 | void UMACleanupToolbox() ; |
cfcc3671 UJ |
28 | bool UMAHasAppearance() ; |
29 | long UMAGetAppearanceVersion() ; | |
72055702 SC |
30 | bool UMAHasWindowManager() ; |
31 | long UMAGetWindowManagerAttr() ; | |
78c0e83b | 32 | bool UMAHasAquaLayout() ; |
cfcc3671 UJ |
33 | |
34 | // process manager | |
35 | ||
36 | long UMAGetProcessMode() ; | |
37 | bool UMAGetProcessModeDoesActivateOnFGSwitch() ; | |
38 | ||
39 | // menu manager | |
40 | ||
05adb9d2 SC |
41 | void UMASetMenuTitle( MenuRef menu , StringPtr title ) ; |
42 | UInt32 UMAMenuEvent( EventRecord *inEvent ) ; | |
cfcc3671 UJ |
43 | void UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex item ) ; |
44 | void UMADisableMenuItem( MenuRef inMenu , MenuItemIndex item ) ; | |
05adb9d2 SC |
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 ) ; | |
72055702 | 49 | // void UMASetMenuItemText( MenuRef menu , MenuItemIndex item , StringPtr label ) ; |
05adb9d2 | 50 | |
72055702 SC |
51 | // MenuRef ::NewMenu( SInt16 menuid , StringPtr label ) ; |
52 | // void UMADisposeMenu( MenuRef menu ) ; | |
05adb9d2 SC |
53 | |
54 | // handling the menubar | |
55 | ||
72055702 SC |
56 | // void UMADeleteMenu( SInt16 menuId ) ; |
57 | // void UMAInsertMenu( MenuRef insertMenu , SInt16 afterId ) ; | |
58 | // void UMADrawMenuBar() ; | |
05adb9d2 | 59 | |
cfcc3671 UJ |
60 | // quickdraw |
61 | ||
62 | void UMAShowWatchCursor() ; | |
63 | void UMAShowArrowCursor() ; | |
64 | ||
93f0fe75 GD |
65 | #if TARGET_CARBON && PM_USE_SESSION_APIS |
66 | OSStatus UMAPrOpen(PMPrintSession *macPrintSession) ; | |
67 | OSStatus UMAPrClose(PMPrintSession *macPrintSession) ; | |
0ab25937 | 68 | #else |
5b781a67 SC |
69 | OSStatus UMAPrOpen() ; |
70 | OSStatus UMAPrClose() ; | |
0ab25937 | 71 | #endif |
05adb9d2 | 72 | |
cfcc3671 UJ |
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 ) ; | |
72055702 SC |
81 | //void UMAShowWindow( WindowRef inWindowRef ) ; |
82 | //void UMAHideWindow( WindowRef inWindowRef ) ; | |
cfcc3671 | 83 | void UMAShowHide( WindowRef inWindowRef , Boolean show) ; |
72055702 SC |
84 | //void UMASelectWindow( WindowRef inWindowRef ) ; |
85 | //void UMABringToFront( WindowRef inWindowRef ) ; | |
86 | //void UMASendBehind( WindowRef inWindowRef , WindowRef behindWindow ) ; | |
87 | // void UMACloseWindow(WindowRef inWindowRef) ; | |
cfcc3671 UJ |
88 | |
89 | // appearance manager | |
90 | ||
91 | void UMADrawControl( ControlHandle inControl ) ; | |
92 | ||
fdaf613a SC |
93 | void UMAEnableControl( ControlHandle inControl ) ; |
94 | void UMADisableControl( ControlHandle inControl ) ; | |
cfcc3671 UJ |
95 | void UMAActivateControl( ControlHandle inControl ) ; |
96 | void UMADeactivateControl( ControlHandle inControl ) ; | |
72055702 SC |
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, | |
cfcc3671 UJ |
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) ; | |
72055702 SC |
115 | */ |
116 | //void UMADisposeControl (ControlHandle theControl) ; | |
117 | //void UMAHiliteControl (ControlHandle theControl, | |
118 | // ControlPartCode hiliteState) ; | |
cfcc3671 | 119 | void UMAShowControl (ControlHandle theControl) ; |
efaf6efc | 120 | void UMAHideControl (ControlHandle theControl); |
72055702 SC |
121 | //void UMASetControlVisibility (ControlHandle inControl, |
122 | // Boolean inIsVisible, | |
123 | // Boolean inDoDraw); | |
cfcc3671 | 124 | |
72055702 SC |
125 | //bool UMAIsControlActive (ControlHandle inControl); |
126 | //bool UMAIsControlVisible (ControlHandle inControl); | |
cfcc3671 UJ |
127 | void UMAActivateControl (ControlHandle inControl); |
128 | void UMADeactivateControl (ControlHandle inControl); | |
129 | ||
72055702 SC |
130 | //OSErr UMAGetBestControlRect (ControlHandle inControl, |
131 | // Rect * outRect, | |
132 | // SInt16 * outBaseLineOffset); | |
133 | //OSErr UMASetControlFontStyle (ControlHandle inControl, | |
134 | // const ControlFontStyleRec * inStyle) ; | |
cfcc3671 UJ |
135 | |
136 | ||
137 | void UMAMoveControl( ControlHandle inControl , short x , short y ) ; | |
138 | void UMASizeControl( ControlHandle inControl , short x , short y ) ; | |
139 | // control hierarchy | |
140 | ||
72055702 SC |
141 | //OSErr UMACreateRootControl (WindowPtr inWindow, |
142 | // ControlHandle * outControl) ; | |
cfcc3671 | 143 | |
72055702 SC |
144 | //OSErr UMAEmbedControl (ControlHandle inControl, |
145 | // ControlHandle inContainer); | |
cfcc3671 UJ |
146 | |
147 | // keyboard focus | |
148 | OSErr UMASetKeyboardFocus (WindowPtr inWindow, | |
149 | ControlHandle inControl, | |
150 | ControlFocusPart inPart) ; | |
151 | ||
152 | ||
153 | // events | |
154 | ||
72055702 SC |
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); | |
cfcc3671 | 163 | |
72055702 | 164 | //void UMAIdleControls (WindowPtr inWindow) ; |
cfcc3671 UJ |
165 | |
166 | void UMAUpdateControls( WindowPtr inWindow , RgnHandle inRgn ) ; | |
167 | OSErr UMAGetRootControl( WindowPtr inWindow , ControlHandle *outControl ) ; | |
168 | ||
169 | // handling control data | |
72055702 SC |
170 | /* |
171 | OSErr ::SetControlData (ControlHandle inControl, | |
cfcc3671 UJ |
172 | ControlPartCode inPart, |
173 | ResType inTagName, | |
174 | Size inSize, | |
175 | Ptr inData) ; | |
176 | ||
72055702 | 177 | OSErr ::GetControlData (ControlHandle inControl, |
cfcc3671 UJ |
178 | ControlPartCode inPart, |
179 | ResType inTagName, | |
180 | Size inBufferSize, | |
181 | Ptr outBuffer, | |
182 | Size * outActualSize) ; | |
72055702 | 183 | OSErr ::GetControlDataSize (ControlHandle inControl, |
cfcc3671 UJ |
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 | |
72055702 | 212 | */ |
cfcc3671 UJ |
213 | bool UMAIsWindowFloating( WindowRef inWindow ) ; |
214 | bool UMAIsWindowModal( WindowRef inWindow ) ; | |
72055702 | 215 | /* |
cfcc3671 UJ |
216 | WindowRef UMAGetActiveWindow() ; |
217 | WindowRef UMAGetActiveNonFloatingWindow() ; | |
72055702 | 218 | */ |
cfcc3671 UJ |
219 | void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate ) ; |
220 | ||
56a38bbe SC |
221 | OSStatus UMAGetHelpMenu( |
222 | MenuRef * outHelpMenu, | |
223 | MenuItemIndex * outFirstCustomItemIndex); /* can be NULL */ | |
224 | ||
05adb9d2 SC |
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)) | |
e42e45a9 | 236 | #define GetQDGlobalsScreenBits( a ) ((*a) = qd.screenBits) |
05adb9d2 | 237 | #define GetQDGlobalsArrow( a ) (&((*a) = qd.arrow)) |
c36f0244 | 238 | #define GetControlBounds( c , b ) &((*b) = (**c).contrlRect ) |
05adb9d2 | 239 | #define GetPortBitMapForCopyBits( p ) ((BitMap*) &(((CGrafPtr)p)->portPixMap )) |
e42e45a9 | 240 | #define GetControlOwner( control ) ((**control).contrlOwner) |
72055702 | 241 | #define InvalWindowRgn( window , rgn ) InvalRgn( rgn ) |
e42e45a9 SC |
242 | #define GetPortPenMode( p ) (p->pnMode) |
243 | #define SetPortPenMode( p , mode ) (p->pnMode = mode ) | |
419f362d | 244 | #define ClearCurrentScrap() ZeroScrap() ; |
e42e45a9 SC |
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 | ||
72055702 SC |
254 | #endif |
255 | #if TARGET_CARBON | |
256 | #define GetWindowUpdateRgn( inWindow , updateRgn ) GetWindowRegion( inWindow , kWindowUpdateRgn, updateRgn ) | |
05adb9d2 | 257 | #endif |
05adb9d2 SC |
258 | // Appearance Drawing |
259 | ||
260 | OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState ) ; | |
cfcc3671 | 261 | |
03e11df5 | 262 | #endif |