]>
Commit | Line | Data |
---|---|---|
03e11df5 | 1 | #include "wx/defs.h" |
5fde6fcc | 2 | #include "wx/dc.h" |
03e11df5 GD |
3 | #include "wx/mac/uma.h" |
4 | #include "wx/mac/aga.h" | |
72e7876b | 5 | |
03e11df5 | 6 | #ifdef __UNIX__ |
5fde6fcc | 7 | #include <Carbon/Carbon.h> |
03e11df5 GD |
8 | #else |
9 | #include <Navigation.h> | |
10 | #endif | |
5b781a67 | 11 | |
72e7876b SC |
12 | // init |
13 | ||
14 | static bool sUMAHasAppearance = false ; | |
15 | static long sUMAAppearanceVersion = 0 ; | |
16 | extern int gAGABackgroundColor ; | |
17 | bool UMAHasAppearance() { return sUMAHasAppearance ; } | |
18 | long UMAGetAppearanceVersion() { return sUMAAppearanceVersion ; } | |
19 | ||
20 | static bool sUMAHasWindowManager = false ; | |
21 | static long sUMAWindowManagerAttr = 0 ; | |
22 | ||
23 | bool UMAHasWindowManager() { return sUMAHasWindowManager ; } | |
24 | long UMAGetWindowManagerAttr() { return sUMAWindowManagerAttr ; } | |
5b781a67 SC |
25 | void UMACleanupToolbox() |
26 | { | |
27 | #if UMA_USE_APPEARANCE | |
28 | if ( sUMAHasAppearance ) | |
29 | { | |
30 | UnregisterAppearanceClient() ; | |
31 | } | |
32 | #endif | |
33 | if ( NavServicesAvailable() ) | |
34 | { | |
35 | NavUnload() ; | |
36 | } | |
37 | } | |
72e7876b SC |
38 | void UMAInitToolbox( UInt16 inMoreMastersCalls ) |
39 | { | |
40 | #if !TARGET_CARBON | |
41 | ::MaxApplZone(); | |
42 | for (long i = 1; i <= inMoreMastersCalls; i++) | |
43 | ::MoreMasters(); | |
44 | ||
45 | ::InitGraf(&qd.thePort); | |
46 | ::InitFonts(); | |
72e7876b SC |
47 | ::InitMenus(); |
48 | ::TEInit(); | |
49 | ::InitDialogs(0L); | |
50 | ::FlushEvents(everyEvent, 0); | |
51 | ::InitCursor(); | |
52 | long total,contig; | |
53 | PurgeSpace(&total, &contig); | |
54 | #else | |
2f1ae414 | 55 | InitCursor(); |
72e7876b SC |
56 | #endif |
57 | ||
58 | #if UMA_USE_APPEARANCE | |
59 | long theAppearance ; | |
60 | if ( Gestalt( gestaltAppearanceAttr, &theAppearance ) == noErr ) | |
61 | { | |
62 | sUMAHasAppearance = true ; | |
63 | RegisterAppearanceClient(); | |
64 | if ( Gestalt( gestaltAppearanceVersion, &theAppearance ) == noErr ) | |
65 | { | |
66 | sUMAAppearanceVersion = theAppearance ; | |
67 | } | |
68 | else | |
69 | { | |
70 | sUMAAppearanceVersion = 0x0100 ; | |
71 | } | |
72 | } | |
73 | #endif // UMA_USE_APPEARANCE | |
74 | #if UMA_USE_8_6 | |
75 | #if UMA_USE_WINDOWMGR | |
76 | if ( Gestalt( gestaltWindowMgrAttr, &sUMAWindowManagerAttr ) == noErr ) | |
77 | { | |
78 | sUMAHasWindowManager = sUMAWindowManagerAttr & gestaltWindowMgrPresent ; | |
79 | } | |
80 | #endif // UMA_USE_WINDOWMGR | |
81 | #endif | |
5b781a67 | 82 | |
03e11df5 | 83 | #ifndef __UNIX__ |
8e8d3ba8 SC |
84 | #if TARGET_CARBON |
85 | // Call currently implicitely done : InitFloatingWindows() ; | |
86 | #else | |
5b781a67 SC |
87 | if ( sUMAHasWindowManager ) |
88 | InitFloatingWindows() ; | |
89 | else | |
90 | InitWindows(); | |
8e8d3ba8 | 91 | #endif |
03e11df5 | 92 | #endif |
5b781a67 SC |
93 | |
94 | if ( NavServicesAvailable() ) | |
95 | { | |
96 | NavLoad() ; | |
97 | } | |
72e7876b SC |
98 | } |
99 | ||
100 | // process manager | |
101 | long UMAGetProcessMode() | |
102 | { | |
103 | OSErr err ; | |
104 | ProcessInfoRec processinfo; | |
105 | ProcessSerialNumber procno ; | |
106 | ||
107 | procno.highLongOfPSN = NULL ; | |
108 | procno.lowLongOfPSN = kCurrentProcess ; | |
109 | processinfo.processInfoLength = sizeof(ProcessInfoRec); | |
110 | processinfo.processName = NULL; | |
111 | processinfo.processAppSpec = NULL; | |
112 | ||
113 | err = ::GetProcessInformation( &procno , &processinfo ) ; | |
114 | wxASSERT( err == noErr ) ; | |
115 | return processinfo.processMode ; | |
116 | } | |
117 | ||
118 | bool UMAGetProcessModeDoesActivateOnFGSwitch() | |
119 | { | |
120 | return UMAGetProcessMode() & modeDoesActivateOnFGSwitch ; | |
121 | } | |
122 | ||
123 | // menu manager | |
124 | ||
2f1ae414 | 125 | void UMASetMenuTitle( MenuRef menu , StringPtr title ) |
72e7876b SC |
126 | { |
127 | #if !TARGET_CARBON | |
128 | long size = GetHandleSize( (Handle) menu ) ; | |
129 | const long headersize = 14 ; | |
130 | int oldlen = (**menu).menuData[0] + 1; | |
131 | int newlen = title[0] + 1 ; | |
132 | ||
133 | if ( oldlen < newlen ) | |
134 | { | |
135 | // enlarge before adjusting | |
136 | SetHandleSize( (Handle) menu , size + (newlen - oldlen ) ); | |
137 | } | |
138 | ||
139 | if ( oldlen != newlen ) | |
140 | memmove( (char*) (**menu).menuData + newlen , (char*) (**menu).menuData + oldlen , size - headersize - oldlen ) ; | |
141 | ||
142 | memcpy( (char*) (**menu).menuData , title , newlen ) ; | |
143 | if ( oldlen > newlen ) | |
144 | { | |
145 | // shrink after | |
146 | SetHandleSize( (Handle) menu , size + (newlen - oldlen ) ) ; | |
147 | } | |
148 | #else | |
149 | SetMenuTitle( menu , title ) ; | |
150 | #endif | |
151 | } | |
152 | ||
153 | UInt32 UMAMenuEvent( EventRecord *inEvent ) | |
154 | { | |
2f1ae414 | 155 | #if UMA_USE_APPEARANCE |
72e7876b SC |
156 | if ( UMAHasAppearance() ) |
157 | { | |
158 | return MenuEvent( inEvent ) ; | |
159 | } | |
160 | else | |
2f1ae414 | 161 | #endif |
72e7876b SC |
162 | { |
163 | if ( inEvent->what == keyDown && inEvent->modifiers & cmdKey) | |
164 | { | |
165 | return MenuKey( inEvent->message & charCodeMask ) ; | |
166 | } | |
167 | return NULL ; | |
168 | } | |
169 | } | |
170 | ||
171 | void UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex inItem ) | |
172 | { | |
2f1ae414 | 173 | #if UMA_USE_8_6 || TARGET_CARBON |
72e7876b SC |
174 | EnableMenuItem( inMenu , inItem ) ; |
175 | #else | |
176 | EnableItem( inMenu , inItem ) ; | |
177 | #endif | |
178 | } | |
179 | ||
180 | void UMADisableMenuItem( MenuRef inMenu , MenuItemIndex inItem ) | |
181 | { | |
2f1ae414 | 182 | #if UMA_USE_8_6 || TARGET_CARBON |
72e7876b SC |
183 | DisableMenuItem( inMenu , inItem ) ; |
184 | #else | |
185 | DisableItem( inMenu , inItem ) ; | |
186 | #endif | |
187 | } | |
2f1ae414 SC |
188 | |
189 | void UMAAppendSubMenuItem( MenuRef menu , StringPtr l , SInt16 id ) | |
190 | { | |
191 | Str255 label ; | |
192 | memcpy( label , l , l[0]+1 ) ; | |
193 | // hardcoded adding of the submenu combination for mac | |
194 | ||
195 | int theEnd = label[0] + 1; | |
196 | if (theEnd > 251) | |
197 | theEnd = 251; // mac allows only 255 characters | |
198 | label[theEnd++] = '/'; | |
199 | label[theEnd++] = hMenuCmd; | |
200 | label[theEnd++] = '!'; | |
201 | label[theEnd++] = id ; | |
202 | label[theEnd] = 0x00; | |
203 | label[0] = theEnd; | |
204 | MacAppendMenu(menu, label); | |
205 | } | |
206 | ||
207 | void UMAInsertSubMenuItem( MenuRef menu , StringPtr l , MenuItemIndex item , SInt16 id ) | |
208 | { | |
209 | Str255 label ; | |
210 | memcpy( label , l , l[0]+1 ) ; | |
211 | // hardcoded adding of the submenu combination for mac | |
212 | ||
213 | int theEnd = label[0] + 1; | |
214 | if (theEnd > 251) | |
215 | theEnd = 251; // mac allows only 255 characters | |
216 | label[theEnd++] = '/'; | |
217 | label[theEnd++] = hMenuCmd; | |
218 | label[theEnd++] = '!'; | |
219 | label[theEnd++] = id; | |
220 | label[theEnd] = 0x00; | |
221 | label[0] = theEnd; | |
222 | MacInsertMenuItem(menu, label , item); | |
223 | } | |
224 | ||
225 | void UMAAppendMenuItem( MenuRef menu , StringPtr l , SInt16 key, UInt8 modifiers ) | |
226 | { | |
227 | Str255 label ; | |
228 | memcpy( label , l , l[0]+1 ) ; | |
229 | if ( key ) | |
230 | { | |
231 | int pos = label[0] ; | |
232 | label[++pos] = '/'; | |
233 | label[++pos] = toupper( key ); | |
234 | label[0] = pos ; | |
235 | } | |
236 | MacAppendMenu( menu , label ) ; | |
237 | } | |
238 | ||
239 | void UMAInsertMenuItem( MenuRef menu , StringPtr l , MenuItemIndex item , SInt16 key, UInt8 modifiers ) | |
240 | { | |
241 | Str255 label ; | |
242 | memcpy( label , l , l[0]+1 ) ; | |
243 | if ( key ) | |
244 | { | |
245 | int pos = label[0] ; | |
246 | label[++pos] = '/'; | |
247 | label[++pos] = toupper( key ); | |
248 | label[0] = pos ; | |
249 | } | |
250 | MacInsertMenuItem( menu , label , item) ; | |
251 | } | |
252 | ||
253 | void UMADrawMenuBar() | |
254 | { | |
255 | DrawMenuBar() ; | |
256 | } | |
257 | ||
258 | ||
259 | void UMASetMenuItemText( MenuRef menu , MenuItemIndex item , StringPtr label ) | |
260 | { | |
261 | ::SetMenuItemText( menu , item , label ) ; | |
262 | } | |
263 | ||
264 | MenuRef UMANewMenu( SInt16 menuid , StringPtr label ) | |
265 | { | |
266 | return ::NewMenu(menuid, label); | |
267 | } | |
268 | ||
269 | void UMADisposeMenu( MenuRef menu ) | |
270 | { | |
271 | DisposeMenu( menu ) ; | |
272 | } | |
273 | void UMADeleteMenu( SInt16 menuId ) | |
274 | { | |
275 | ::DeleteMenu( menuId ) ; | |
276 | } | |
277 | ||
278 | void UMAInsertMenu( MenuRef insertMenu , SInt16 afterId ) | |
279 | { | |
280 | ::InsertMenu( insertMenu , afterId ) ; | |
281 | } | |
282 | ||
283 | ||
72e7876b SC |
284 | // quickdraw |
285 | ||
2f1ae414 SC |
286 | int gPrOpenCounter = 0 ; |
287 | ||
5b781a67 | 288 | OSStatus UMAPrOpen() |
2f1ae414 SC |
289 | { |
290 | #if !TARGET_CARBON | |
291 | OSErr err = noErr ; | |
292 | ++gPrOpenCounter ; | |
293 | if ( gPrOpenCounter == 1 ) | |
294 | { | |
295 | PrOpen() ; | |
296 | err = PrError() ; | |
297 | wxASSERT( err == noErr ) ; | |
298 | } | |
5b781a67 | 299 | return err ; |
2f1ae414 | 300 | #else |
5b781a67 SC |
301 | OSStatus err = noErr ; |
302 | ++gPrOpenCounter ; | |
303 | if ( gPrOpenCounter == 1 ) | |
304 | { | |
305 | err = PMBegin() ; | |
306 | wxASSERT( err == noErr ) ; | |
307 | } | |
308 | return err ; | |
2f1ae414 SC |
309 | #endif |
310 | } | |
311 | ||
5b781a67 | 312 | OSStatus UMAPrClose() |
2f1ae414 SC |
313 | { |
314 | #if !TARGET_CARBON | |
315 | OSErr err = noErr ; | |
316 | wxASSERT( gPrOpenCounter >= 1 ) ; | |
317 | if ( gPrOpenCounter == 1 ) | |
318 | { | |
319 | PrClose() ; | |
320 | err = PrError() ; | |
321 | wxASSERT( err == noErr ) ; | |
322 | } | |
323 | --gPrOpenCounter ; | |
5b781a67 | 324 | return err ; |
2f1ae414 | 325 | #else |
5b781a67 SC |
326 | OSStatus err = noErr ; |
327 | wxASSERT( gPrOpenCounter >= 1 ) ; | |
328 | if ( gPrOpenCounter == 1 ) | |
329 | { | |
330 | err = PMEnd() ; | |
331 | } | |
332 | --gPrOpenCounter ; | |
333 | return err ; | |
2f1ae414 SC |
334 | #endif |
335 | } | |
336 | ||
72e7876b SC |
337 | #if !TARGET_CARBON |
338 | ||
339 | pascal QDGlobalsPtr GetQDGlobalsPtr (void) | |
340 | { | |
341 | return QDGlobalsPtr (* (Ptr*) LMGetCurrentA5 ( ) - 0xCA); | |
342 | } | |
343 | ||
344 | #endif | |
345 | ||
346 | void UMAShowWatchCursor() | |
347 | { | |
348 | OSErr err = noErr; | |
349 | ||
350 | CursHandle watchFob = GetCursor (watchCursor); | |
351 | ||
352 | if (!watchFob) | |
353 | err = nilHandleErr; | |
354 | else | |
355 | { | |
356 | #if TARGET_CARBON | |
357 | Cursor preservedArrow; | |
358 | GetQDGlobalsArrow (&preservedArrow); | |
359 | SetQDGlobalsArrow (*watchFob); | |
360 | InitCursor ( ); | |
361 | SetQDGlobalsArrow (&preservedArrow); | |
362 | #else | |
363 | SetCursor (*watchFob); | |
364 | #endif | |
365 | } | |
366 | } | |
367 | ||
368 | void UMAShowArrowCursor() | |
369 | { | |
370 | #if TARGET_CARBON | |
371 | Cursor arrow; | |
372 | SetCursor (GetQDGlobalsArrow (&arrow)); | |
373 | #else | |
374 | SetCursor (&(qd.arrow)); | |
375 | #endif | |
376 | } | |
377 | ||
378 | // window manager | |
379 | ||
380 | GrafPtr UMAGetWindowPort( WindowRef inWindowRef ) | |
381 | { | |
382 | wxASSERT( inWindowRef != NULL ) ; | |
383 | #if TARGET_CARBON | |
384 | return GetWindowPort( inWindowRef ) ; | |
385 | #else | |
386 | return (GrafPtr) inWindowRef ; | |
387 | #endif | |
388 | } | |
389 | ||
390 | void UMADisposeWindow( WindowRef inWindowRef ) | |
391 | { | |
392 | wxASSERT( inWindowRef != NULL ) ; | |
393 | DisposeWindow( inWindowRef ) ; | |
394 | } | |
395 | ||
396 | void UMASetWTitleC( WindowRef inWindowRef , const char *title ) | |
397 | { | |
398 | Str255 ptitle ; | |
399 | strncpy( (char*)ptitle , title , 96 ) ; | |
400 | ptitle[96] = 0 ; | |
03e11df5 GD |
401 | #if TARGET_CARBON |
402 | c2pstrcpy( ptitle, (char *)ptitle ) ; | |
403 | #else | |
72e7876b | 404 | c2pstr( (char*)ptitle ) ; |
03e11df5 | 405 | #endif |
72e7876b SC |
406 | SetWTitle( inWindowRef , ptitle ) ; |
407 | } | |
03e11df5 | 408 | |
72e7876b SC |
409 | void UMAGetWTitleC( WindowRef inWindowRef , char *title ) |
410 | { | |
411 | GetWTitle( inWindowRef , (unsigned char*)title ) ; | |
03e11df5 GD |
412 | #if TARGET_CARBON |
413 | p2cstrcpy( title, (unsigned char *)title ) ; | |
414 | #else | |
72e7876b | 415 | p2cstr( (unsigned char*)title ) ; |
03e11df5 | 416 | #endif |
72e7876b SC |
417 | } |
418 | ||
419 | void UMAShowWindow( WindowRef inWindowRef ) | |
420 | { | |
421 | ShowWindow( inWindowRef ) ; | |
422 | } | |
423 | ||
424 | void UMAHideWindow( WindowRef inWindowRef ) | |
425 | { | |
426 | HideWindow( inWindowRef) ; | |
427 | } | |
428 | ||
429 | void UMASelectWindow( WindowRef inWindowRef ) | |
430 | { | |
431 | SelectWindow( inWindowRef ) ; | |
432 | } | |
433 | ||
434 | void UMABringToFront( WindowRef inWindowRef ) | |
435 | { | |
436 | BringToFront( inWindowRef ) ; | |
437 | } | |
438 | ||
439 | void UMASendBehind( WindowRef inWindowRef , WindowRef behindWindow ) | |
440 | { | |
441 | SendBehind( inWindowRef , behindWindow ) ; | |
442 | } | |
443 | ||
444 | void UMACloseWindow(WindowRef inWindowRef) | |
445 | { | |
446 | #if TARGET_CARBON | |
447 | #else | |
448 | CloseWindow( inWindowRef ) ; | |
449 | #endif | |
450 | } | |
451 | ||
452 | // appearance additions | |
453 | ||
454 | void UMAActivateControl( ControlHandle inControl ) | |
455 | { | |
2f1ae414 | 456 | #if UMA_USE_APPEARANCE |
72e7876b SC |
457 | if ( UMAHasAppearance() ) |
458 | { | |
459 | ::ActivateControl( inControl ) ; | |
460 | } | |
461 | else | |
2f1ae414 SC |
462 | #endif |
463 | #if !TARGET_CARBON | |
72e7876b SC |
464 | { |
465 | AGAActivateControl( inControl ) ; | |
466 | } | |
2f1ae414 SC |
467 | #else |
468 | { | |
469 | } | |
470 | #endif | |
72e7876b SC |
471 | } |
472 | ||
473 | void UMADrawControl( ControlHandle inControl ) | |
474 | { | |
2f1ae414 | 475 | #if UMA_USE_APPEARANCE |
72e7876b SC |
476 | if ( UMAHasAppearance() ) |
477 | { | |
478 | ::DrawControlInCurrentPort( inControl ) ; | |
479 | } | |
480 | else | |
2f1ae414 SC |
481 | #endif |
482 | #if !TARGET_CARBON | |
72e7876b SC |
483 | { |
484 | AGADrawControl( inControl ) ; | |
485 | } | |
2f1ae414 SC |
486 | #else |
487 | { | |
488 | } | |
489 | #endif | |
72e7876b SC |
490 | } |
491 | ||
492 | void UMAMoveControl( ControlHandle inControl , short x , short y ) | |
493 | { | |
2f1ae414 | 494 | #if UMA_USE_APPEARANCE |
72e7876b SC |
495 | if ( UMAHasAppearance() ) |
496 | { | |
497 | ::MoveControl( inControl , x , y ) ; | |
498 | } | |
499 | else | |
2f1ae414 SC |
500 | #endif |
501 | #if !TARGET_CARBON | |
72e7876b SC |
502 | { |
503 | AGAMoveControl( inControl , x ,y ) ; | |
504 | } | |
2f1ae414 SC |
505 | #else |
506 | { | |
507 | } | |
508 | #endif | |
72e7876b SC |
509 | } |
510 | ||
511 | void UMASizeControl( ControlHandle inControl , short x , short y ) | |
512 | { | |
2f1ae414 | 513 | #if UMA_USE_APPEARANCE |
72e7876b SC |
514 | if ( UMAHasAppearance() ) |
515 | { | |
516 | ::SizeControl( inControl , x , y ) ; | |
517 | } | |
518 | else | |
2f1ae414 SC |
519 | #endif |
520 | #if !TARGET_CARBON | |
72e7876b SC |
521 | { |
522 | AGASizeControl( inControl , x ,y ) ; | |
523 | } | |
2f1ae414 SC |
524 | #else |
525 | { | |
526 | } | |
527 | #endif | |
72e7876b SC |
528 | } |
529 | ||
530 | void UMADeactivateControl( ControlHandle inControl ) | |
531 | { | |
2f1ae414 | 532 | #if UMA_USE_APPEARANCE |
72e7876b SC |
533 | if ( UMAHasAppearance() ) |
534 | { | |
535 | ::DeactivateControl( inControl ) ; | |
536 | } | |
537 | else | |
2f1ae414 SC |
538 | #endif |
539 | #if !TARGET_CARBON | |
72e7876b SC |
540 | { |
541 | AGADeactivateControl( inControl ) ; | |
542 | } | |
2f1ae414 SC |
543 | #else |
544 | { | |
545 | } | |
546 | #endif | |
72e7876b SC |
547 | } |
548 | ||
549 | void UMASetThemeWindowBackground (WindowRef inWindow, | |
550 | ThemeBrush inBrush, | |
2f1ae414 SC |
551 | Boolean inUpdate) |
552 | { | |
553 | #if UMA_USE_APPEARANCE | |
72e7876b SC |
554 | if ( UMAHasAppearance() ) |
555 | { | |
556 | ::SetThemeWindowBackground( inWindow ,inBrush , inUpdate ) ; | |
557 | } | |
558 | else | |
2f1ae414 SC |
559 | #endif |
560 | #if !TARGET_CARBON | |
72e7876b SC |
561 | { |
562 | AGASetThemeWindowBackground( inWindow , inBrush , inUpdate ) ; | |
563 | } | |
2f1ae414 SC |
564 | #else |
565 | { | |
566 | } | |
567 | #endif | |
72e7876b SC |
568 | } |
569 | ||
2f1ae414 SC |
570 | void UMAApplyThemeBackground (ThemeBackgroundKind inKind, |
571 | const Rect * bounds, | |
572 | ThemeDrawState inState, | |
573 | SInt16 inDepth, | |
574 | Boolean inColorDev) | |
575 | { | |
576 | #if UMA_USE_APPEARANCE | |
577 | if ( UMAHasAppearance() ) | |
578 | { | |
579 | /* | |
580 | if ( sUMAAppearanceVersion >= 0x0110 ) | |
581 | ::ApplyThemeBackground( inKind ,bounds , inState , inDepth , inColorDev ) ; | |
582 | */ | |
583 | } | |
584 | else | |
585 | #endif | |
586 | #if !TARGET_CARBON | |
587 | { | |
588 | AGAApplyThemeBackground( inKind ,bounds , inState , inDepth , inColorDev ) ; | |
589 | } | |
590 | #else | |
591 | { | |
592 | } | |
593 | #endif | |
594 | } | |
72e7876b SC |
595 | |
596 | ControlHandle UMANewControl(WindowPtr owningWindow, | |
597 | const Rect * boundsRect, | |
598 | ConstStr255Param controlTitle, | |
599 | Boolean initiallyVisible, | |
600 | SInt16 initialValue, | |
601 | SInt16 minimumValue, | |
602 | SInt16 maximumValue, | |
603 | SInt16 procID, | |
604 | SInt32 controlReference) | |
605 | { | |
606 | ControlHandle theControl = NULL ; | |
2f1ae414 | 607 | #if UMA_USE_APPEARANCE |
72e7876b SC |
608 | if ( UMAHasAppearance() ) |
609 | { | |
610 | theControl = NewControl( owningWindow , boundsRect , controlTitle , initiallyVisible , | |
611 | initialValue , minimumValue , maximumValue , procID , controlReference ) ; | |
612 | } | |
613 | else | |
2f1ae414 SC |
614 | #endif |
615 | #if !TARGET_CARBON | |
72e7876b SC |
616 | { |
617 | theControl = AGANewControl( owningWindow , boundsRect , controlTitle , initiallyVisible , | |
618 | initialValue , minimumValue , maximumValue , procID , controlReference ) ; | |
619 | } | |
2f1ae414 SC |
620 | #else |
621 | { | |
622 | } | |
623 | #endif | |
72e7876b SC |
624 | return theControl ; |
625 | } | |
626 | ||
627 | void UMADisposeControl (ControlHandle theControl) | |
628 | { | |
629 | if ( UMAHasAppearance() ) | |
630 | { | |
631 | ::DisposeControl( theControl ) ; | |
632 | } | |
633 | else | |
634 | { | |
635 | ::DisposeControl( theControl ) ; | |
636 | } | |
637 | } | |
638 | ||
639 | ||
640 | void UMAHiliteControl (ControlHandle theControl, | |
641 | ControlPartCode hiliteState) | |
642 | { | |
643 | if ( UMAHasAppearance() ) | |
644 | { | |
645 | ::HiliteControl( theControl , hiliteState ) ; | |
646 | } | |
647 | else | |
648 | { | |
649 | ::HiliteControl( theControl , hiliteState ) ; | |
650 | } | |
651 | } | |
652 | ||
653 | ||
654 | void UMAShowControl (ControlHandle theControl) | |
655 | { | |
656 | if ( UMAHasAppearance() ) | |
657 | { | |
658 | ::ShowControl( theControl ) ; | |
659 | } | |
660 | else | |
661 | { | |
662 | ::ShowControl( theControl ) ; | |
663 | } | |
664 | } | |
665 | ||
666 | ||
667 | void UMAHideControl (ControlHandle theControl) | |
668 | { | |
669 | if ( UMAHasAppearance() ) | |
670 | { | |
c809f3be | 671 | ::HideControl( theControl ) ; |
72e7876b SC |
672 | } |
673 | else | |
674 | { | |
c809f3be | 675 | ::HideControl( theControl ) ; |
72e7876b SC |
676 | } |
677 | } | |
678 | ||
679 | ||
680 | void UMASetControlVisibility (ControlHandle inControl, | |
681 | Boolean inIsVisible, | |
682 | Boolean inDoDraw) | |
683 | { | |
684 | if ( UMAHasAppearance() ) | |
685 | { | |
2f1ae414 | 686 | #if UMA_USE_APPEARANCE |
72e7876b | 687 | ::SetControlVisibility( inControl , inIsVisible, inDoDraw ) ; |
2f1ae414 | 688 | #endif |
72e7876b SC |
689 | } |
690 | } | |
691 | ||
692 | ||
693 | ||
694 | bool UMAIsControlActive (ControlHandle inControl) | |
695 | { | |
2f1ae414 SC |
696 | #if TARGET_CARBON |
697 | return IsControlActive( inControl ) ; | |
698 | #else | |
699 | #if UMA_USE_APPEARANCE | |
72e7876b SC |
700 | if ( UMAHasAppearance() ) |
701 | { | |
702 | return IsControlActive( inControl ) ; | |
703 | } | |
704 | else | |
2f1ae414 | 705 | #endif |
72e7876b | 706 | return (**inControl).contrlHilite == 0 ; |
2f1ae414 | 707 | #endif |
72e7876b SC |
708 | } |
709 | ||
710 | ||
711 | bool UMAIsControlVisible (ControlHandle inControl) | |
712 | { | |
2f1ae414 | 713 | #if UMA_USE_APPEARANCE |
72e7876b SC |
714 | if ( UMAHasAppearance() ) |
715 | { | |
716 | return IsControlVisible( inControl ) ; | |
717 | } | |
2f1ae414 | 718 | #endif |
72e7876b SC |
719 | return true ; |
720 | } | |
721 | ||
722 | OSErr UMAGetBestControlRect (ControlHandle inControl, | |
723 | Rect * outRect, | |
724 | SInt16 * outBaseLineOffset) | |
725 | { | |
2f1ae414 | 726 | #if UMA_USE_APPEARANCE |
72e7876b SC |
727 | if ( UMAHasAppearance() ) |
728 | { | |
729 | return GetBestControlRect( inControl , outRect , outBaseLineOffset ) ; | |
730 | } | |
731 | else | |
2f1ae414 SC |
732 | #endif |
733 | #if !TARGET_CARBON | |
72e7876b SC |
734 | { |
735 | return AGAGetBestControlRect( inControl , outRect , outBaseLineOffset ) ; | |
736 | } | |
2f1ae414 SC |
737 | #else |
738 | { | |
739 | return noErr ; | |
740 | } | |
741 | #endif | |
72e7876b SC |
742 | } |
743 | ||
744 | ||
745 | OSErr UMASetControlFontStyle (ControlHandle inControl, | |
746 | const ControlFontStyleRec * inStyle) | |
747 | { | |
2f1ae414 | 748 | #if UMA_USE_APPEARANCE |
72e7876b SC |
749 | if ( UMAHasAppearance() ) |
750 | { | |
751 | return ::SetControlFontStyle( inControl , inStyle ) ; | |
752 | } | |
753 | else | |
2f1ae414 SC |
754 | #endif |
755 | #if !TARGET_CARBON | |
72e7876b | 756 | return AGASetControlFontStyle( inControl , inStyle ) ; |
2f1ae414 SC |
757 | #else |
758 | { | |
759 | return noErr ; | |
760 | } | |
761 | #endif | |
72e7876b SC |
762 | } |
763 | ||
764 | ||
765 | ||
766 | // control hierarchy | |
767 | ||
768 | OSErr UMACreateRootControl (WindowPtr inWindow, | |
769 | ControlHandle * outControl) | |
770 | { | |
2f1ae414 | 771 | #if UMA_USE_APPEARANCE |
72e7876b SC |
772 | if ( UMAHasAppearance() ) |
773 | { | |
774 | return CreateRootControl( inWindow , outControl ) ; | |
775 | } | |
776 | else | |
2f1ae414 SC |
777 | #endif |
778 | #if !TARGET_CARBON | |
72e7876b | 779 | return AGACreateRootControl( inWindow , outControl ) ; |
2f1ae414 SC |
780 | #else |
781 | { | |
782 | return noErr ; | |
783 | } | |
784 | #endif | |
72e7876b SC |
785 | } |
786 | ||
787 | ||
788 | ||
789 | OSErr UMAEmbedControl (ControlHandle inControl, | |
790 | ControlHandle inContainer) | |
791 | { | |
2f1ae414 | 792 | #if UMA_USE_APPEARANCE |
72e7876b SC |
793 | if ( UMAHasAppearance() ) |
794 | { | |
795 | return EmbedControl( inControl , inContainer ) ; | |
796 | } | |
797 | else | |
2f1ae414 SC |
798 | #endif |
799 | #if !TARGET_CARBON | |
72e7876b | 800 | return AGAEmbedControl( inControl , inContainer ) ; ; |
2f1ae414 SC |
801 | #else |
802 | { | |
803 | return noErr ; | |
804 | } | |
805 | #endif | |
72e7876b SC |
806 | } |
807 | ||
808 | ||
809 | ||
810 | // keyboard focus | |
811 | OSErr UMASetKeyboardFocus (WindowPtr inWindow, | |
812 | ControlHandle inControl, | |
813 | ControlFocusPart inPart) | |
814 | { | |
2f1ae414 SC |
815 | OSErr err = noErr; |
816 | GrafPtr port ; | |
817 | GetPort( &port ) ; | |
818 | #if TARGET_CARBON | |
819 | SetPort( GetWindowPort( inWindow ) ) ; | |
820 | #else | |
821 | SetPort( inWindow ) ; | |
822 | #endif | |
823 | SetOrigin( 0 , 0 ) ; | |
824 | #if UMA_USE_APPEARANCE | |
72e7876b SC |
825 | if ( UMAHasAppearance() ) |
826 | { | |
2f1ae414 | 827 | err = SetKeyboardFocus( inWindow , inControl , inPart ) ; |
72e7876b SC |
828 | } |
829 | else | |
2f1ae414 SC |
830 | #endif |
831 | #if !TARGET_CARBON | |
832 | err = AGASetKeyboardFocus( inWindow , inControl , inPart ) ; | |
833 | #else | |
834 | { | |
835 | } | |
836 | #endif | |
837 | SetPort( port ) ; | |
838 | return err ; | |
72e7876b SC |
839 | } |
840 | ||
841 | ||
842 | ||
843 | ||
844 | // events | |
845 | ||
846 | ControlPartCode UMAHandleControlClick (ControlHandle inControl, | |
847 | Point inWhere, | |
848 | SInt16 inModifiers, | |
849 | ControlActionUPP inAction) | |
850 | { | |
2f1ae414 | 851 | #if UMA_USE_APPEARANCE |
72e7876b SC |
852 | if ( UMAHasAppearance() ) |
853 | { | |
854 | return HandleControlClick( inControl , inWhere , inModifiers , inAction ) ; | |
855 | } | |
856 | else | |
2f1ae414 SC |
857 | #endif |
858 | #if !TARGET_CARBON | |
72e7876b SC |
859 | { |
860 | return AGAHandleControlClick( inControl , inWhere , inModifiers , inAction ) ; | |
861 | } | |
2f1ae414 SC |
862 | #else |
863 | { | |
864 | return noErr ; | |
865 | } | |
866 | #endif | |
72e7876b SC |
867 | } |
868 | ||
869 | ||
870 | SInt16 UMAHandleControlKey (ControlHandle inControl, | |
871 | SInt16 inKeyCode, | |
872 | SInt16 inCharCode, | |
873 | SInt16 inModifiers) | |
874 | { | |
2f1ae414 | 875 | #if UMA_USE_APPEARANCE |
72e7876b SC |
876 | if ( UMAHasAppearance() ) |
877 | { | |
878 | return HandleControlKey( inControl , inKeyCode , inCharCode , inModifiers ) ; | |
879 | } | |
880 | else | |
2f1ae414 SC |
881 | #endif |
882 | #if !TARGET_CARBON | |
72e7876b SC |
883 | { |
884 | return AGAHandleControlKey(inControl , inKeyCode , inCharCode , inModifiers ) ; | |
885 | } | |
2f1ae414 SC |
886 | #else |
887 | { | |
888 | return noErr ; | |
889 | } | |
890 | #endif | |
72e7876b SC |
891 | } |
892 | ||
893 | ||
894 | ||
895 | void UMAIdleControls (WindowPtr inWindow) | |
896 | { | |
2f1ae414 | 897 | #if UMA_USE_APPEARANCE |
72e7876b SC |
898 | if ( UMAHasAppearance() ) |
899 | { | |
900 | IdleControls( inWindow ) ; | |
901 | } | |
902 | else | |
2f1ae414 SC |
903 | #endif |
904 | #if !TARGET_CARBON | |
72e7876b SC |
905 | { |
906 | AGAIdleControls( inWindow ) ; | |
907 | } | |
2f1ae414 SC |
908 | #else |
909 | { | |
910 | } | |
911 | #endif | |
72e7876b SC |
912 | } |
913 | ||
914 | void UMAUpdateControls( WindowPtr inWindow , RgnHandle inRgn ) | |
915 | { | |
2f1ae414 | 916 | #if UMA_USE_APPEARANCE |
72e7876b SC |
917 | if ( UMAHasAppearance() ) |
918 | { | |
919 | UpdateControls( inWindow , inRgn ) ; | |
920 | } | |
921 | else | |
2f1ae414 SC |
922 | #endif |
923 | #if !TARGET_CARBON | |
72e7876b SC |
924 | { |
925 | AGAUpdateControls( inWindow , inRgn ) ; | |
926 | } | |
2f1ae414 SC |
927 | #else |
928 | { | |
929 | } | |
930 | #endif | |
72e7876b SC |
931 | } |
932 | ||
933 | OSErr UMAGetRootControl( WindowPtr inWindow , ControlHandle *outControl ) | |
934 | { | |
2f1ae414 | 935 | #if UMA_USE_APPEARANCE |
72e7876b SC |
936 | if ( UMAHasAppearance() ) |
937 | { | |
938 | return GetRootControl( inWindow , outControl ) ; | |
939 | } | |
940 | else | |
2f1ae414 SC |
941 | #endif |
942 | #if !TARGET_CARBON | |
72e7876b SC |
943 | { |
944 | return AGAGetRootControl( inWindow , outControl ) ; | |
945 | } | |
2f1ae414 SC |
946 | #else |
947 | { | |
948 | return noErr ; | |
949 | } | |
950 | #endif | |
72e7876b SC |
951 | } |
952 | ||
953 | ||
954 | // handling control data | |
955 | ||
956 | OSErr UMASetControlData (ControlHandle inControl, | |
957 | ControlPartCode inPart, | |
958 | ResType inTagName, | |
959 | Size inSize, | |
960 | Ptr inData) | |
961 | { | |
2f1ae414 | 962 | #if UMA_USE_APPEARANCE |
72e7876b SC |
963 | if ( UMAHasAppearance() ) |
964 | { | |
965 | return SetControlData( inControl , inPart , inTagName , inSize , inData ) ; | |
966 | } | |
967 | else | |
2f1ae414 SC |
968 | #endif |
969 | #if !TARGET_CARBON | |
72e7876b | 970 | return AGASetControlData( inControl , inPart , inTagName , inSize , inData ) ; |
2f1ae414 SC |
971 | #else |
972 | { | |
973 | return noErr ; | |
974 | } | |
975 | #endif | |
72e7876b SC |
976 | } |
977 | ||
978 | ||
979 | ||
980 | OSErr UMAGetControlData (ControlHandle inControl, | |
981 | ControlPartCode inPart, | |
982 | ResType inTagName, | |
983 | Size inBufferSize, | |
984 | Ptr outBuffer, | |
985 | Size * outActualSize) | |
986 | { | |
2f1ae414 | 987 | #if UMA_USE_APPEARANCE |
72e7876b SC |
988 | if ( UMAHasAppearance() ) |
989 | { | |
990 | return ::GetControlData( inControl , inPart , inTagName , inBufferSize , outBuffer , outActualSize ) ; | |
991 | } | |
992 | else | |
2f1ae414 SC |
993 | #endif |
994 | #if !TARGET_CARBON | |
72e7876b SC |
995 | { |
996 | return AGAGetControlData( inControl , inPart , inTagName , inBufferSize , outBuffer , outActualSize ) ; | |
997 | } | |
2f1ae414 SC |
998 | #else |
999 | { | |
1000 | return noErr ; | |
1001 | } | |
1002 | #endif | |
72e7876b SC |
1003 | } |
1004 | ||
1005 | ||
1006 | OSErr UMAGetControlDataSize (ControlHandle inControl, | |
1007 | ControlPartCode inPart, | |
1008 | ResType inTagName, | |
1009 | Size * outMaxSize) | |
1010 | { | |
2f1ae414 | 1011 | #if UMA_USE_APPEARANCE |
72e7876b SC |
1012 | if ( UMAHasAppearance() ) |
1013 | { | |
1014 | return GetControlDataSize( inControl , inPart , inTagName , outMaxSize ) ; | |
1015 | } | |
1016 | else | |
2f1ae414 SC |
1017 | #endif |
1018 | #if !TARGET_CARBON | |
72e7876b SC |
1019 | { |
1020 | return AGAGetControlDataSize( inControl , inPart , inTagName , outMaxSize ) ; | |
1021 | } | |
2f1ae414 SC |
1022 | #else |
1023 | { | |
1024 | return noErr ; | |
1025 | } | |
1026 | #endif | |
72e7876b SC |
1027 | } |
1028 | ||
1029 | ||
1030 | ||
1031 | ||
1032 | ||
1033 | // system 8.0 changes | |
1034 | ||
1035 | short UMAFindWindow( Point inPoint , WindowRef *outWindow ) | |
1036 | { | |
1037 | // todo add the additional area codes | |
1038 | return FindWindow( inPoint , outWindow ) ; | |
1039 | } | |
1040 | ||
1041 | OSStatus UMAGetWindowFeatures( WindowRef inWindowRef , UInt32 *outFeatures ) | |
1042 | { | |
1043 | #if UMA_USE_WINDOWMGR | |
1044 | return GetWindowFeatures( inWindowRef , outFeatures ) ; | |
1045 | #else | |
1046 | return 0 ; | |
1047 | #endif | |
1048 | } | |
1049 | ||
1050 | OSStatus UMAGetWindowRegion( WindowRef inWindowRef , WindowRegionCode inRegionCode , RgnHandle ioWinRgn ) | |
1051 | { | |
1052 | #if UMA_USE_WINDOWMGR | |
1053 | return GetWindowRegion( inWindowRef , inRegionCode , ioWinRgn ) ; | |
1054 | #else | |
1055 | return 0 ; | |
1056 | #endif | |
1057 | } | |
1058 | ||
1059 | void UMADrawGrowIcon( WindowRef inWindowRef ) | |
1060 | { | |
1061 | DrawGrowIcon( inWindowRef ) ; | |
1062 | } | |
1063 | ||
1064 | OSStatus UMACollapseWindow( WindowRef inWindowRef , Boolean inCollapseIt ) | |
1065 | { | |
1066 | return CollapseWindow( inWindowRef , inCollapseIt ) ; | |
1067 | } | |
1068 | ||
1069 | OSStatus UMACollapseAllWindows( Boolean inCollapseEm ) | |
1070 | { | |
1071 | return CollapseAllWindows( inCollapseEm ) ; | |
1072 | } | |
1073 | ||
1074 | Boolean UMAIsWindowCollapsed( WindowRef inWindowRef ) | |
1075 | { | |
1076 | return IsWindowCollapsed( inWindowRef ) ; | |
1077 | } | |
1078 | ||
1079 | Boolean UMAIsWindowCollapsable( WindowRef inWindowRef ) | |
1080 | { | |
1081 | return IsWindowCollapsable( inWindowRef ) ; | |
1082 | } | |
1083 | ||
1084 | // system 8.5 changes<MacWindows.h> | |
1085 | OSStatus UMACreateNewWindow( WindowClass windowClass , WindowAttributes attributes , const Rect *bounds, WindowRef *outWindow ) | |
1086 | { | |
1087 | #if UMA_USE_WINDOWMGR | |
1088 | if ( UMAHasWindowManager() ) | |
1089 | { | |
1090 | return CreateNewWindow( windowClass , attributes, bounds, outWindow ) ; | |
1091 | } | |
1092 | else | |
1093 | #endif | |
1094 | { | |
1095 | short procID ; | |
1096 | if ( UMAHasAppearance() ) | |
1097 | { | |
1098 | switch( windowClass ) | |
1099 | { | |
1100 | case kMovableModalWindowClass : | |
1101 | procID = kWindowMovableModalDialogProc; | |
1102 | break ; | |
2f1ae414 SC |
1103 | case kModalWindowClass : |
1104 | procID = kWindowShadowDialogProc; | |
1105 | break ; | |
1106 | case kFloatingWindowClass : | |
1107 | if ( attributes & kWindowSideTitlebarAttribute ) | |
1108 | { | |
1109 | if( ( attributes & kWindowResizableAttribute ) && | |
1110 | ( attributes & kWindowFullZoomAttribute ) ) | |
1111 | { | |
1112 | procID = kWindowFloatSideFullZoomGrowProc ; | |
1113 | } | |
1114 | else if( attributes & kWindowFullZoomAttribute ) | |
1115 | { | |
1116 | procID = kWindowFloatSideFullZoomProc; | |
1117 | } | |
1118 | else if ( attributes & kWindowResizableAttribute ) | |
1119 | { | |
1120 | procID = kWindowFloatSideGrowProc; | |
1121 | } | |
1122 | else | |
1123 | { | |
1124 | procID = kWindowFloatSideProc; | |
1125 | } | |
1126 | } | |
1127 | else | |
1128 | { | |
1129 | if( ( attributes & kWindowResizableAttribute ) && | |
1130 | ( attributes & kWindowFullZoomAttribute ) ) | |
1131 | { | |
1132 | procID = kWindowFloatFullZoomGrowProc ; | |
1133 | } | |
1134 | else if( attributes & kWindowFullZoomAttribute ) | |
1135 | { | |
1136 | procID = kWindowFloatFullZoomProc; | |
1137 | } | |
1138 | else if ( attributes & kWindowResizableAttribute ) | |
1139 | { | |
1140 | procID = kWindowFloatGrowProc; | |
1141 | } | |
1142 | else | |
1143 | { | |
1144 | procID = kWindowFloatProc; | |
1145 | } | |
1146 | } | |
72e7876b | 1147 | break ; |
2f1ae414 | 1148 | case kDocumentWindowClass : |
72e7876b | 1149 | default : |
2f1ae414 SC |
1150 | if( ( attributes & kWindowResizableAttribute ) && |
1151 | ( attributes & kWindowFullZoomAttribute ) ) | |
1152 | { | |
1153 | procID = kWindowFullZoomGrowDocumentProc; | |
1154 | } | |
1155 | else if( attributes & kWindowFullZoomAttribute ) | |
1156 | { | |
1157 | procID = kWindowFullZoomDocumentProc; | |
1158 | } | |
1159 | else if ( attributes & kWindowResizableAttribute ) | |
1160 | { | |
1161 | procID = kWindowGrowDocumentProc; | |
1162 | } | |
1163 | else | |
1164 | { | |
1165 | procID = kWindowDocumentProc; | |
1166 | } | |
72e7876b SC |
1167 | break ; |
1168 | } | |
1169 | } | |
1170 | else | |
1171 | { | |
1172 | switch( windowClass ) | |
1173 | { | |
1174 | case kMovableModalWindowClass : | |
1175 | procID = movableDBoxProc; | |
72e7876b | 1176 | break ; |
2f1ae414 SC |
1177 | case kModalWindowClass : |
1178 | procID = altDBoxProc; | |
1179 | break ; | |
1180 | case kFloatingWindowClass : | |
1181 | if ( attributes & kWindowSideTitlebarAttribute ) | |
1182 | { | |
1183 | if( ( attributes & kWindowResizableAttribute ) && | |
1184 | ( attributes & kWindowFullZoomAttribute ) ) | |
1185 | { | |
1186 | procID = floatSideZoomGrowProc ; | |
1187 | } | |
1188 | else if( attributes & kWindowFullZoomAttribute ) | |
1189 | { | |
1190 | procID = floatSideZoomProc; | |
1191 | } | |
1192 | else if ( attributes & kWindowResizableAttribute ) | |
1193 | { | |
1194 | procID = floatSideGrowProc; | |
1195 | } | |
1196 | else | |
1197 | { | |
1198 | procID = floatSideProc; | |
1199 | } | |
1200 | } | |
1201 | else | |
1202 | { | |
1203 | if( ( attributes & kWindowResizableAttribute ) && | |
1204 | ( attributes & kWindowFullZoomAttribute ) ) | |
1205 | { | |
1206 | procID = floatZoomGrowProc ; | |
1207 | } | |
1208 | else if( attributes & kWindowFullZoomAttribute ) | |
1209 | { | |
1210 | procID = floatZoomProc; | |
1211 | } | |
1212 | else if ( attributes & kWindowResizableAttribute ) | |
1213 | { | |
1214 | procID = floatGrowProc; | |
1215 | } | |
1216 | else | |
1217 | { | |
1218 | procID = floatProc; | |
1219 | } | |
1220 | } | |
72e7876b | 1221 | break ; |
2f1ae414 | 1222 | case kDocumentWindowClass : |
72e7876b | 1223 | default : |
2f1ae414 SC |
1224 | if( ( attributes & kWindowResizableAttribute ) && |
1225 | ( attributes & kWindowFullZoomAttribute ) ) | |
1226 | { | |
1227 | procID = zoomDocProc; | |
1228 | } | |
1229 | else if( attributes & kWindowFullZoomAttribute ) | |
1230 | { | |
1231 | procID = zoomNoGrow; | |
1232 | } | |
1233 | else if ( attributes & kWindowResizableAttribute ) | |
1234 | { | |
1235 | procID = documentProc; | |
1236 | } | |
1237 | else | |
1238 | { | |
1239 | procID = noGrowDocProc; | |
1240 | } | |
1241 | break ; | |
72e7876b SC |
1242 | break ; |
1243 | } | |
1244 | } | |
1245 | *outWindow = NewCWindow(nil, bounds, "\p", false, procID, (WindowRef) -1 /*behind*/, | |
1246 | attributes & kWindowCloseBoxAttribute , (long)NULL); | |
1247 | return noErr ; | |
1248 | } | |
1249 | } | |
1250 | ||
1251 | OSStatus UMAGetWindowClass( WindowRef inWindowRef , WindowClass *outWindowClass ) | |
1252 | { | |
1253 | #if UMA_USE_WINDOWMGR | |
1254 | if ( UMAHasWindowManager() ) | |
1255 | { | |
1256 | return GetWindowClass( inWindowRef , outWindowClass ) ; | |
1257 | } | |
1258 | else | |
1259 | #endif | |
1260 | return kDocumentWindowClass ; | |
1261 | } | |
1262 | ||
1263 | OSStatus UMAGetWindowAttributes( WindowRef inWindowRef , WindowAttributes *outAttributes ) | |
1264 | { | |
1265 | #if UMA_USE_WINDOWMGR | |
1266 | if ( UMAHasWindowManager() ) | |
1267 | { | |
1268 | return GetWindowAttributes( inWindowRef , outAttributes ) ; | |
1269 | } | |
1270 | #endif | |
1271 | return kWindowNoAttributes ; | |
1272 | } | |
1273 | ||
1274 | void UMAShowFloatingWindows() | |
1275 | { | |
1276 | #if UMA_USE_WINDOWMGR | |
1277 | if ( UMAHasWindowManager() ) | |
1278 | { | |
1279 | ShowFloatingWindows() ; | |
1280 | } | |
1281 | #endif | |
1282 | } | |
1283 | ||
1284 | void UMAHideFloatingWindows() | |
1285 | { | |
1286 | #if UMA_USE_WINDOWMGR | |
1287 | if ( UMAHasWindowManager() ) | |
1288 | { | |
1289 | HideFloatingWindows() ; | |
1290 | } | |
1291 | #endif | |
1292 | } | |
1293 | ||
1294 | Boolean UMAAreFloatingWindowsVisible() | |
1295 | { | |
1296 | #if UMA_USE_WINDOWMGR | |
1297 | if ( UMAHasWindowManager() ) | |
1298 | { | |
1299 | return AreFloatingWindowsVisible() ; | |
1300 | } | |
1301 | #endif | |
1302 | return false ; | |
1303 | } | |
1304 | ||
1305 | WindowRef UMAFrontNonFloatingWindow() | |
1306 | { | |
1307 | #if UMA_USE_WINDOWMGR | |
1308 | if ( UMAHasWindowManager() ) | |
1309 | { | |
1310 | return FrontNonFloatingWindow() ; | |
1311 | } | |
1312 | else | |
1313 | #endif | |
1314 | { | |
1315 | return FrontWindow() ; | |
1316 | } | |
1317 | } | |
1318 | ||
1319 | WindowRef UMAFrontWindow() | |
1320 | { | |
1321 | #if UMA_USE_WINDOWMGR | |
1322 | if ( UMAHasWindowManager() ) | |
1323 | { | |
1324 | return FrontWindow() ; | |
1325 | } | |
1326 | else | |
1327 | #endif | |
1328 | { | |
1329 | return FrontWindow() ; | |
1330 | } | |
1331 | } | |
1332 | ||
1333 | WindowRef UMAGetActiveNonFloatingWindow() | |
1334 | { | |
1335 | return NULL ; | |
1336 | } | |
1337 | ||
1338 | bool UMAIsWindowFloating( WindowRef inWindow ) | |
1339 | { | |
1340 | WindowClass cl ; | |
1341 | ||
1342 | UMAGetWindowClass( inWindow , &cl ) ; | |
1343 | return cl == kFloatingWindowClass ; | |
1344 | } | |
1345 | ||
1346 | bool UMAIsWindowModal( WindowRef inWindow ) | |
1347 | { | |
1348 | WindowClass cl ; | |
1349 | ||
1350 | UMAGetWindowClass( inWindow , &cl ) ; | |
1351 | return cl < kFloatingWindowClass ; | |
1352 | } | |
1353 | ||
1354 | // others | |
1355 | ||
1356 | void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate ) | |
1357 | { | |
1358 | if ( inWindowRef ) | |
1359 | { | |
1360 | // bool isHighlighted = IsWindowHighlited( inWindowRef ) ; | |
1361 | // if ( inActivate != isHightlited ) | |
c809f3be SC |
1362 | GrafPtr port ; |
1363 | GetPort( &port ) ; | |
1364 | #if TARGET_CARBON | |
1365 | SetPort( GetWindowPort( inWindowRef ) ) ; | |
1366 | #else | |
1367 | SetPort( inWindowRef ) ; | |
1368 | #endif | |
1369 | SetOrigin( 0 , 0 ) ; | |
1370 | HiliteWindow( inWindowRef , inActivate ) ; | |
1371 | ControlHandle control = NULL ; | |
1372 | UMAGetRootControl( inWindowRef , & control ) ; | |
1373 | if ( control ) | |
1374 | { | |
1375 | if ( inActivate ) | |
1376 | UMAActivateControl( control ) ; | |
1377 | else | |
1378 | UMADeactivateControl( control ) ; | |
1379 | } | |
1380 | SetPort( port ) ; | |
72e7876b SC |
1381 | } |
1382 | } | |
2f1ae414 SC |
1383 | OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState ) |
1384 | { | |
1385 | #if UMA_USE_APPEARANCE | |
03e11df5 GD |
1386 | if ( UMAHasAppearance() ) |
1387 | { | |
1388 | ::DrawThemePlacard( inRect , inState ) ; | |
1389 | } | |
1390 | else | |
2f1ae414 SC |
1391 | #endif |
1392 | #if !TARGET_CARBON | |
03e11df5 GD |
1393 | { |
1394 | } | |
2f1ae414 | 1395 | #else |
03e11df5 GD |
1396 | { |
1397 | } | |
2f1ae414 SC |
1398 | #endif |
1399 | } | |
72e7876b | 1400 |