]> git.saurik.com Git - wxWidgets.git/blame - src/mac/classic/utils.cpp
removed code for non-compositing case to fix the compilation after recent commits
[wxWidgets.git] / src / mac / classic / utils.cpp
CommitLineData
2646f485 1/////////////////////////////////////////////////////////////////////////////
0ba6a836 2// Name: src/mac/classic/utils.cpp
2646f485
SC
3// Purpose: Various utilities
4// Author: Stefan Csomor
5// Modified by:
6// Created: 1998-01-01
7// RCS-ID: $Id$
8// Copyright: (c) Stefan Csomor
88a7a4e1 9// Licence: wxWindows licence
2646f485
SC
10/////////////////////////////////////////////////////////////////////////////
11
0ba6a836
WS
12#include "wx/wxprec.h"
13
2646f485 14#include "wx/utils.h"
88a7a4e1
WS
15
16#ifndef WX_PRECOMP
17 #include "wx/intl.h"
670f9935 18 #include "wx/app.h"
48a1108e
WS
19 #if wxUSE_GUI
20 #include "wx/font.h"
21 #endif
88a7a4e1
WS
22#endif
23
2646f485
SC
24#include "wx/apptrait.h"
25
26#if wxUSE_GUI
27 #include "wx/mac/uma.h"
2646f485
SC
28#endif
29
30#include <ctype.h>
31
32#include <stdio.h>
33#include <stdlib.h>
34#include <string.h>
35#include <stdarg.h>
36
37#ifdef __DARWIN__
38# include "MoreFilesX.h"
39#else
40# include "MoreFiles.h"
41# include "MoreFilesExtras.h"
42#endif
43
44#ifndef __DARWIN__
45#include <Threads.h>
46#include <Sound.h>
47#endif
48
49#include <ATSUnicode.h>
50#include <TextCommon.h>
51#include <TextEncodingConverter.h>
52
53#include "wx/mac/private.h" // includes mac headers
54
55#if defined(__MWERKS__) && wxUSE_UNICODE
56 #include <wtime.h>
57#endif
58
59// ---------------------------------------------------------------------------
60// code used in both base and GUI compilation
61// ---------------------------------------------------------------------------
62
63// our OS version is the same in non GUI and GUI cases
8bb6b2c0 64wxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin)
2646f485 65{
8bb6b2c0 66 long theSystem;
2646f485
SC
67
68 // are there x-platform conventions ?
69
8bb6b2c0
VZ
70 Gestalt(gestaltSystemVersion, &theSystem);
71 if (minorVsn != NULL)
72 *minorVsn = (theSystem & 0xFF);
73
74 if (majorVsn != NULL)
75 *majorVsn = (theSystem >> 8);
76
77#if defined( __DARWIN__ )
78 return wxOS_MAC_OSX_DARWIN;
2646f485 79#else
8bb6b2c0 80 return wxOS_MAC_OS;
2646f485
SC
81#endif
82}
83
84#if wxUSE_BASE
85
86#ifndef __DARWIN__
87// defined in unix/utilsunx.cpp for Mac OS X
88
89// get full hostname (with domain name if possible)
90bool wxGetFullHostName(wxChar *buf, int maxSize)
91{
92 return wxGetHostName(buf, maxSize);
93}
94
95// Get hostname only (without domain name)
96bool wxGetHostName(wxChar *buf, int maxSize)
97{
98 // Gets Chooser name of user by examining a System resource.
99
100 const short kComputerNameID = -16413;
101
102 short oldResFile = CurResFile() ;
103 UseResFile(0);
104 StringHandle chooserName = (StringHandle)::GetString(kComputerNameID);
105 UseResFile(oldResFile);
106
107 if (chooserName && *chooserName)
108 {
109 HLock( (Handle) chooserName ) ;
110 wxString name = wxMacMakeStringFromPascal( *chooserName ) ;
111 HUnlock( (Handle) chooserName ) ;
112 ReleaseResource( (Handle) chooserName ) ;
113 wxStrncpy( buf , name , maxSize - 1 ) ;
114 }
115 else
116 buf[0] = 0 ;
117
9d8aca48 118 return true;
2646f485
SC
119}
120
121// Get user ID e.g. jacs
122bool wxGetUserId(wxChar *buf, int maxSize)
123{
124 return wxGetUserName( buf , maxSize ) ;
125}
126
127const wxChar* wxGetHomeDir(wxString *pstr)
128{
129 *pstr = wxMacFindFolder( (short) kOnSystemDisk, kPreferencesFolderType, kDontCreateFolder ) ;
130 return pstr->c_str() ;
131}
132
133// Get user name e.g. Stefan Csomor
134bool wxGetUserName(wxChar *buf, int maxSize)
135{
136 // Gets Chooser name of user by examining a System resource.
137
138 const short kChooserNameID = -16096;
139
140 short oldResFile = CurResFile() ;
141 UseResFile(0);
142 StringHandle chooserName = (StringHandle)::GetString(kChooserNameID);
143 UseResFile(oldResFile);
144
145 if (chooserName && *chooserName)
146 {
147 HLock( (Handle) chooserName ) ;
148 wxString name = wxMacMakeStringFromPascal( *chooserName ) ;
149 HUnlock( (Handle) chooserName ) ;
150 ReleaseResource( (Handle) chooserName ) ;
151 wxStrncpy( buf , name , maxSize - 1 ) ;
152 }
153 else
154 buf[0] = 0 ;
155
9d8aca48 156 return true;
2646f485
SC
157}
158
e0f6b731 159int wxKill(long pid, wxSignal sig , wxKillError *rc, int flags)
2646f485
SC
160{
161 // TODO
162 return 0;
163}
164
165WXDLLEXPORT bool wxGetEnv(const wxString& var, wxString *value)
166{
167 // TODO : under classic there is no environement support, under X yes
168 return false ;
169}
170
9d8aca48 171// set the env var name to the given value, return true on success
2646f485
SC
172WXDLLEXPORT bool wxSetEnv(const wxString& var, const wxChar *value)
173{
174 // TODO : under classic there is no environement support, under X yes
175 return false ;
176}
177
178//
179// Execute a program in an Interactive Shell
180//
181bool wxShell(const wxString& command)
182{
183 // TODO
9d8aca48 184 return false;
2646f485
SC
185}
186
187// Shutdown or reboot the PC
188bool wxShutdown(wxShutdownFlags wFlags)
189{
190 // TODO
9d8aca48 191 return false;
2646f485
SC
192}
193
194// Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX)
9d8aca48 195wxMemorySize wxGetFreeMemory()
2646f485 196{
9d8aca48 197 return (wxMemorySize)FreeMem() ;
2646f485
SC
198}
199
200void wxUsleep(unsigned long milliseconds)
201{
202 clock_t start = clock() ;
203 do
204 {
205 YieldToAnyThread() ;
206 } while( clock() - start < milliseconds / 1000.0 * CLOCKS_PER_SEC ) ;
207}
208
209void wxSleep(int nSecs)
210{
211 wxUsleep(1000*nSecs);
212}
213
214// Consume all events until no more left
215void wxFlushEvents()
216{
217}
218
219#endif // !__DARWIN__
220
221// Emit a beeeeeep
222void wxBell()
223{
224 SysBeep(30);
225}
226
2646f485
SC
227#endif // wxUSE_BASE
228
229#if wxUSE_GUI
230
8bb6b2c0 231wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const
2646f485 232{
8bb6b2c0
VZ
233 // We suppose that toolkit version is the same as OS version under Mac
234 wxGetOsVersion(verMaj, verMin);
235
236 return wxPORT_MAC;
2646f485
SC
237}
238
239// Reading and writing resources (eg WIN.INI, .Xdefaults)
240#if wxUSE_RESOURCES
241bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file)
242{
243 // TODO
9d8aca48 244 return false;
2646f485
SC
245}
246
247bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file)
248{
249 wxString buf;
250 buf.Printf(wxT("%.4f"), value);
251
252 return wxWriteResource(section, entry, buf, file);
253}
254
255bool wxWriteResource(const wxString& section, const wxString& entry, long value, const wxString& file)
256{
257 wxString buf;
258 buf.Printf(wxT("%ld"), value);
259
260 return wxWriteResource(section, entry, buf, file);
261}
262
263bool wxWriteResource(const wxString& section, const wxString& entry, int value, const wxString& file)
264{
265 wxString buf;
266 buf.Printf(wxT("%d"), value);
267
268 return wxWriteResource(section, entry, buf, file);
269}
270
271bool wxGetResource(const wxString& section, const wxString& entry, char **value, const wxString& file)
272{
273 // TODO
9d8aca48 274 return false;
2646f485
SC
275}
276
277bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file)
278{
279 char *s = NULL;
280 bool succ = wxGetResource(section, entry, (char **)&s, file);
281 if (succ)
282 {
283 *value = (float)strtod(s, NULL);
284 delete[] s;
9d8aca48 285 return true;
2646f485 286 }
9d8aca48 287 else return false;
2646f485
SC
288}
289
290bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file)
291{
292 char *s = NULL;
293 bool succ = wxGetResource(section, entry, (char **)&s, file);
294 if (succ)
295 {
296 *value = strtol(s, NULL, 10);
297 delete[] s;
9d8aca48 298 return true;
2646f485 299 }
9d8aca48 300 else return false;
2646f485
SC
301}
302
303bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file)
304{
305 char *s = NULL;
306 bool succ = wxGetResource(section, entry, (char **)&s, file);
307 if (succ)
308 {
309 *value = (int)strtol(s, NULL, 10);
310 delete[] s;
9d8aca48 311 return true;
2646f485 312 }
9d8aca48 313 else return false;
2646f485
SC
314}
315#endif // wxUSE_RESOURCES
316
317int gs_wxBusyCursorCount = 0;
318extern wxCursor gMacCurrentCursor ;
319wxCursor gMacStoredActiveCursor ;
320
321// Set the cursor to the busy cursor for all windows
f516d986 322void wxBeginBusyCursor(const wxCursor *cursor)
2646f485
SC
323{
324 if (gs_wxBusyCursorCount++ == 0)
325 {
326 gMacStoredActiveCursor = gMacCurrentCursor ;
327 cursor->MacInstall() ;
328 }
329 //else: nothing to do, already set
330}
331
332// Restore cursor to normal
333void wxEndBusyCursor()
334{
335 wxCHECK_RET( gs_wxBusyCursorCount > 0,
336 wxT("no matching wxBeginBusyCursor() for wxEndBusyCursor()") );
337
338 if (--gs_wxBusyCursorCount == 0)
339 {
340 gMacStoredActiveCursor.MacInstall() ;
341 gMacStoredActiveCursor = wxNullCursor ;
342 }
343}
344
9d8aca48 345// true if we're between the above two calls
2646f485
SC
346bool wxIsBusy()
347{
348 return (gs_wxBusyCursorCount > 0);
349}
350
351#endif // wxUSE_GUI
352
353#if wxUSE_BASE
354
17af82fb 355wxString wxMacFindFolderNoSeparator( short vol,
2646f485
SC
356 OSType folderType,
357 Boolean createFolder)
358{
359 short vRefNum ;
360 long dirID ;
361 wxString strDir ;
362
363 if ( FindFolder( vol, folderType, createFolder, &vRefNum, &dirID) == noErr)
364 {
365 FSSpec file ;
366 if ( FSMakeFSSpec( vRefNum , dirID , "\p" , &file ) == noErr )
367 {
17af82fb 368 strDir = wxMacFSSpec2MacFilename( &file );
2646f485
SC
369 }
370 }
371 return strDir ;
372}
373
17af82fb
VZ
374wxString wxMacFindFolder( short vol,
375 OSType folderType,
376 Boolean createFolder)
377{
378 return wxMacFindFolderNoSeparator(vol, folderType, createFolder) + wxFILE_SEP_PATH;
379}
380
2646f485
SC
381#endif // wxUSE_BASE
382
383#if wxUSE_GUI
384
385// Check whether this window wants to process messages, e.g. Stop button
386// in long calculations.
387bool wxCheckForInterrupt(wxWindow *wnd)
388{
389 // TODO
9d8aca48 390 return false;
2646f485
SC
391}
392
393void wxGetMousePosition( int* x, int* y )
394{
395 Point pt ;
396
397 GetMouse( &pt ) ;
398 LocalToGlobal( &pt ) ;
399 *x = pt.h ;
400 *y = pt.v ;
401};
402
9d8aca48 403// Return true if we have a colour display
2646f485
SC
404bool wxColourDisplay()
405{
9d8aca48 406 return true;
2646f485
SC
407}
408
409// Returns depth of screen
410int wxDisplayDepth()
411{
412 Rect globRect ;
413 SetRect(&globRect, -32760, -32760, 32760, 32760);
414 GDHandle theMaxDevice;
415
416 int theDepth = 8;
417 theMaxDevice = GetMaxDevice(&globRect);
418 if (theMaxDevice != nil)
419 theDepth = (**(**theMaxDevice).gdPMap).pixelSize;
420
421 return theDepth ;
422}
423
424// Get size of display
425void wxDisplaySize(int *width, int *height)
426{
427 BitMap screenBits;
428 GetQDGlobalsScreenBits( &screenBits );
429
430 if (width != NULL) {
431 *width = screenBits.bounds.right - screenBits.bounds.left ;
432 }
433 if (height != NULL) {
434 *height = screenBits.bounds.bottom - screenBits.bounds.top ;
435 }
436}
437
438void wxDisplaySizeMM(int *width, int *height)
439{
440 wxDisplaySize(width, height);
441 // on mac 72 is fixed (at least now ;-)
442 float cvPt2Mm = 25.4 / 72;
443
444 if (width != NULL) {
445 *width = int( *width * cvPt2Mm );
446 }
447 if (height != NULL) {
448 *height = int( *height * cvPt2Mm );
449 }
450}
451
452void wxClientDisplayRect(int *x, int *y, int *width, int *height)
453{
454#if TARGET_CARBON
455 Rect r ;
456 GetAvailableWindowPositioningBounds( GetMainDevice() , &r ) ;
457 if ( x )
458 *x = r.left ;
459 if ( y )
460 *y = r.top ;
461 if ( width )
462 *width = r.right - r.left ;
463 if ( height )
464 *height = r.bottom - r.top ;
465#else
466 BitMap screenBits;
467 GetQDGlobalsScreenBits( &screenBits );
468
469 if (x) *x = 0;
470 if (y) *y = 0;
471
472 if (width != NULL) {
473 *width = screenBits.bounds.right - screenBits.bounds.left ;
474 }
475 if (height != NULL) {
476 *height = screenBits.bounds.bottom - screenBits.bounds.top ;
477 }
478
479 SInt16 mheight ;
480#if TARGET_CARBON
481 GetThemeMenuBarHeight( &mheight ) ;
482#else
483 mheight = LMGetMBarHeight() ;
484#endif
485 if (height != NULL) {
486 *height -= mheight ;
487 }
488 if (y)
489 *y = mheight ;
490#endif
491}
492
493wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
494{
495 return wxGenericFindWindowAtPoint(pt);
496}
497
498#endif // wxUSE_GUI
499
500#if wxUSE_BASE
501
502wxString wxGetOsDescription()
503{
504#ifdef WXWIN_OS_DESCRIPTION
505 // use configure generated description if available
506 return wxString(wxT("MacOS (")) + wxT(WXWIN_OS_DESCRIPTION) + wxString(wxT(")"));
507#else
508 return wxT("MacOS") ; //TODO:define further
509#endif
510}
511
512#ifndef __DARWIN__
513wxChar *wxGetUserHome (const wxString& user)
514{
515 // TODO
516 return NULL;
517}
518
7ba7c4e6 519bool wxGetDiskSpace(const wxString& path, wxDiskspaceSize_t *pTotal, wxDiskspaceSize_t *pFree)
2646f485
SC
520{
521 if ( path.empty() )
9d8aca48 522 return false;
2646f485
SC
523
524 wxString p = path ;
525 if (p[0u] == ':' ) {
526 p = wxGetCwd() + p ;
527 }
528
529 int pos = p.Find(':') ;
530 if ( pos != wxNOT_FOUND ) {
531 p = p.Mid(1,pos) ;
532 }
533
534 p = p + wxT(":") ;
535
536 Str255 volumeName ;
537 XVolumeParam pb ;
538
539 wxMacStringToPascal( p , volumeName ) ;
540 OSErr err = XGetVolumeInfoNoName( volumeName , 0 , &pb ) ;
541 if ( err == noErr ) {
542 if ( pTotal ) {
7ba7c4e6 543 (*pTotal) = wxDiskspaceSize_t( pb.ioVTotalBytes ) ;
2646f485
SC
544 }
545 if ( pFree ) {
7ba7c4e6 546 (*pFree) = wxDiskspaceSize_t( pb.ioVFreeBytes ) ;
2646f485
SC
547 }
548 }
549
550 return err == noErr ;
551}
552#endif // !__DARWIN__
553
554//---------------------------------------------------------------------------
555// wxMac Specific utility functions
556//---------------------------------------------------------------------------
557
558void wxMacStringToPascal( const wxString&from , StringPtr to )
559{
560 wxCharBuffer buf = from.mb_str( wxConvLocal ) ;
561 int len = strlen(buf) ;
562
563 if ( len > 255 )
564 len = 255 ;
565 to[0] = len ;
566 memcpy( (char*) &to[1] , buf , len ) ;
567}
568
569wxString wxMacMakeStringFromPascal( ConstStringPtr from )
570{
571 return wxString( (char*) &from[1] , wxConvLocal , from[0] ) ;
572}
573
574
575wxUint32 wxMacGetSystemEncFromFontEnc(wxFontEncoding encoding)
9d8aca48
WS
576{
577 TextEncodingBase enc = 0 ;
578 if ( encoding == wxFONTENCODING_DEFAULT )
579 {
2646f485 580#if wxUSE_GUI
9d8aca48 581 encoding = wxFont::GetDefaultEncoding() ;
2646f485 582#else
9d8aca48 583 encoding = wxLocale::GetSystemEncoding() ;
2646f485 584#endif
9d8aca48
WS
585 }
586
587 switch( encoding)
588 {
589 case wxFONTENCODING_ISO8859_1 :
590 enc = kTextEncodingISOLatin1 ;
591 break ;
592 case wxFONTENCODING_ISO8859_2 :
593 enc = kTextEncodingISOLatin2;
594 break ;
595 case wxFONTENCODING_ISO8859_3 :
596 enc = kTextEncodingISOLatin3 ;
597 break ;
598 case wxFONTENCODING_ISO8859_4 :
599 enc = kTextEncodingISOLatin4;
600 break ;
601 case wxFONTENCODING_ISO8859_5 :
602 enc = kTextEncodingISOLatinCyrillic;
603 break ;
604 case wxFONTENCODING_ISO8859_6 :
605 enc = kTextEncodingISOLatinArabic;
606 break ;
607 case wxFONTENCODING_ISO8859_7 :
608 enc = kTextEncodingISOLatinGreek;
609 break ;
610 case wxFONTENCODING_ISO8859_8 :
611 enc = kTextEncodingISOLatinHebrew;
612 break ;
613 case wxFONTENCODING_ISO8859_9 :
614 enc = kTextEncodingISOLatin5;
615 break ;
616 case wxFONTENCODING_ISO8859_10 :
617 enc = kTextEncodingISOLatin6;
618 break ;
619 case wxFONTENCODING_ISO8859_13 :
620 enc = kTextEncodingISOLatin7;
621 break ;
622 case wxFONTENCODING_ISO8859_14 :
623 enc = kTextEncodingISOLatin8;
624 break ;
625 case wxFONTENCODING_ISO8859_15 :
626 enc = kTextEncodingISOLatin9;
627 break ;
628
629 case wxFONTENCODING_KOI8 :
630 enc = kTextEncodingKOI8_R;
631 break ;
632 case wxFONTENCODING_ALTERNATIVE : // MS-DOS CP866
633 enc = kTextEncodingDOSRussian;
634 break ;
2646f485 635/*
9d8aca48
WS
636 case wxFONTENCODING_BULGARIAN :
637 enc = ;
638 break ;
639*/
640 case wxFONTENCODING_CP437 :
641 enc =kTextEncodingDOSLatinUS ;
642 break ;
643 case wxFONTENCODING_CP850 :
644 enc = kTextEncodingDOSLatin1;
645 break ;
646 case wxFONTENCODING_CP852 :
647 enc = kTextEncodingDOSLatin2;
648 break ;
649 case wxFONTENCODING_CP855 :
650 enc = kTextEncodingDOSCyrillic;
651 break ;
652 case wxFONTENCODING_CP866 :
653 enc =kTextEncodingDOSRussian ;
654 break ;
655 case wxFONTENCODING_CP874 :
656 enc = kTextEncodingDOSThai;
657 break ;
658 case wxFONTENCODING_CP932 :
659 enc = kTextEncodingDOSJapanese;
660 break ;
661 case wxFONTENCODING_CP936 :
662 enc =kTextEncodingDOSChineseSimplif ;
663 break ;
664 case wxFONTENCODING_CP949 :
665 enc = kTextEncodingDOSKorean;
666 break ;
667 case wxFONTENCODING_CP950 :
668 enc = kTextEncodingDOSChineseTrad;
669 break ;
670
671 case wxFONTENCODING_CP1250 :
672 enc = kTextEncodingWindowsLatin2;
673 break ;
674 case wxFONTENCODING_CP1251 :
675 enc =kTextEncodingWindowsCyrillic ;
676 break ;
677 case wxFONTENCODING_CP1252 :
678 enc =kTextEncodingWindowsLatin1 ;
679 break ;
680 case wxFONTENCODING_CP1253 :
681 enc = kTextEncodingWindowsGreek;
682 break ;
683 case wxFONTENCODING_CP1254 :
684 enc = kTextEncodingWindowsLatin5;
685 break ;
686 case wxFONTENCODING_CP1255 :
687 enc =kTextEncodingWindowsHebrew ;
688 break ;
689 case wxFONTENCODING_CP1256 :
690 enc =kTextEncodingWindowsArabic ;
691 break ;
692 case wxFONTENCODING_CP1257 :
693 enc = kTextEncodingWindowsBalticRim;
694 break ;
695
696 case wxFONTENCODING_UTF7 :
697 enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicodeUTF7Format) ;
698 break ;
699 case wxFONTENCODING_UTF8 :
700 enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicodeUTF8Format) ;
701 break ;
702 case wxFONTENCODING_EUC_JP :
703 enc = kTextEncodingEUC_JP;
704 break ;
705 case wxFONTENCODING_UTF16BE :
706 enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicode16BitFormat) ;
707 break ;
708 case wxFONTENCODING_UTF16LE :
709 enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicode16BitFormat) ;
710 break ;
711 case wxFONTENCODING_UTF32BE :
712 enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicode32BitFormat) ;
713 break ;
714 case wxFONTENCODING_UTF32LE :
715 enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicode32BitFormat) ;
716 break ;
2646f485
SC
717
718 case wxFONTENCODING_MACROMAN :
719 enc = kTextEncodingMacRoman ;
720 break ;
721 case wxFONTENCODING_MACJAPANESE :
722 enc = kTextEncodingMacJapanese ;
723 break ;
724 case wxFONTENCODING_MACCHINESETRAD :
725 enc = kTextEncodingMacChineseTrad ;
726 break ;
727 case wxFONTENCODING_MACKOREAN :
728 enc = kTextEncodingMacKorean ;
729 break ;
730 case wxFONTENCODING_MACARABIC :
731 enc = kTextEncodingMacArabic ;
732 break ;
733 case wxFONTENCODING_MACHEBREW :
734 enc = kTextEncodingMacHebrew ;
735 break ;
736 case wxFONTENCODING_MACGREEK :
737 enc = kTextEncodingMacGreek ;
738 break ;
739 case wxFONTENCODING_MACCYRILLIC :
740 enc = kTextEncodingMacCyrillic ;
741 break ;
742 case wxFONTENCODING_MACDEVANAGARI :
743 enc = kTextEncodingMacDevanagari ;
744 break ;
745 case wxFONTENCODING_MACGURMUKHI :
746 enc = kTextEncodingMacGurmukhi ;
747 break ;
748 case wxFONTENCODING_MACGUJARATI :
749 enc = kTextEncodingMacGujarati ;
750 break ;
751 case wxFONTENCODING_MACORIYA :
752 enc = kTextEncodingMacOriya ;
753 break ;
754 case wxFONTENCODING_MACBENGALI :
755 enc = kTextEncodingMacBengali ;
756 break ;
757 case wxFONTENCODING_MACTAMIL :
758 enc = kTextEncodingMacTamil ;
759 break ;
760 case wxFONTENCODING_MACTELUGU :
761 enc = kTextEncodingMacTelugu ;
762 break ;
763 case wxFONTENCODING_MACKANNADA :
764 enc = kTextEncodingMacKannada ;
765 break ;
766 case wxFONTENCODING_MACMALAJALAM :
767 enc = kTextEncodingMacMalayalam ;
768 break ;
769 case wxFONTENCODING_MACSINHALESE :
770 enc = kTextEncodingMacSinhalese ;
771 break ;
772 case wxFONTENCODING_MACBURMESE :
773 enc = kTextEncodingMacBurmese ;
774 break ;
775 case wxFONTENCODING_MACKHMER :
776 enc = kTextEncodingMacKhmer ;
777 break ;
778 case wxFONTENCODING_MACTHAI :
779 enc = kTextEncodingMacThai ;
780 break ;
781 case wxFONTENCODING_MACLAOTIAN :
782 enc = kTextEncodingMacLaotian ;
783 break ;
784 case wxFONTENCODING_MACGEORGIAN :
785 enc = kTextEncodingMacGeorgian ;
786 break ;
787 case wxFONTENCODING_MACARMENIAN :
788 enc = kTextEncodingMacArmenian ;
789 break ;
790 case wxFONTENCODING_MACCHINESESIMP :
791 enc = kTextEncodingMacChineseSimp ;
792 break ;
793 case wxFONTENCODING_MACTIBETAN :
794 enc = kTextEncodingMacTibetan ;
795 break ;
796 case wxFONTENCODING_MACMONGOLIAN :
797 enc = kTextEncodingMacMongolian ;
798 break ;
799 case wxFONTENCODING_MACETHIOPIC :
800 enc = kTextEncodingMacEthiopic ;
801 break ;
802 case wxFONTENCODING_MACCENTRALEUR :
803 enc = kTextEncodingMacCentralEurRoman ;
804 break ;
805 case wxFONTENCODING_MACVIATNAMESE :
806 enc = kTextEncodingMacVietnamese ;
807 break ;
808 case wxFONTENCODING_MACARABICEXT :
809 enc = kTextEncodingMacExtArabic ;
810 break ;
811 case wxFONTENCODING_MACSYMBOL :
812 enc = kTextEncodingMacSymbol ;
813 break ;
814 case wxFONTENCODING_MACDINGBATS :
815 enc = kTextEncodingMacDingbats ;
816 break ;
817 case wxFONTENCODING_MACTURKISH :
818 enc = kTextEncodingMacTurkish ;
819 break ;
820 case wxFONTENCODING_MACCROATIAN :
821 enc = kTextEncodingMacCroatian ;
822 break ;
823 case wxFONTENCODING_MACICELANDIC :
824 enc = kTextEncodingMacIcelandic ;
825 break ;
826 case wxFONTENCODING_MACROMANIAN :
827 enc = kTextEncodingMacRomanian ;
828 break ;
829 case wxFONTENCODING_MACCELTIC :
830 enc = kTextEncodingMacCeltic ;
831 break ;
832 case wxFONTENCODING_MACGAELIC :
833 enc = kTextEncodingMacGaelic ;
834 break ;
835 case wxFONTENCODING_MACKEYBOARD :
836 enc = kTextEncodingMacKeyboardGlyphs ;
9d8aca48
WS
837 break ;
838 default :
839 // to make gcc happy
840 break ;
841 } ;
842 return enc ;
2646f485
SC
843}
844
845wxFontEncoding wxMacGetFontEncFromSystemEnc(wxUint32 encoding)
9d8aca48
WS
846{
847 wxFontEncoding enc = wxFONTENCODING_DEFAULT ;
848
849 switch( encoding)
850 {
851 case kTextEncodingISOLatin1 :
852 enc = wxFONTENCODING_ISO8859_1 ;
853 break ;
854 case kTextEncodingISOLatin2 :
855 enc = wxFONTENCODING_ISO8859_2;
856 break ;
857 case kTextEncodingISOLatin3 :
858 enc = wxFONTENCODING_ISO8859_3 ;
859 break ;
860 case kTextEncodingISOLatin4 :
861 enc = wxFONTENCODING_ISO8859_4;
862 break ;
863 case kTextEncodingISOLatinCyrillic :
864 enc = wxFONTENCODING_ISO8859_5;
865 break ;
866 case kTextEncodingISOLatinArabic :
867 enc = wxFONTENCODING_ISO8859_6;
868 break ;
869 case kTextEncodingISOLatinGreek :
870 enc = wxFONTENCODING_ISO8859_7;
871 break ;
872 case kTextEncodingISOLatinHebrew :
873 enc = wxFONTENCODING_ISO8859_8;
874 break ;
875 case kTextEncodingISOLatin5 :
876 enc = wxFONTENCODING_ISO8859_9;
877 break ;
878 case kTextEncodingISOLatin6 :
879 enc = wxFONTENCODING_ISO8859_10;
880 break ;
881 case kTextEncodingISOLatin7 :
882 enc = wxFONTENCODING_ISO8859_13;
883 break ;
884 case kTextEncodingISOLatin8 :
885 enc = wxFONTENCODING_ISO8859_14;
886 break ;
887 case kTextEncodingISOLatin9 :
888 enc =wxFONTENCODING_ISO8859_15 ;
889 break ;
890
891 case kTextEncodingKOI8_R :
892 enc = wxFONTENCODING_KOI8;
893 break ;
2646f485 894/*
9d8aca48
WS
895 case :
896 enc = wxFONTENCODING_BULGARIAN;
897 break ;
898*/
899 case kTextEncodingDOSLatinUS :
900 enc = wxFONTENCODING_CP437;
901 break ;
902 case kTextEncodingDOSLatin1 :
903 enc = wxFONTENCODING_CP850;
904 break ;
905 case kTextEncodingDOSLatin2 :
906 enc =wxFONTENCODING_CP852 ;
907 break ;
908 case kTextEncodingDOSCyrillic :
909 enc = wxFONTENCODING_CP855;
910 break ;
911 case kTextEncodingDOSRussian :
912 enc = wxFONTENCODING_CP866;
913 break ;
914 case kTextEncodingDOSThai :
915 enc =wxFONTENCODING_CP874 ;
916 break ;
917 case kTextEncodingDOSJapanese :
918 enc = wxFONTENCODING_CP932;
919 break ;
920 case kTextEncodingDOSChineseSimplif :
921 enc = wxFONTENCODING_CP936;
922 break ;
923 case kTextEncodingDOSKorean :
924 enc = wxFONTENCODING_CP949;
925 break ;
926 case kTextEncodingDOSChineseTrad :
927 enc = wxFONTENCODING_CP950;
928 break ;
929
930 case kTextEncodingWindowsLatin2 :
931 enc = wxFONTENCODING_CP1250;
932 break ;
933 case kTextEncodingWindowsCyrillic :
934 enc = wxFONTENCODING_CP1251;
935 break ;
936 case kTextEncodingWindowsLatin1 :
937 enc = wxFONTENCODING_CP1252;
938 break ;
939 case kTextEncodingWindowsGreek :
940 enc = wxFONTENCODING_CP1253;
941 break ;
942 case kTextEncodingWindowsLatin5 :
943 enc = wxFONTENCODING_CP1254;
944 break ;
945 case kTextEncodingWindowsHebrew :
946 enc = wxFONTENCODING_CP1255;
947 break ;
948 case kTextEncodingWindowsArabic :
949 enc = wxFONTENCODING_CP1256;
950 break ;
951 case kTextEncodingWindowsBalticRim :
952 enc =wxFONTENCODING_CP1257 ;
953 break ;
954 case kTextEncodingEUC_JP :
955 enc = wxFONTENCODING_EUC_JP;
956 break ;
957 /*
958 case wxFONTENCODING_UTF7 :
959 enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicodeUTF7Format) ;
960 break ;
961 case wxFONTENCODING_UTF8 :
962 enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicodeUTF8Format) ;
963 break ;
964 case wxFONTENCODING_UTF16BE :
965 enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicode16BitFormat) ;
966 break ;
967 case wxFONTENCODING_UTF16LE :
968 enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicode16BitFormat) ;
969 break ;
970 case wxFONTENCODING_UTF32BE :
971 enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicode32BitFormat) ;
972 break ;
973 case wxFONTENCODING_UTF32LE :
974 enc = CreateTextEncoding(kTextEncodingUnicodeDefault,0,kUnicode32BitFormat) ;
975 break ;
2646f485
SC
976 */
977 case kTextEncodingMacRoman :
978 enc = wxFONTENCODING_MACROMAN ;
979 break ;
980 case kTextEncodingMacJapanese :
981 enc = wxFONTENCODING_MACJAPANESE ;
982 break ;
983 case kTextEncodingMacChineseTrad :
984 enc = wxFONTENCODING_MACCHINESETRAD ;
985 break ;
986 case kTextEncodingMacKorean :
987 enc = wxFONTENCODING_MACKOREAN ;
988 break ;
989 case kTextEncodingMacArabic :
990 enc =wxFONTENCODING_MACARABIC ;
991 break ;
992 case kTextEncodingMacHebrew :
993 enc = wxFONTENCODING_MACHEBREW ;
994 break ;
995 case kTextEncodingMacGreek :
996 enc = wxFONTENCODING_MACGREEK ;
997 break ;
998 case kTextEncodingMacCyrillic :
999 enc = wxFONTENCODING_MACCYRILLIC ;
1000 break ;
1001 case kTextEncodingMacDevanagari :
1002 enc = wxFONTENCODING_MACDEVANAGARI ;
1003 break ;
1004 case kTextEncodingMacGurmukhi :
1005 enc = wxFONTENCODING_MACGURMUKHI ;
1006 break ;
1007 case kTextEncodingMacGujarati :
1008 enc = wxFONTENCODING_MACGUJARATI ;
1009 break ;
1010 case kTextEncodingMacOriya :
1011 enc =wxFONTENCODING_MACORIYA ;
1012 break ;
1013 case kTextEncodingMacBengali :
1014 enc =wxFONTENCODING_MACBENGALI ;
1015 break ;
1016 case kTextEncodingMacTamil :
1017 enc = wxFONTENCODING_MACTAMIL ;
1018 break ;
1019 case kTextEncodingMacTelugu :
1020 enc = wxFONTENCODING_MACTELUGU ;
1021 break ;
1022 case kTextEncodingMacKannada :
1023 enc = wxFONTENCODING_MACKANNADA ;
1024 break ;
1025 case kTextEncodingMacMalayalam :
1026 enc = wxFONTENCODING_MACMALAJALAM ;
1027 break ;
1028 case kTextEncodingMacSinhalese :
1029 enc = wxFONTENCODING_MACSINHALESE ;
1030 break ;
1031 case kTextEncodingMacBurmese :
1032 enc = wxFONTENCODING_MACBURMESE ;
1033 break ;
1034 case kTextEncodingMacKhmer :
1035 enc = wxFONTENCODING_MACKHMER ;
1036 break ;
1037 case kTextEncodingMacThai :
1038 enc = wxFONTENCODING_MACTHAI ;
1039 break ;
1040 case kTextEncodingMacLaotian :
1041 enc = wxFONTENCODING_MACLAOTIAN ;
1042 break ;
1043 case kTextEncodingMacGeorgian :
1044 enc = wxFONTENCODING_MACGEORGIAN ;
1045 break ;
1046 case kTextEncodingMacArmenian :
1047 enc = wxFONTENCODING_MACARMENIAN ;
1048 break ;
1049 case kTextEncodingMacChineseSimp :
1050 enc = wxFONTENCODING_MACCHINESESIMP ;
1051 break ;
1052 case kTextEncodingMacTibetan :
1053 enc = wxFONTENCODING_MACTIBETAN ;
1054 break ;
1055 case kTextEncodingMacMongolian :
1056 enc = wxFONTENCODING_MACMONGOLIAN ;
1057 break ;
1058 case kTextEncodingMacEthiopic :
1059 enc = wxFONTENCODING_MACETHIOPIC ;
1060 break ;
1061 case kTextEncodingMacCentralEurRoman:
1062 enc = wxFONTENCODING_MACCENTRALEUR ;
1063 break ;
1064 case kTextEncodingMacVietnamese:
1065 enc = wxFONTENCODING_MACVIATNAMESE ;
1066 break ;
1067 case kTextEncodingMacExtArabic :
1068 enc = wxFONTENCODING_MACARABICEXT ;
1069 break ;
1070 case kTextEncodingMacSymbol :
1071 enc = wxFONTENCODING_MACSYMBOL ;
1072 break ;
1073 case kTextEncodingMacDingbats :
1074 enc = wxFONTENCODING_MACDINGBATS ;
1075 break ;
1076 case kTextEncodingMacTurkish :
1077 enc = wxFONTENCODING_MACTURKISH ;
1078 break ;
1079 case kTextEncodingMacCroatian :
1080 enc = wxFONTENCODING_MACCROATIAN ;
1081 break ;
1082 case kTextEncodingMacIcelandic :
1083 enc = wxFONTENCODING_MACICELANDIC ;
1084 break ;
1085 case kTextEncodingMacRomanian :
1086 enc = wxFONTENCODING_MACROMANIAN ;
1087 break ;
1088 case kTextEncodingMacCeltic :
1089 enc = wxFONTENCODING_MACCELTIC ;
1090 break ;
1091 case kTextEncodingMacGaelic :
1092 enc = wxFONTENCODING_MACGAELIC ;
1093 break ;
1094 case kTextEncodingMacKeyboardGlyphs :
1095 enc = wxFONTENCODING_MACKEYBOARD ;
9d8aca48
WS
1096 break ;
1097 } ;
1098 return enc ;
2646f485
SC
1099}
1100
1101#endif // wxUSE_BASE
1102
1103#if wxUSE_GUI
1104
1105
1106//
1107// CFStringRefs (Carbon only)
1108//
1109
1110#if TARGET_CARBON
1111
1112// converts this string into a carbon foundation string with optional pc 2 mac encoding
1113void wxMacCFStringHolder::Assign( const wxString &st , wxFontEncoding encoding )
1114{
9d8aca48 1115 Release() ;
2646f485 1116
9d8aca48 1117 wxString str = st ;
2646f485
SC
1118 wxMacConvertNewlines13To10( &str ) ;
1119#if wxUSE_UNICODE
1120#if SIZEOF_WCHAR_T == 2
9d8aca48
WS
1121 m_cfs = CFStringCreateWithCharacters( kCFAllocatorDefault,
1122 (UniChar*)str.wc_str() , str.Len() );
2646f485 1123#else
9d8aca48 1124 wxMBConvUTF16BE converter ;
2646f485
SC
1125 size_t unicharlen = converter.WC2MB( NULL , str.wc_str() , 0 ) ;
1126 UniChar *unibuf = new UniChar[ unicharlen / sizeof(UniChar) + 1 ] ;
1127 converter.WC2MB( (char*)unibuf , str.wc_str() , unicharlen ) ;
1128 m_cfs = CFStringCreateWithCharacters( kCFAllocatorDefault ,
1129 unibuf , unicharlen / sizeof(UniChar) ) ;
1130 delete[] unibuf ;
1131#endif
1132#else // not wxUSE_UNICODE
1133 m_cfs = CFStringCreateWithCString( kCFAllocatorSystemDefault , str.c_str() ,
1134 wxMacGetSystemEncFromFontEnc( encoding ) ) ;
1135#endif
1136 m_release = true ;
1137}
1138
1139wxString wxMacCFStringHolder::AsString(wxFontEncoding encoding)
1140{
1141 Size cflen = CFStringGetLength( m_cfs ) ;
1142 size_t noChars ;
1143 wxChar* buf = NULL ;
9d8aca48 1144
2646f485
SC
1145#if wxUSE_UNICODE
1146#if SIZEOF_WCHAR_T == 2
9d8aca48 1147 buf = new wxChar[ cflen + 1 ] ;
2646f485
SC
1148 CFStringGetCharacters( m_cfs , CFRangeMake( 0 , cflen ) , (UniChar*) buf ) ;
1149 noChars = cflen ;
1150#else
1151 UniChar* unibuf = new UniChar[ cflen + 1 ] ;
1152 CFStringGetCharacters( m_cfs , CFRangeMake( 0 , cflen ) , (UniChar*) unibuf ) ;
1153 unibuf[cflen] = 0 ;
9d8aca48
WS
1154 wxMBConvUTF16BE converter ;
1155 noChars = converter.MB2WC( NULL , (const char*)unibuf , 0 ) ;
2646f485
SC
1156 buf = new wxChar[ noChars + 1 ] ;
1157 converter.MB2WC( buf , (const char*)unibuf , noChars ) ;
1158 delete[] unibuf ;
1159#endif
1160#else
1161 CFIndex cStrLen ;
1162 CFStringGetBytes( m_cfs , CFRangeMake(0, cflen) , wxMacGetSystemEncFromFontEnc( encoding ) ,
1163 '?' , false , NULL , 0 , &cStrLen ) ;
9d8aca48 1164 buf = new wxChar[ cStrLen + 1 ] ;
2646f485
SC
1165 CFStringGetBytes( m_cfs , CFRangeMake(0, cflen) , wxMacGetSystemEncFromFontEnc( encoding ) ,
1166 '?' , false , (unsigned char*) buf , cStrLen , &cStrLen) ;
1167 noChars = cStrLen ;
1168#endif
1169
1170 buf[noChars] = 0 ;
1171 wxMacConvertNewlines10To13( buf ) ;
1172 wxString result(buf) ;
1173 delete[] buf ;
1174 return result ;
1175}
1176
1177#endif //TARGET_CARBON
1178
9d8aca48
WS
1179void wxMacConvertNewlines13To10( char * data )
1180{
1181 char * buf = data ;
2646f485
SC
1182 while( (buf=strchr(buf,0x0d)) != NULL )
1183 {
1184 *buf = 0x0a ;
1185 buf++ ;
1186 }
1187}
1188
1189void wxMacConvertNewlines10To13( char * data )
9d8aca48
WS
1190{
1191 char * buf = data ;
2646f485
SC
1192 while( (buf=strchr(buf,0x0a)) != NULL )
1193 {
1194 *buf = 0x0d ;
1195 buf++ ;
1196 }
1197}
1198
9d8aca48
WS
1199void wxMacConvertNewlines13To10( wxString * data )
1200{
88a7a4e1 1201 size_t len = data->length() ;
2646f485
SC
1202
1203 if ( len == 0 || wxStrchr(data->c_str(),0x0d)==NULL)
1204 return ;
9d8aca48 1205
2646f485
SC
1206 wxString temp(*data) ;
1207 wxStringBuffer buf(*data,len ) ;
9d8aca48 1208 memcpy( buf , temp.c_str() , (len+1)*sizeof(wxChar) ) ;
2646f485 1209
9d8aca48 1210 wxMacConvertNewlines13To10( buf ) ;
2646f485
SC
1211}
1212
1213void wxMacConvertNewlines10To13( wxString * data )
9d8aca48 1214{
88a7a4e1 1215 size_t len = data->length() ;
2646f485 1216
88a7a4e1 1217 if ( data->empty() || wxStrchr(data->c_str(),0x0a)==NULL)
2646f485
SC
1218 return ;
1219
1220 wxString temp(*data) ;
1221 wxStringBuffer buf(*data,len ) ;
9d8aca48
WS
1222 memcpy( buf , temp.c_str() , (len+1)*sizeof(wxChar) ) ;
1223 wxMacConvertNewlines10To13( buf ) ;
2646f485
SC
1224}
1225
1226
1227#if wxUSE_UNICODE
9d8aca48
WS
1228void wxMacConvertNewlines13To10( wxChar * data )
1229{
1230 wxChar * buf = data ;
2646f485
SC
1231 while( (buf=wxStrchr(buf,0x0d)) != NULL )
1232 {
1233 *buf = 0x0a ;
1234 buf++ ;
1235 }
1236}
1237
1238void wxMacConvertNewlines10To13( wxChar * data )
9d8aca48
WS
1239{
1240 wxChar * buf = data ;
2646f485
SC
1241 while( (buf=wxStrchr(buf,0x0a)) != NULL )
1242 {
1243 *buf = 0x0d ;
1244 buf++ ;
1245 }
1246}
1247#endif
1248
1249// ----------------------------------------------------------------------------
1250// debugging support
1251// ----------------------------------------------------------------------------
1252
1253#if defined(__WXMAC__) && !defined(__DARWIN__) && defined(__MWERKS__) && (__MWERKS__ >= 0x2400)
1254
1255// MetroNub stuff doesn't seem to work in CodeWarrior 5.3 Carbon builds...
1256
1257#ifndef __MetroNubUtils__
1258#include "MetroNubUtils.h"
1259#endif
1260
1261#ifndef __GESTALT__
1262#include <Gestalt.h>
1263#endif
1264
1265#if TARGET_API_MAC_CARBON
1266
1267 #include <CodeFragments.h>
1268
1269 extern "C" long CallUniversalProc(UniversalProcPtr theProcPtr, ProcInfoType procInfo, ...);
1270
1271 ProcPtr gCallUniversalProc_Proc = NULL;
1272
1273#endif
1274
1275static MetroNubUserEntryBlock* gMetroNubEntry = NULL;
1276
1277static long fRunOnce = false;
1278
1279/* ---------------------------------------------------------------------------
1280 IsMetroNubInstalled
1281 --------------------------------------------------------------------------- */
1282
1283Boolean IsMetroNubInstalled()
1284{
1285 if (!fRunOnce)
1286 {
1287 long result, value;
1288
1289 fRunOnce = true;
1290 gMetroNubEntry = NULL;
1291
1292 if (Gestalt(gestaltSystemVersion, &value) == noErr && value < 0x1000)
1293 {
1294 /* look for MetroNub's Gestalt selector */
1295 if (Gestalt(kMetroNubUserSignature, &result) == noErr)
1296 {
1297
1298 #if TARGET_API_MAC_CARBON
1299 if (gCallUniversalProc_Proc == NULL)
1300 {
1301 CFragConnectionID connectionID;
1302 Ptr mainAddress;
1303 Str255 errorString;
1304 ProcPtr symbolAddress;
1305 OSErr err;
1306 CFragSymbolClass symbolClass;
1307
1308 symbolAddress = NULL;
1309 err = GetSharedLibrary("\pInterfaceLib", kPowerPCCFragArch, kFindCFrag,
1310 &connectionID, &mainAddress, errorString);
1311
1312 if (err != noErr)
1313 {
1314 gCallUniversalProc_Proc = NULL;
1315 goto end;
1316 }
1317
1318 err = FindSymbol(connectionID, "\pCallUniversalProc",
1319 (Ptr *) &gCallUniversalProc_Proc, &symbolClass);
1320
1321 if (err != noErr)
1322 {
1323 gCallUniversalProc_Proc = NULL;
1324 goto end;
1325 }
1326 }
1327 #endif
1328
1329 {
1330 MetroNubUserEntryBlock* block = (MetroNubUserEntryBlock *)result;
1331
1332 /* make sure the version of the API is compatible */
1333 if (block->apiLowVersion <= kMetroNubUserAPIVersion &&
1334 kMetroNubUserAPIVersion <= block->apiHiVersion)
1335 gMetroNubEntry = block; /* success! */
1336 }
1337
1338 }
1339 }
1340 }
1341
1342end:
1343
1344#if TARGET_API_MAC_CARBON
1345 return (gMetroNubEntry != NULL && gCallUniversalProc_Proc != NULL);
1346#else
1347 return (gMetroNubEntry != NULL);
1348#endif
1349}
1350
1351/* ---------------------------------------------------------------------------
1352 IsMWDebuggerRunning [v1 API]
1353 --------------------------------------------------------------------------- */
1354
1355Boolean IsMWDebuggerRunning()
1356{
1357 if (IsMetroNubInstalled())
1358 return CallIsDebuggerRunningProc(gMetroNubEntry->isDebuggerRunning);
1359 else
1360 return false;
1361}
1362
1363/* ---------------------------------------------------------------------------
1364 AmIBeingMWDebugged [v1 API]
1365 --------------------------------------------------------------------------- */
1366
1367Boolean AmIBeingMWDebugged()
1368{
1369 if (IsMetroNubInstalled())
1370 return CallAmIBeingDebuggedProc(gMetroNubEntry->amIBeingDebugged);
1371 else
1372 return false;
1373}
1374
1375extern bool WXDLLEXPORT wxIsDebuggerRunning()
1376{
1377 return IsMWDebuggerRunning() && AmIBeingMWDebugged();
1378}
1379
1380#else
1381
1382extern bool WXDLLEXPORT wxIsDebuggerRunning()
1383{
1384 return false;
1385}
1386
1387#endif // defined(__WXMAC__) && !defined(__DARWIN__) && (__MWERKS__ >= 0x2400)
1388
1389#endif // wxUSE_GUI