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