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