1 /////////////////////////////////////////////////////////////////////////////
 
   3 // Purpose:     SWIG interface file wxFont, local, converters, etc.
 
   9 // Copyright:   (c) 2002 by Total Control Software
 
  10 // Licence:     wxWindows license
 
  11 /////////////////////////////////////////////////////////////////////////////
 
  18 #include <wx/fontmap.h>
 
  19 #include <wx/fontenc.h>
 
  20 #include <wx/fontutil.h>
 
  21 #include <wx/fontenum.h>
 
  23 #include <wx/encconv.h>
 
  26 //----------------------------------------------------------------------
 
  29 %include my_typemaps.i
 
  31 // Import some definitions of other classes, etc.
 
  36 //---------------------------------------------------------------------------
 
  38     // Put some wx default wxChar* values into wxStrings.
 
  39     static const wxString wxPyEmptyString(wxT(""));
 
  41 //---------------------------------------------------------------------------
 
  47     wxFONTFAMILY_DEFAULT = wxDEFAULT,
 
  48     wxFONTFAMILY_DECORATIVE = wxDECORATIVE,
 
  49     wxFONTFAMILY_ROMAN = wxROMAN,
 
  50     wxFONTFAMILY_SCRIPT = wxSCRIPT,
 
  51     wxFONTFAMILY_SWISS = wxSWISS,
 
  52     wxFONTFAMILY_MODERN = wxMODERN,
 
  53     wxFONTFAMILY_TELETYPE = wxTELETYPE,
 
  61     wxFONTSTYLE_NORMAL = wxNORMAL,
 
  62     wxFONTSTYLE_ITALIC = wxITALIC,
 
  63     wxFONTSTYLE_SLANT = wxSLANT,
 
  70     wxFONTWEIGHT_NORMAL = wxNORMAL,
 
  71     wxFONTWEIGHT_LIGHT = wxLIGHT,
 
  72     wxFONTWEIGHT_BOLD = wxBOLD,
 
  80     wxFONTENCODING_SYSTEM = -1,     // system default
 
  81     wxFONTENCODING_DEFAULT,         // current default encoding
 
  83     // ISO8859 standard defines a number of single-byte charsets
 
  84     wxFONTENCODING_ISO8859_1,       // West European (Latin1)
 
  85     wxFONTENCODING_ISO8859_2,       // Central and East European (Latin2)
 
  86     wxFONTENCODING_ISO8859_3,       // Esperanto (Latin3)
 
  87     wxFONTENCODING_ISO8859_4,       // Baltic (old) (Latin4)
 
  88     wxFONTENCODING_ISO8859_5,       // Cyrillic
 
  89     wxFONTENCODING_ISO8859_6,       // Arabic
 
  90     wxFONTENCODING_ISO8859_7,       // Greek
 
  91     wxFONTENCODING_ISO8859_8,       // Hebrew
 
  92     wxFONTENCODING_ISO8859_9,       // Turkish (Latin5)
 
  93     wxFONTENCODING_ISO8859_10,      // Variation of Latin4 (Latin6)
 
  94     wxFONTENCODING_ISO8859_11,      // Thai
 
  95     wxFONTENCODING_ISO8859_12,      // doesn't exist currently, but put it
 
  96                                     // here anyhow to make all ISO8859
 
  97                                     // consecutive numbers
 
  98     wxFONTENCODING_ISO8859_13,      // Baltic (Latin7)
 
  99     wxFONTENCODING_ISO8859_14,      // Latin8
 
 100     wxFONTENCODING_ISO8859_15,      // Latin9 (a.k.a. Latin0, includes euro)
 
 101     wxFONTENCODING_ISO8859_MAX,
 
 103     // Cyrillic charset soup (see http://czyborra.com/charsets/cyrillic.html)
 
 104     wxFONTENCODING_KOI8,            // we don't support any of KOI8 variants
 
 105     wxFONTENCODING_ALTERNATIVE,     // same as MS-DOS CP866
 
 106     wxFONTENCODING_BULGARIAN,       // used under Linux in Bulgaria
 
 108     // what would we do without Microsoft? They have their own encodings
 
 110     wxFONTENCODING_CP437,           // original MS-DOS codepage
 
 111     wxFONTENCODING_CP850,           // CP437 merged with Latin1
 
 112     wxFONTENCODING_CP852,           // CP437 merged with Latin2
 
 113     wxFONTENCODING_CP855,           // another cyrillic encoding
 
 114     wxFONTENCODING_CP866,           // and another one
 
 116     wxFONTENCODING_CP874,           // WinThai
 
 117     wxFONTENCODING_CP932,           // Japanese (shift-JIS)
 
 118     wxFONTENCODING_CP936,           // Chiniese simplified (GB)
 
 119     wxFONTENCODING_CP949,           // Korean (Hangul charset)
 
 120     wxFONTENCODING_CP950,           // Chinese (traditional - Big5)
 
 121     wxFONTENCODING_CP1250,          // WinLatin2
 
 122     wxFONTENCODING_CP1251,          // WinCyrillic
 
 123     wxFONTENCODING_CP1252,          // WinLatin1
 
 124     wxFONTENCODING_CP1253,          // WinGreek (8859-7)
 
 125     wxFONTENCODING_CP1254,          // WinTurkish
 
 126     wxFONTENCODING_CP1255,          // WinHebrew
 
 127     wxFONTENCODING_CP1256,          // WinArabic
 
 128     wxFONTENCODING_CP1257,          // WinBaltic (same as Latin 7)
 
 129     wxFONTENCODING_CP12_MAX,
 
 131     wxFONTENCODING_UTF7,            // UTF-7 Unicode encoding
 
 132     wxFONTENCODING_UTF8,            // UTF-8 Unicode encoding
 
 134     wxFONTENCODING_UNICODE,         // Unicode - currently used only by
 
 135                                     // wxEncodingConverter class
 
 142 //---------------------------------------------------------------------------
 
 143 // wxNativeFontInfo is platform-specific font representation: this struct
 
 144 // should be considered as opaque font description only used by the native
 
 145 // functions, the user code can only get the objects of this type from
 
 146 // somewhere and pass it somewhere else (possibly save them somewhere using
 
 147 // ToString() and restore them using FromString())
 
 148 struct wxNativeFontInfo
 
 151     // init the elements from an XLFD, return TRUE if ok
 
 152     bool FromXFontName(const wxString& xFontName);
 
 154     // return false if we were never initialized with a valid XLFD
 
 155     bool IsDefault() const;
 
 157     // generate an XLFD using the fontElements
 
 158     wxString GetXFontName() const;
 
 161     void SetXFontName(const wxString& xFontName);
 
 164     wxNativeFontInfo() { Init(); }
 
 166     // reset to the default state
 
 170     // accessors and modifiers for the font elements
 
 171     int GetPointSize() const;
 
 172     wxFontStyle GetStyle() const;
 
 173     wxFontWeight GetWeight() const;
 
 174     bool GetUnderlined() const;
 
 175     wxString GetFaceName() const;
 
 176     wxFontFamily GetFamily() const;
 
 177     wxFontEncoding GetEncoding() const;
 
 179     void SetPointSize(int pointsize);
 
 180     void SetStyle(wxFontStyle style);
 
 181     void SetWeight(wxFontWeight weight);
 
 182     void SetUnderlined(bool underlined);
 
 183     void SetFaceName(wxString facename);
 
 184     void SetFamily(wxFontFamily family);
 
 185     void SetEncoding(wxFontEncoding encoding);
 
 188     // it is important to be able to serialize wxNativeFontInfo objects to be
 
 189     // able to store them (in config file, for example)
 
 190     bool FromString(const wxString& s);
 
 191     wxString ToString() const;
 
 195             return self->ToString();
 
 199     // we also want to present the native font descriptions to the user in some
 
 200     // human-readable form (it is not platform independent neither, but can
 
 201     // hopefully be understood by the user)
 
 202     bool FromUserString(const wxString& s);
 
 203     wxString ToUserString() const;
 
 207 //---------------------------------------------------------------------------
 
 208 // wxFontMapper manages user-definable correspondence between logical font
 
 209 // names and the fonts present on the machine.
 
 211 // The default implementations of all functions will ask the user if they are
 
 212 // not capable of finding the answer themselves and store the answer in a
 
 213 // config file (configurable via SetConfigXXX functions). This behaviour may
 
 214 // be disabled by giving the value of FALSE to "interactive" parameter.
 
 215 // However, the functions will always consult the config file to allow the
 
 216 // user-defined values override the default logic and there is no way to
 
 217 // disable this - which shouldn't be ever needed because if "interactive" was
 
 218 // never TRUE, the config file is never created anyhow.
 
 225     // return instance of the wxFontMapper singleton
 
 226     static wxFontMapper *Get();
 
 227     // set the sigleton to 'mapper' instance and return previous one
 
 228     static wxFontMapper *Set(wxFontMapper *mapper);
 
 231     // find an alternative for the given encoding (which is supposed to not be
 
 232     // available on this system). If successful, return TRUE and rwxFontEcoding
 
 233     // that can be used it wxFont ctor otherwise return FALSE
 
 234     //bool GetAltForEncoding(wxFontEncoding encoding,
 
 235     //                       wxFontEncoding *alt_encoding,
 
 236     //                       const wxString& facename = wxPyEmptyString,
 
 237     //                       bool interactive = TRUE);
 
 240     // Find an alternative for the given encoding (which is supposed to not be
 
 241     // available on this system). If successful, returns the encoding otherwise
 
 244         PyObject* GetAltForEncoding(wxFontEncoding encoding,
 
 245                                     const wxString& facename = wxPyEmptyString,
 
 246                                     bool interactive = TRUE) {
 
 247             wxFontEncoding alt_enc;
 
 248             if (self->GetAltForEncoding(encoding, &alt_enc, facename, interactive))
 
 249                 return PyInt_FromLong(alt_enc);
 
 258     // checks whether given encoding is available in given face or not.
 
 259     // If no facename is given,
 
 260     bool IsEncodingAvailable(wxFontEncoding encoding,
 
 261                              const wxString& facename = wxPyEmptyString);
 
 263     // returns the encoding for the given charset (in the form of RFC 2046) or
 
 264     // wxFONTENCODING_SYSTEM if couldn't decode it
 
 265     wxFontEncoding CharsetToEncoding(const wxString& charset,
 
 266                                      bool interactive = TRUE);
 
 268     // return internal string identifier for the encoding (see also
 
 269     // GetEncodingDescription())
 
 270     static wxString GetEncodingName(wxFontEncoding encoding);
 
 272     // return user-readable string describing the given encoding
 
 274     // NB: hard-coded now, but might change later (read it from config?)
 
 275     static wxString GetEncodingDescription(wxFontEncoding encoding);
 
 277     // the parent window for modal dialogs
 
 278     void SetDialogParent(wxWindow *parent);
 
 280     // the title for the dialogs (note that default is quite reasonable)
 
 281     void SetDialogTitle(const wxString& title);
 
 283     // functions which allow to configure the config object used: by default,
 
 284     // the global one (from wxConfigBase::Get() will be used) and the default
 
 285     // root path for the config settings is the string returned by
 
 286     // GetDefaultConfigPath()
 
 289     // set the config object to use (may be NULL to use default)
 
 290     void SetConfig(wxConfigBase *config);
 
 292     // set the root config path to use (should be an absolute path)
 
 293     void SetConfigPath(const wxString& prefix);
 
 295     // return default config path
 
 296     static wxString GetDefaultConfigPath();
 
 301 //---------------------------------------------------------------------------
 
 303 class wxFont : public wxObject {
 
 305     wxFont( int pointSize, int family, int style, int weight,
 
 306             int underline=FALSE, const wxString& faceName = wxPyEmptyString,
 
 307             wxFontEncoding encoding=wxFONTENCODING_DEFAULT);
 
 309     %name(wxFontFromNativeInfo)wxFont(const wxNativeFontInfo& info);
 
 314     int GetPointSize() const;
 
 315     int GetFamily() const;
 
 316     int GetStyle() const;
 
 317     int GetWeight() const;
 
 318     bool GetUnderlined() const;
 
 319     wxString GetFaceName() const;
 
 320     wxFontEncoding GetEncoding() const;
 
 324     wxNativeFontInfo* GetNativeFontInfo() const;
 
 325     wxString GetNativeFontInfoDesc() const;
 
 326     wxString GetNativeFontInfoUserDesc() const;
 
 328     void SetPointSize(int pointSize);
 
 329     void SetFamily(int family);
 
 330     void SetStyle(int style);
 
 331     void SetWeight(int weight);
 
 332     void SetFaceName(const wxString& faceName);
 
 333     void SetUnderlined(bool underlined);
 
 334     void SetEncoding(wxFontEncoding encoding);
 
 335     void SetNativeFontInfo(const wxNativeFontInfo& info);
 
 336     // void SetNativeFontInfo(const wxString& info);
 
 337     void SetNativeFontInfoUserDesc(const wxString& info);
 
 339     wxString GetFamilyString() const;
 
 340     wxString GetStyleString() const;
 
 341     wxString GetWeightString() const;
 
 343     static wxFontEncoding GetDefaultEncoding();
 
 344     static void SetDefaultEncoding(wxFontEncoding encoding);
 
 349 class wxFontList : public wxObject {
 
 352     void AddFont(wxFont* font);
 
 353     wxFont * FindOrCreateFont(int point_size, int family, int style, int weight,
 
 354                               bool underline = FALSE, const wxString& facename = wxPyEmptyString,
 
 355                               wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
 
 356     void RemoveFont(wxFont *font);
 
 362 //----------------------------------------------------------------------
 
 366 class wxPyFontEnumerator : public wxFontEnumerator {
 
 368     wxPyFontEnumerator() {}
 
 369     ~wxPyFontEnumerator() {}
 
 371     DEC_PYCALLBACK_BOOL_STRING(OnFacename);
 
 372     DEC_PYCALLBACK_BOOL_STRINGSTRING(OnFontEncoding);
 
 377 IMP_PYCALLBACK_BOOL_STRING(wxPyFontEnumerator, wxFontEnumerator, OnFacename);
 
 378 IMP_PYCALLBACK_BOOL_STRINGSTRING(wxPyFontEnumerator, wxFontEnumerator, OnFontEncoding);
 
 382 %name(wxFontEnumerator) class wxPyFontEnumerator {
 
 384     wxPyFontEnumerator();
 
 385     ~wxPyFontEnumerator();
 
 386     void _setCallbackInfo(PyObject* self, PyObject* _class, bool incref);
 
 387     %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxFontEnumerator, 0)"
 
 389     bool EnumerateFacenames(
 
 390         wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all
 
 391         bool fixedWidthOnly = FALSE);
 
 392     bool EnumerateEncodings(const wxString& facename = wxPyEmptyString);
 
 394     //wxArrayString* GetEncodings();
 
 395     //wxArrayString* GetFacenames();
 
 397         PyObject* GetEncodings() {
 
 398             wxArrayString* arr = self->GetEncodings();
 
 399             return wxArrayString2PyList_helper(*arr);
 
 402         PyObject* GetFacenames() {
 
 403             wxArrayString* arr = self->GetFacenames();
 
 404             return wxArrayString2PyList_helper(*arr);
 
 409 //---------------------------------------------------------------------------
 
 410 // wxLocale.  Not really font related, but close enough
 
 418     wxLANGUAGE_ABKHAZIAN,
 
 420     wxLANGUAGE_AFRIKAANS,
 
 424     wxLANGUAGE_ARABIC_ALGERIA,
 
 425     wxLANGUAGE_ARABIC_BAHRAIN,
 
 426     wxLANGUAGE_ARABIC_EGYPT,
 
 427     wxLANGUAGE_ARABIC_IRAQ,
 
 428     wxLANGUAGE_ARABIC_JORDAN,
 
 429     wxLANGUAGE_ARABIC_KUWAIT,
 
 430     wxLANGUAGE_ARABIC_LEBANON,
 
 431     wxLANGUAGE_ARABIC_LIBYA,
 
 432     wxLANGUAGE_ARABIC_MOROCCO,
 
 433     wxLANGUAGE_ARABIC_OMAN,
 
 434     wxLANGUAGE_ARABIC_QATAR,
 
 435     wxLANGUAGE_ARABIC_SAUDI_ARABIA,
 
 436     wxLANGUAGE_ARABIC_SUDAN,
 
 437     wxLANGUAGE_ARABIC_SYRIA,
 
 438     wxLANGUAGE_ARABIC_TUNISIA,
 
 439     wxLANGUAGE_ARABIC_UAE,
 
 440     wxLANGUAGE_ARABIC_YEMEN,
 
 445     wxLANGUAGE_AZERI_CYRILLIC,
 
 446     wxLANGUAGE_AZERI_LATIN,
 
 449     wxLANGUAGE_BELARUSIAN,
 
 455     wxLANGUAGE_BULGARIAN,
 
 457     wxLANGUAGE_CAMBODIAN,
 
 460     wxLANGUAGE_CHINESE_SIMPLIFIED,
 
 461     wxLANGUAGE_CHINESE_TRADITIONAL,
 
 462     wxLANGUAGE_CHINESE_HONGKONG,
 
 463     wxLANGUAGE_CHINESE_MACAU,
 
 464     wxLANGUAGE_CHINESE_SINGAPORE,
 
 465     wxLANGUAGE_CHINESE_TAIWAN,
 
 471     wxLANGUAGE_DUTCH_BELGIAN,
 
 473     wxLANGUAGE_ENGLISH_UK,
 
 474     wxLANGUAGE_ENGLISH_US,
 
 475     wxLANGUAGE_ENGLISH_AUSTRALIA,
 
 476     wxLANGUAGE_ENGLISH_BELIZE,
 
 477     wxLANGUAGE_ENGLISH_BOTSWANA,
 
 478     wxLANGUAGE_ENGLISH_CANADA,
 
 479     wxLANGUAGE_ENGLISH_CARIBBEAN,
 
 480     wxLANGUAGE_ENGLISH_DENMARK,
 
 481     wxLANGUAGE_ENGLISH_EIRE,
 
 482     wxLANGUAGE_ENGLISH_JAMAICA,
 
 483     wxLANGUAGE_ENGLISH_NEW_ZEALAND,
 
 484     wxLANGUAGE_ENGLISH_PHILIPPINES,
 
 485     wxLANGUAGE_ENGLISH_SOUTH_AFRICA,
 
 486     wxLANGUAGE_ENGLISH_TRINIDAD,
 
 487     wxLANGUAGE_ENGLISH_ZIMBABWE,
 
 488     wxLANGUAGE_ESPERANTO,
 
 495     wxLANGUAGE_FRENCH_BELGIAN,
 
 496     wxLANGUAGE_FRENCH_CANADIAN,
 
 497     wxLANGUAGE_FRENCH_LUXEMBOURG,
 
 498     wxLANGUAGE_FRENCH_MONACO,
 
 499     wxLANGUAGE_FRENCH_SWISS,
 
 504     wxLANGUAGE_GERMAN_AUSTRIAN,
 
 505     wxLANGUAGE_GERMAN_BELGIUM,
 
 506     wxLANGUAGE_GERMAN_LIECHTENSTEIN,
 
 507     wxLANGUAGE_GERMAN_LUXEMBOURG,
 
 508     wxLANGUAGE_GERMAN_SWISS,
 
 510     wxLANGUAGE_GREENLANDIC,
 
 516     wxLANGUAGE_HUNGARIAN,
 
 517     wxLANGUAGE_ICELANDIC,
 
 518     wxLANGUAGE_INDONESIAN,
 
 519     wxLANGUAGE_INTERLINGUA,
 
 520     wxLANGUAGE_INTERLINGUE,
 
 521     wxLANGUAGE_INUKTITUT,
 
 525     wxLANGUAGE_ITALIAN_SWISS,
 
 530     wxLANGUAGE_KASHMIRI_INDIA,
 
 533     wxLANGUAGE_KINYARWANDA,
 
 543     wxLANGUAGE_LITHUANIAN,
 
 544     wxLANGUAGE_MACEDONIAN,
 
 547     wxLANGUAGE_MALAYALAM,
 
 548     wxLANGUAGE_MALAY_BRUNEI_DARUSSALAM,
 
 549     wxLANGUAGE_MALAY_MALAYSIA,
 
 554     wxLANGUAGE_MOLDAVIAN,
 
 555     wxLANGUAGE_MONGOLIAN,
 
 558     wxLANGUAGE_NEPALI_INDIA,
 
 559     wxLANGUAGE_NORWEGIAN_BOKMAL,
 
 560     wxLANGUAGE_NORWEGIAN_NYNORSK,
 
 566     wxLANGUAGE_PORTUGUESE,
 
 567     wxLANGUAGE_PORTUGUESE_BRAZILIAN,
 
 570     wxLANGUAGE_RHAETO_ROMANCE,
 
 573     wxLANGUAGE_RUSSIAN_UKRAINE,
 
 577     wxLANGUAGE_SCOTS_GAELIC,
 
 579     wxLANGUAGE_SERBIAN_CYRILLIC,
 
 580     wxLANGUAGE_SERBIAN_LATIN,
 
 581     wxLANGUAGE_SERBO_CROATIAN,
 
 586     wxLANGUAGE_SINHALESE,
 
 589     wxLANGUAGE_SLOVENIAN,
 
 592     wxLANGUAGE_SPANISH_ARGENTINA,
 
 593     wxLANGUAGE_SPANISH_BOLIVIA,
 
 594     wxLANGUAGE_SPANISH_CHILE,
 
 595     wxLANGUAGE_SPANISH_COLOMBIA,
 
 596     wxLANGUAGE_SPANISH_COSTA_RICA,
 
 597     wxLANGUAGE_SPANISH_DOMINICAN_REPUBLIC,
 
 598     wxLANGUAGE_SPANISH_ECUADOR,
 
 599     wxLANGUAGE_SPANISH_EL_SALVADOR,
 
 600     wxLANGUAGE_SPANISH_GUATEMALA,
 
 601     wxLANGUAGE_SPANISH_HONDURAS,
 
 602     wxLANGUAGE_SPANISH_MEXICAN,
 
 603     wxLANGUAGE_SPANISH_MODERN,
 
 604     wxLANGUAGE_SPANISH_NICARAGUA,
 
 605     wxLANGUAGE_SPANISH_PANAMA,
 
 606     wxLANGUAGE_SPANISH_PARAGUAY,
 
 607     wxLANGUAGE_SPANISH_PERU,
 
 608     wxLANGUAGE_SPANISH_PUERTO_RICO,
 
 609     wxLANGUAGE_SPANISH_URUGUAY,
 
 610     wxLANGUAGE_SPANISH_US,
 
 611     wxLANGUAGE_SPANISH_VENEZUELA,
 
 612     wxLANGUAGE_SUNDANESE,
 
 615     wxLANGUAGE_SWEDISH_FINLAND,
 
 630     wxLANGUAGE_UKRAINIAN,
 
 632     wxLANGUAGE_URDU_INDIA,
 
 633     wxLANGUAGE_URDU_PAKISTAN,
 
 635     wxLANGUAGE_UZBEK_CYRILLIC,
 
 636     wxLANGUAGE_UZBEK_LATIN,
 
 637     wxLANGUAGE_VIETNAMESE,
 
 647     // for custom, user-defined languages:
 
 648     wxLANGUAGE_USER_DEFINED
 
 651 // wxLanguageInfo: encapsulates wxLanguage to OS native lang.desc.
 
 652 //                 translation information
 
 656     int Language;                   // wxLanguage id
 
 657     wxString CanonicalName;         // Canonical name, e.g. fr_FR
 
 658     wxString Description;           // human-readable name of the language
 
 661 // wxLocaleCategory: the category of locale settings
 
 662 enum wxLocaleCategory
 
 670 // wxLocaleInfo: the items understood by wxLocale::GetInfo()
 
 673     wxLOCALE_THOUSANDS_SEP,
 
 674     wxLOCALE_DECIMAL_POINT
 
 678 // wxLocale: encapsulates all language dependent settings, including current
 
 679 //           message catalogs, date, time and currency formats (TODO) &c
 
 680 enum wxLocaleInitFlags
 
 682     wxLOCALE_LOAD_DEFAULT  = 0x0001,     // load wxwin.mo?
 
 683     wxLOCALE_CONV_ENCODING = 0x0002      // convert encoding on the fly?
 
 691     wxLocale(int language = wxLANGUAGE_DEFAULT,
 
 692              int flags = wxLOCALE_LOAD_DEFAULT | wxLOCALE_CONV_ENCODING);
 
 694         // the same as a function (returns TRUE on success)
 
 695     bool Init(const wxString& szName,
 
 696               const wxString& szShort = wxPyEmptyString,
 
 697               const wxString& szLocale = wxPyEmptyString,
 
 698               bool bLoadDefault = TRUE,
 
 699               bool bConvertEncoding = FALSE);
 
 701         // restores old locale
 
 704     // Try to get user's (or OS's) prefered language setting.
 
 705     // Return wxLANGUAGE_UNKNOWN if language-guessing algorithm failed
 
 706     static int GetSystemLanguage();
 
 708     // get the encoding used by default for text on this system, returns
 
 709     // wxFONTENCODING_SYSTEM if it couldn't be determined
 
 710     static wxFontEncoding GetSystemEncoding();
 
 712     // get the string describing the system encoding, return empty string if
 
 713     // couldn't be determined
 
 714     static wxString GetSystemEncodingName();
 
 717     // THIS ONE IS COMMENTED OUT IN src/common/intl.cpp
 
 718     // get the values of the given locale-dependent datum: the current locale
 
 719     // is used, the US default value is returned if everything else fails
 
 720     // static wxString GetInfo(wxLocaleInfo index, wxLocaleCategory cat);
 
 722     // return TRUE if the locale was set successfully
 
 725     // returns locale name
 
 726     wxString GetLocale() const;
 
 728     // return current locale wxLanguage value
 
 729     int GetLanguage() const;
 
 731     // return locale name to be passed to setlocale()
 
 732     wxString GetSysName() const;
 
 734     // return 'canonical' name, i.e. in the form of xx[_YY], where xx is
 
 735     // language code according to ISO 639 and YY is country name
 
 736     // as specified by ISO 3166.
 
 737     wxString GetCanonicalName() const;
 
 739     // add a prefix to the catalog lookup path: the message catalog files will be
 
 740     // looked up under prefix/<lang>/LC_MESSAGES, prefix/LC_MESSAGES and prefix
 
 743     // This only applies to subsequent invocations of AddCatalog()!
 
 744     static void AddCatalogLookupPathPrefix(const wxString& prefix);
 
 746     // add a catalog: it's searched for in standard places (current directory
 
 747     // first, system one after), but the you may prepend additional directories to
 
 748     // the search path with AddCatalogLookupPathPrefix().
 
 750     // The loaded catalog will be used for message lookup by GetString().
 
 752     // Returns 'true' if it was successfully loaded
 
 753     bool AddCatalog(const wxString& szDomain);
 
 755     // check if the given catalog is loaded
 
 756     bool IsLoaded(const wxString& szDomain) const;
 
 758     // Add custom language to the list of known languages.
 
 759     // Notes: 1) wxLanguageInfo contains platform-specific data
 
 760     //        2) must be called before Init to have effect
 
 761     static void AddLanguage(const wxLanguageInfo& info);
 
 763     // retrieve the translation for a string in all loaded domains unless
 
 764     // the szDomain parameter is specified (and then only this domain is
 
 767     // return original string if translation is not available
 
 768     // (in this case an error message is generated the first time
 
 769     //  a string is not found; use wxLogNull to suppress it)
 
 771     // domains are searched in the last to first order, i.e. catalogs
 
 772     // added later override those added before.
 
 773     wxString GetString(const wxString& szOrigString,
 
 774                        const wxString& szDomain = wxPyEmptyString) const;
 
 776     // Returns the current short name for the locale
 
 777     const wxString& GetName() const;
 
 783 // get the current locale object (note that it may be NULL!)
 
 784 wxLocale* wxGetLocale();
 
 786 // get the translation of the string in the current locale
 
 787 wxString wxGetTranslation(const wxString& sz);
 
 790 //----------------------------------------------------------------------
 
 791 // wxEncodingConverter
 
 792 //                  This class is capable of converting strings between any two
 
 793 //                  8bit encodings/charsets. It can also convert from/to Unicode
 
 796 %typemap(python, out) wxFontEncodingArray {
 
 797     $target = PyList_New(0);
 
 798     for (size_t i=0; i < $source->GetCount(); i++) {
 
 799         PyObject* number = PyInt_FromLong($source->Item(i));
 
 800         PyList_Append($target, number);
 
 815     wxPLATFORM_CURRENT = -1,
 
 824 class wxEncodingConverter : public wxObject
 
 828     wxEncodingConverter();
 
 829     ~wxEncodingConverter();
 
 832     // Initialize convertion. Both output or input encoding may
 
 833     // be wxFONTENCODING_UNICODE, but only if wxUSE_WCHAR_T is set to 1.
 
 835     // All subsequent calls to Convert() will interpret it's argument
 
 836     // as a string in input_enc encoding and will output string in
 
 837     // output_enc encoding.
 
 839     // You must call this method before calling Convert. You may call
 
 840     // it more than once in order to switch to another conversion
 
 842     // Method affects behaviour of Convert() in case input character
 
 843     // cannot be converted because it does not exist in output encoding:
 
 844     //     wxCONVERT_STRICT --
 
 845     //              follow behaviour of GNU Recode - just copy unconvertable
 
 846     //              characters to output and don't change them (it's integer
 
 847     //              value will stay the same)
 
 848     //     wxCONVERT_SUBSTITUTE --
 
 849     //              try some (lossy) substitutions - e.g. replace
 
 850     //              unconvertable latin capitals with acute by ordinary
 
 851     //              capitals, replace en-dash or em-dash by '-' etc.
 
 852     //     both modes gurantee that output string will have same length
 
 855     // Returns FALSE if given conversion is impossible, TRUE otherwise
 
 856     // (conversion may be impossible either if you try to convert
 
 857     // to Unicode with non-Unicode build of wxWindows or if input
 
 858     // or output encoding is not supported.)
 
 859     bool Init(wxFontEncoding input_enc, wxFontEncoding output_enc, int method = wxCONVERT_STRICT);
 
 862     // TODO:  Need to do something about unicode mode...
 
 864     // Convert input string according to settings passed to Init.
 
 865     // Note that you must call Init before using Convert!
 
 866     wxString Convert(const wxString& input);
 
 868     // void Convert(const char* input, char* output);
 
 871 //              void Convert(const char* input, wchar_t* output);
 
 872 //              void Convert(const wchar_t* input, char* output);
 
 873 //              void Convert(const wchar_t* input, wchar_t* output);
 
 874 //              void Convert(wchar_t* str) { Convert(str, str); }
 
 879     // Return equivalent(s) for given font that are used
 
 880     // under given platform. wxPLATFORM_CURRENT means the plaform
 
 881     // this binary was compiled for
 
 884     //     current platform          enc    returned value
 
 885     // -----------------------------------------------------
 
 886     //     unix                   CP1250         {ISO8859_2}
 
 888     //     windows             ISO8859_2            {CP1250}
 
 890     // Equivalence is defined in terms of convertibility:
 
 891     // 2 encodings are equivalent if you can convert text between
 
 892     // then without loosing information (it may - and will - happen
 
 893     // that you loose special chars like quotation marks or em-dashes
 
 894     // but you shouldn't loose any diacritics and language-specific
 
 895     // characters when converting between equivalent encodings).
 
 897     // Convert() method is not limited to converting between
 
 898     // equivalent encodings, it can convert between arbitrary
 
 901     // Remember that this function does _NOT_ check for presence of
 
 902     // fonts in system. It only tells you what are most suitable
 
 903     // encodings. (It usually returns only one encoding)
 
 905     // Note that argument enc itself may be present in returned array!
 
 906     // (so that you can -- as a side effect -- detect whether the
 
 907     // encoding is native for this platform or not)
 
 908     static wxFontEncodingArray GetPlatformEquivalents(wxFontEncoding enc,
 
 909                                                       int platform = wxPLATFORM_CURRENT);
 
 911     // Similar to GetPlatformEquivalent, but this one will return ALL
 
 912     // equivalent encodings, regardless the platform, including itself.
 
 913     static wxFontEncodingArray GetAllEquivalents(wxFontEncoding enc);
 
 918 //----------------------------------------------------------------------
 
 919 //----------------------------------------------------------------------
 
 922     wxPyPtrTypeMap_Add("wxFontEnumerator", "wxPyFontEnumerator");
 
 925 //----------------------------------------------------------------------