]>
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() ; | |
cfcc3671 UJ |
32 | |
33 | // process manager | |
34 | ||
35 | long UMAGetProcessMode() ; | |
36 | bool UMAGetProcessModeDoesActivateOnFGSwitch() ; | |
37 | ||
38 | // menu manager | |
39 | ||
05adb9d2 SC |
40 | void UMASetMenuTitle( MenuRef menu , StringPtr title ) ; |
41 | UInt32 UMAMenuEvent( EventRecord *inEvent ) ; | |
cfcc3671 UJ |
42 | void UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex item ) ; |
43 | void UMADisableMenuItem( MenuRef inMenu , MenuItemIndex item ) ; | |
05adb9d2 SC |
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 ) ; | |
72055702 | 48 | // void UMASetMenuItemText( MenuRef menu , MenuItemIndex item , StringPtr label ) ; |
05adb9d2 | 49 | |
72055702 SC |
50 | // MenuRef ::NewMenu( SInt16 menuid , StringPtr label ) ; |
51 | // void UMADisposeMenu( MenuRef menu ) ; | |
05adb9d2 SC |
52 | |
53 | // handling the menubar | |
54 | ||
72055702 SC |
55 | // void UMADeleteMenu( SInt16 menuId ) ; |
56 | // void UMAInsertMenu( MenuRef insertMenu , SInt16 afterId ) ; | |
57 | // void UMADrawMenuBar() ; | |
05adb9d2 | 58 | |
cfcc3671 UJ |
59 | // quickdraw |
60 | ||
61 | void UMAShowWatchCursor() ; | |
62 | void UMAShowArrowCursor() ; | |
63 | ||
93f0fe75 GD |
64 | #if TARGET_CARBON && PM_USE_SESSION_APIS |
65 | OSStatus UMAPrOpen(PMPrintSession *macPrintSession) ; | |
66 | OSStatus UMAPrClose(PMPrintSession *macPrintSession) ; | |
0ab25937 | 67 | #else |
5b781a67 SC |
68 | OSStatus UMAPrOpen() ; |
69 | OSStatus UMAPrClose() ; | |
0ab25937 | 70 | #endif |
05adb9d2 | 71 | |
cfcc3671 UJ |
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 ) ; | |
72055702 SC |
80 | //void UMAShowWindow( WindowRef inWindowRef ) ; |
81 | //void UMAHideWindow( WindowRef inWindowRef ) ; | |
cfcc3671 | 82 | void UMAShowHide( WindowRef inWindowRef , Boolean show) ; |
72055702 SC |
83 | //void UMASelectWindow( WindowRef inWindowRef ) ; |
84 | //void UMABringToFront( WindowRef inWindowRef ) ; | |
85 | //void UMASendBehind( WindowRef inWindowRef , WindowRef behindWindow ) ; | |
86 | // void UMACloseWindow(WindowRef inWindowRef) ; | |
cfcc3671 UJ |
87 | |
88 | // appearance manager | |
89 | ||
90 | void UMADrawControl( ControlHandle inControl ) ; | |
91 | ||
fdaf613a SC |
92 | void UMAEnableControl( ControlHandle inControl ) ; |
93 | void UMADisableControl( ControlHandle inControl ) ; | |
cfcc3671 UJ |
94 | void UMAActivateControl( ControlHandle inControl ) ; |
95 | void UMADeactivateControl( ControlHandle inControl ) ; | |
72055702 SC |
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, | |
cfcc3671 UJ |
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) ; | |
72055702 SC |
114 | */ |
115 | //void UMADisposeControl (ControlHandle theControl) ; | |
116 | //void UMAHiliteControl (ControlHandle theControl, | |
117 | // ControlPartCode hiliteState) ; | |
cfcc3671 | 118 | void UMAShowControl (ControlHandle theControl) ; |
72055702 SC |
119 | //void UMAHideControl (ControlHandle theControl); |
120 | //void UMASetControlVisibility (ControlHandle inControl, | |
121 | // Boolean inIsVisible, | |
122 | // Boolean inDoDraw); | |
cfcc3671 | 123 | |
72055702 SC |
124 | //bool UMAIsControlActive (ControlHandle inControl); |
125 | //bool UMAIsControlVisible (ControlHandle inControl); | |
cfcc3671 UJ |
126 | void UMAActivateControl (ControlHandle inControl); |
127 | void UMADeactivateControl (ControlHandle inControl); | |
128 | ||
72055702 SC |
129 | //OSErr UMAGetBestControlRect (ControlHandle inControl, |
130 | // Rect * outRect, | |
131 | // SInt16 * outBaseLineOffset); | |
132 | //OSErr UMASetControlFontStyle (ControlHandle inControl, | |
133 | // const ControlFontStyleRec * inStyle) ; | |
cfcc3671 UJ |
134 | |
135 | ||
136 | void UMAMoveControl( ControlHandle inControl , short x , short y ) ; | |
137 | void UMASizeControl( ControlHandle inControl , short x , short y ) ; | |
138 | // control hierarchy | |
139 | ||
72055702 SC |
140 | //OSErr UMACreateRootControl (WindowPtr inWindow, |
141 | // ControlHandle * outControl) ; | |
cfcc3671 | 142 | |
72055702 SC |
143 | //OSErr UMAEmbedControl (ControlHandle inControl, |
144 | // ControlHandle inContainer); | |
cfcc3671 UJ |
145 | |
146 | // keyboard focus | |
147 | OSErr UMASetKeyboardFocus (WindowPtr inWindow, | |
148 | ControlHandle inControl, | |
149 | ControlFocusPart inPart) ; | |
150 | ||
151 | ||
152 | // events | |
153 | ||
72055702 SC |
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); | |
cfcc3671 | 162 | |
72055702 | 163 | //void UMAIdleControls (WindowPtr inWindow) ; |
cfcc3671 UJ |
164 | |
165 | void UMAUpdateControls( WindowPtr inWindow , RgnHandle inRgn ) ; | |
166 | OSErr UMAGetRootControl( WindowPtr inWindow , ControlHandle *outControl ) ; | |
167 | ||
168 | // handling control data | |
72055702 SC |
169 | /* |
170 | OSErr ::SetControlData (ControlHandle inControl, | |
cfcc3671 UJ |
171 | ControlPartCode inPart, |
172 | ResType inTagName, | |
173 | Size inSize, | |
174 | Ptr inData) ; | |
175 | ||
72055702 | 176 | OSErr ::GetControlData (ControlHandle inControl, |
cfcc3671 UJ |
177 | ControlPartCode inPart, |
178 | ResType inTagName, | |
179 | Size inBufferSize, | |
180 | Ptr outBuffer, | |
181 | Size * outActualSize) ; | |
72055702 | 182 | OSErr ::GetControlDataSize (ControlHandle inControl, |
cfcc3671 UJ |
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 | |
72055702 | 211 | */ |
cfcc3671 UJ |
212 | bool UMAIsWindowFloating( WindowRef inWindow ) ; |
213 | bool UMAIsWindowModal( WindowRef inWindow ) ; | |
72055702 | 214 | /* |
cfcc3671 UJ |
215 | WindowRef UMAGetActiveWindow() ; |
216 | WindowRef UMAGetActiveNonFloatingWindow() ; | |
72055702 | 217 | */ |
cfcc3671 UJ |
218 | void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate ) ; |
219 | ||
05adb9d2 SC |
220 | #if !TARGET_CARBON |
221 | #define GetPortTextFont( p) ((p)->txFont ) | |
222 | #define GetPortTextSize( p) ((p)->txSize ) | |
223 | #define GetPortTextFace( p) ((p)->txFace ) | |
224 | #define GetPortTextMode( p) ((p)->txMode ) | |
225 | #define GetRegionBounds( r , b) ((*b) = (**r).rgnBBox) | |
226 | #define GetPortBounds( p , b) ((*b) = p->portRect ) | |
227 | #define GetWindowPortBounds( p , b) ((*b) = p->portRect ) | |
228 | #define GetPortVisibleRegion( p, r ) CopyRgn( p->visRgn , r ) | |
229 | #define GetQDGlobalsWhite( a ) (&((*a) = qd.white)) | |
230 | #define GetQDGlobalsBlack( a ) (&((*a) = qd.black)) | |
e42e45a9 | 231 | #define GetQDGlobalsScreenBits( a ) ((*a) = qd.screenBits) |
05adb9d2 | 232 | #define GetQDGlobalsArrow( a ) (&((*a) = qd.arrow)) |
c36f0244 | 233 | #define GetControlBounds( c , b ) &((*b) = (**c).contrlRect ) |
05adb9d2 | 234 | #define GetPortBitMapForCopyBits( p ) ((BitMap*) &(((CGrafPtr)p)->portPixMap )) |
e42e45a9 | 235 | #define GetControlOwner( control ) ((**control).contrlOwner) |
72055702 | 236 | #define InvalWindowRgn( window , rgn ) InvalRgn( rgn ) |
e42e45a9 SC |
237 | #define GetPortPenMode( p ) (p->pnMode) |
238 | #define SetPortPenMode( p , mode ) (p->pnMode = mode ) | |
239 | // control manager | |
240 | ||
241 | #define GetControlReference( control ) ((**control).contrlRfCon) | |
242 | ||
243 | // list manager | |
244 | ||
245 | #define SetListSelectionFlags( list , options ) (**list).selFlags = options | |
246 | #define GetListRefCon( list ) (**list).refCon | |
247 | ||
72055702 SC |
248 | #endif |
249 | #if TARGET_CARBON | |
250 | #define GetWindowUpdateRgn( inWindow , updateRgn ) GetWindowRegion( inWindow , kWindowUpdateRgn, updateRgn ) | |
05adb9d2 | 251 | #endif |
05adb9d2 SC |
252 | // Appearance Drawing |
253 | ||
254 | OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState ) ; | |
cfcc3671 | 255 | |
03e11df5 | 256 | #endif |