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