X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9cca52ba2be26a227b45271e96209b96658478b3..004ee6daa7a24c9b27baa121915ac530219d4b57:/wxPython/src/_font.i diff --git a/wxPython/src/_font.i b/wxPython/src/_font.i index fc4d975bbf..b54b16dc41 100644 --- a/wxPython/src/_font.i +++ b/wxPython/src/_font.i @@ -61,33 +61,26 @@ enum wxFontWeight enum { // no special flags: font with default weight/slant/anti-aliasing - wxFONTFLAG_DEFAULT = 0, + wxFONTFLAG_DEFAULT, // slant flags (default: no slant) - wxFONTFLAG_ITALIC = 1 << 0, - wxFONTFLAG_SLANT = 1 << 1, + wxFONTFLAG_ITALIC, + wxFONTFLAG_SLANT, // weight flags (default: medium) - wxFONTFLAG_LIGHT = 1 << 2, - wxFONTFLAG_BOLD = 1 << 3, + wxFONTFLAG_LIGHT, + wxFONTFLAG_BOLD, // anti-aliasing flag: force on or off (default: the current system default) - wxFONTFLAG_ANTIALIASED = 1 << 4, - wxFONTFLAG_NOT_ANTIALIASED = 1 << 5, + wxFONTFLAG_ANTIALIASED, + wxFONTFLAG_NOT_ANTIALIASED, // underlined/strikethrough flags (default: no lines) - wxFONTFLAG_UNDERLINED = 1 << 6, - wxFONTFLAG_STRIKETHROUGH = 1 << 7, + wxFONTFLAG_UNDERLINED, + wxFONTFLAG_STRIKETHROUGH, // the mask of all currently used flags - wxFONTFLAG_MASK = wxFONTFLAG_ITALIC | - wxFONTFLAG_SLANT | - wxFONTFLAG_LIGHT | - wxFONTFLAG_BOLD | - wxFONTFLAG_ANTIALIASED | - wxFONTFLAG_NOT_ANTIALIASED | - wxFONTFLAG_UNDERLINED | - wxFONTFLAG_STRIKETHROUGH + wxFONTFLAG_MASK }; @@ -118,7 +111,8 @@ enum wxFontEncoding wxFONTENCODING_ISO8859_MAX, // Cyrillic charset soup (see http://czyborra.com/charsets/cyrillic.html) - wxFONTENCODING_KOI8, // we don't support any of KOI8 variants + wxFONTENCODING_KOI8, // KOI8 Russian + wxFONTENCODING_KOI8_U, // KOI8 Ukrainian wxFONTENCODING_ALTERNATIVE, // same as MS-DOS CP866 wxFONTENCODING_BULGARIAN, // used under Linux in Bulgaria @@ -154,45 +148,45 @@ enum wxFontEncoding wxFONTENCODING_UTF32LE, // UTF-32 Little Endian Unicode encoding wxFONTENCODING_MACROMAN, // the standard mac encodings - wxFONTENCODING_MACJAPANESE, - wxFONTENCODING_MACCHINESETRAD, - wxFONTENCODING_MACKOREAN, - wxFONTENCODING_MACARABIC, - wxFONTENCODING_MACHEBREW, - wxFONTENCODING_MACGREEK, - wxFONTENCODING_MACCYRILLIC, - wxFONTENCODING_MACDEVANAGARI, - wxFONTENCODING_MACGURMUKHI, - wxFONTENCODING_MACGUJARATI, - wxFONTENCODING_MACORIYA, - wxFONTENCODING_MACBENGALI, - wxFONTENCODING_MACTAMIL, - wxFONTENCODING_MACTELUGU, - wxFONTENCODING_MACKANNADA, - wxFONTENCODING_MACMALAJALAM, - wxFONTENCODING_MACSINHALESE, - wxFONTENCODING_MACBURMESE, - wxFONTENCODING_MACKHMER, - wxFONTENCODING_MACTHAI, - wxFONTENCODING_MACLAOTIAN, - wxFONTENCODING_MACGEORGIAN, - wxFONTENCODING_MACARMENIAN, - wxFONTENCODING_MACCHINESESIMP, - wxFONTENCODING_MACTIBETAN, - wxFONTENCODING_MACMONGOLIAN, - wxFONTENCODING_MACETHIOPIC, - wxFONTENCODING_MACCENTRALEUR, - wxFONTENCODING_MACVIATNAMESE, - wxFONTENCODING_MACARABICEXT, - wxFONTENCODING_MACSYMBOL, - wxFONTENCODING_MACDINGBATS, - wxFONTENCODING_MACTURKISH, - wxFONTENCODING_MACCROATIAN, - wxFONTENCODING_MACICELANDIC, - wxFONTENCODING_MACROMANIAN, - wxFONTENCODING_MACCELTIC, - wxFONTENCODING_MACGAELIC, - wxFONTENCODING_MACKEYBOARD, + wxFONTENCODING_MACJAPANESE, + wxFONTENCODING_MACCHINESETRAD, + wxFONTENCODING_MACKOREAN, + wxFONTENCODING_MACARABIC, + wxFONTENCODING_MACHEBREW, + wxFONTENCODING_MACGREEK, + wxFONTENCODING_MACCYRILLIC, + wxFONTENCODING_MACDEVANAGARI, + wxFONTENCODING_MACGURMUKHI, + wxFONTENCODING_MACGUJARATI, + wxFONTENCODING_MACORIYA, + wxFONTENCODING_MACBENGALI, + wxFONTENCODING_MACTAMIL, + wxFONTENCODING_MACTELUGU, + wxFONTENCODING_MACKANNADA, + wxFONTENCODING_MACMALAJALAM, + wxFONTENCODING_MACSINHALESE, + wxFONTENCODING_MACBURMESE, + wxFONTENCODING_MACKHMER, + wxFONTENCODING_MACTHAI, + wxFONTENCODING_MACLAOTIAN, + wxFONTENCODING_MACGEORGIAN, + wxFONTENCODING_MACARMENIAN, + wxFONTENCODING_MACCHINESESIMP, + wxFONTENCODING_MACTIBETAN, + wxFONTENCODING_MACMONGOLIAN, + wxFONTENCODING_MACETHIOPIC, + wxFONTENCODING_MACCENTRALEUR, + wxFONTENCODING_MACVIATNAMESE, + wxFONTENCODING_MACARABICEXT, + wxFONTENCODING_MACSYMBOL, + wxFONTENCODING_MACDINGBATS, + wxFONTENCODING_MACTURKISH, + wxFONTENCODING_MACCROATIAN, + wxFONTENCODING_MACICELANDIC, + wxFONTENCODING_MACROMANIAN, + wxFONTENCODING_MACCELTIC, + wxFONTENCODING_MACGAELIC, + wxFONTENCODING_MACKEYBOARD, wxFONTENCODING_MACMIN = wxFONTENCODING_MACROMAN , wxFONTENCODING_MACMAX = wxFONTENCODING_MACKEYBOARD , @@ -239,6 +233,9 @@ public: // accessors and modifiers for the font elements int GetPointSize() const; +#ifdef __WXMSW__ + wxSize GetPixelSize() const; +#endif wxFontStyle GetStyle() const; wxFontWeight GetWeight() const; bool GetUnderlined() const; @@ -247,6 +244,9 @@ public: wxFontEncoding GetEncoding() const; void SetPointSize(int pointsize); +#ifdef __WXMSW__ + void SetPixelSize(const wxSize& pixelSize); +#endif void SetStyle(wxFontStyle style); void SetWeight(wxFontWeight weight); void SetUnderlined(bool underlined); @@ -282,7 +282,7 @@ struct wxNativeEncodingInfo wxNativeEncodingInfo(); ~wxNativeEncodingInfo(); - + // this struct is saved in config by wxFontMapper, so it should know to // serialise itself (implemented in platform-specific code) bool FromString(const wxString& s); @@ -313,9 +313,9 @@ bool wxTestFontEncoding(const wxNativeEncodingInfo& info); %inline %{ wxNativeEncodingInfo* wxGetNativeFontEncoding(wxFontEncoding encoding) { wxPyRaiseNotImplemented(); return NULL; } - + bool wxTestFontEncoding(const wxNativeEncodingInfo& info) - { wxPyRaiseNotImplemented(); return False; } + { wxPyRaiseNotImplemented(); return false; } %} #endif @@ -355,7 +355,7 @@ public: // interactive parameter is ignored in the base class, we behave as if it // were always False virtual wxFontEncoding CharsetToEncoding(const wxString& charset, - bool interactive = True); + bool interactive = true); // get the number of font encodings we know about @@ -373,6 +373,12 @@ public: // NB: hard-coded now, but might change later (read it from config?) static wxString GetEncodingDescription(wxFontEncoding encoding); + // find the encoding corresponding to the given name, inverse of + // GetEncodingName() and less general than CharsetToEncoding() + // + // returns wxFONTENCODING_MAX if the name is not a supported encoding + static wxFontEncoding GetEncodingFromName(const wxString& name); + // set the config object to use (may be NULL to use default) void SetConfig(wxConfigBase *config); @@ -391,7 +397,7 @@ public: %extend { PyObject* GetAltForEncoding(wxFontEncoding encoding, const wxString& facename = wxPyEmptyString, - bool interactive = True) { + bool interactive = true) { wxFontEncoding alt_enc; if (self->GetAltForEncoding(encoding, &alt_enc, facename, interactive)) return PyInt_FromLong(alt_enc); @@ -404,7 +410,8 @@ public: // checks whether given encoding is available in given face or not. - // If no facename is given, + // If no facename is given (default), return true if it's available in any + // facename at all. bool IsEncodingAvailable(wxFontEncoding encoding, const wxString& facename = wxPyEmptyString); @@ -422,83 +429,376 @@ public: %newgroup +MustHaveApp(wxFont); +MustHaveApp(wxFont::GetDefaultEncoding); +MustHaveApp(wxFont::SetDefaultEncoding); + +DocStr(wxFont, +"A font is an object which determines the appearance of text. Fonts are +used for drawing text to a device context, and setting the appearance +of a window's text. + +You can retrieve the current system font settings with `wx.SystemSettings`.", " + +The possible values for the family parameter of wx.Font constructor are: + + ======================== ============================= + wx.FONTFAMILY_DEFAULT Chooses a default font. + wx.FONTFAMILY_DECORATIVE A decorative font. + wx.FONTFAMILY_ROMAN A formal, serif font. + wx.FONTFAMILY_SCRIPT A handwriting font. + wx.FONTFAMILY_SWISS A sans-serif font. + wx.FONTFAMILY_MODERN Usually a fixed pitch font. + wx.FONTFAMILY_TELETYPE A teletype font. + ======================== ============================= + +The possible values for the weight parameter are: + + ==================== == + wx.FONTWEIGHT_NORMAL + wx.FONTWEIGHT_LIGHT + wx.FONTWEIGHT_BOLD + ==================== == + +The known font encodings are: + + =========================== ==================================== + wx.FONTENCODING_SYSTEM system default + wx.FONTENCODING_DEFAULT current default encoding + wx.FONTENCODING_ISO8859_1 West European (Latin1) + wx.FONTENCODING_ISO8859_2 Central and East European (Latin2) + wx.FONTENCODING_ISO8859_3 Esperanto (Latin3) + wx.FONTENCODING_ISO8859_4 Baltic (old) (Latin4) + wx.FONTENCODING_ISO8859_5 Cyrillic + wx.FONTENCODING_ISO8859_6 Arabic + wx.FONTENCODING_ISO8859_7 Greek + wx.FONTENCODING_ISO8859_8 Hebrew + wx.FONTENCODING_ISO8859_9 Turkish (Latin5) + wx.FONTENCODING_ISO8859_10 Variation of Latin4 (Latin6) + wx.FONTENCODING_ISO8859_11 Thai + wx.FONTENCODING_ISO8859_12 doesn't exist currently, but put it + here anyhow to make all ISO8859 + consecutive numbers + wx.FONTENCODING_ISO8859_13 Baltic (Latin7) + wx.FONTENCODING_ISO8859_14 Latin8 + wx.FONTENCODING_ISO8859_15 Latin9 (a.k.a. Latin0, includes euro) + wx.FONTENCODING_KOI8 Cyrillic charset + wx.FONTENCODING_ALTERNATIVE same as MS-DOS CP866 + wx.FONTENCODING_BULGARIAN used under Linux in Bulgaria + wx.FONTENCODING_CP437 original MS-DOS codepage + wx.FONTENCODING_CP850 CP437 merged with Latin1 + wx.FONTENCODING_CP852 CP437 merged with Latin2 + wx.FONTENCODING_CP855 another cyrillic encoding + wx.FONTENCODING_CP866 and another one + wx.FONTENCODING_CP874 WinThai + wx.FONTENCODING_CP1250 WinLatin2 + wx.FONTENCODING_CP1251 WinCyrillic + wx.FONTENCODING_CP1252 WinLatin1 + wx.FONTENCODING_CP1253 WinGreek (8859-7) + wx.FONTENCODING_CP1254 WinTurkish + wx.FONTENCODING_CP1255 WinHebrew + wx.FONTENCODING_CP1256 WinArabic + wx.FONTENCODING_CP1257 WinBaltic (same as Latin 7) + wx.FONTENCODING_UTF7 UTF-7 Unicode encoding + wx.FONTENCODING_UTF8 UTF-8 Unicode encoding + =========================== ==================================== + +"); + class wxFont : public wxGDIObject { public: - wxFont( int pointSize, int family, int style, int weight, - bool underline=False, const wxString& face = wxPyEmptyString, - wxFontEncoding encoding=wxFONTENCODING_DEFAULT); + %pythonPrepend wxFont "if kwargs.has_key('faceName'): kwargs['face'] = kwargs['faceName'];del kwargs['faceName']" + + DocCtorStr( + wxFont( int pointSize, int family, int style, int weight, + bool underline=false, const wxString& face = wxPyEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT), + "Creates a font object with the specified attributes. + + :param pointSize: The size of the font in points. + + :param family: Font family. A generic way of referring to fonts + without specifying actual facename. It can be One of + the ``wx.FONTFAMILY_xxx`` constants. + + :param style: One of the ``wx.FONTSTYLE_xxx`` constants. + + :param weight: Font weight, sometimes also referred to as font + boldness. One of the ``wx.FONTWEIGHT_xxx`` constants. + + :param underline: The value can be ``True`` or ``False`` and + indicates whether the font will include an underline. This + may not be supported on all platforms. + + :param face: An optional string specifying the actual typeface to + be used. If it is an empty string, a default typeface will be + chosen based on the family. + + :param encoding: An encoding which may be one of the + ``wx.FONTENCODING_xxx`` constants. If the specified encoding isn't + available, no font is created. + +:see: `wx.FFont`, `wx.FontFromPixelSize`, `wx.FFontFromPixelSize`, + `wx.FontFromNativeInfoString`, `wx.FontFromNativeInfo` +", ""); + ~wxFont(); - %name(FontFromNativeInfo) wxFont(const wxNativeFontInfo& info); + %RenameDocCtor( + FontFromNativeInfo, + "Construct a `wx.Font` from a `wx.NativeFontInfo` object.", "", + wxFont(const wxNativeFontInfo& info)); + %extend { - %name(FontFromNativeInfoString) wxFont(const wxString& info) { - wxNativeFontInfo nfi; - nfi.FromString(info); - return new wxFont(nfi); - } + %RenameDocCtor( + FontFromNativeInfoString, + "Construct a `wx.Font` from the string representation of a +`wx.NativeFontInfo` object.", "", + wxFont(const wxString& info)) + { + wxNativeFontInfo nfi; + nfi.FromString(info); + return new wxFont(nfi); + } + } - %name(Font2) wxFont(int pointSize, - wxFontFamily family, - int flags = wxFONTFLAG_DEFAULT, - const wxString& face = wxPyEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT) { - return wxFont::New(pointSize, family, flags, face, encoding); - } + + %extend { + %RenameDocCtor( + FFont, + "A bit of a simpler way to create a `wx.Font` using flags instead of +individual attribute settings. The value of flags can be a +combination of the following: + + ============================ == + wx.FONTFLAG_DEFAULT + wx.FONTFLAG_ITALIC + wx.FONTFLAG_SLANT + wx.FONTFLAG_LIGHT + wx.FONTFLAG_BOLD + wx.FONTFLAG_ANTIALIASED + wx.FONTFLAG_NOT_ANTIALIASED + wx.FONTFLAG_UNDERLINED + wx.FONTFLAG_STRIKETHROUGH + ============================ == + +:see: `wx.Font.__init__`", "", + + wxFont(int pointSize, + wxFontFamily family, + int flags = wxFONTFLAG_DEFAULT, + const wxString& face = wxPyEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT)) + { + return wxFont::New(pointSize, family, flags, face, encoding); + } + + + // There is a real ctor for this on wxMSW, but not the others, so just + // use the factory function in all cases. + + %RenameDocCtor( + FontFromPixelSize, + "Creates a font using a size in pixels rather than points. If there is +platform API support for this then it is used, otherwise a font with +the closest size is found using a binary search. + +:see: `wx.Font.__init__`", "", + wxFont(const wxSize& pixelSize, + int family, + int style, + int weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT)) + { + return wxFontBase::New(pixelSize, family, + style, weight, underlined, + face, encoding); + } + + %RenameDocCtor( + FFontFromPixelSize, + "Creates a font using a size in pixels rather than points. If there is +platform API support for this then it is used, otherwise a font with +the closest size is found using a binary search. + +:see: `wx.Font.__init__`, `wx.FFont`", "", + wxFont(const wxSize& pixelSize, + wxFontFamily family, + int flags = wxFONTFLAG_DEFAULT, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT)) + { + return wxFontBase::New(pixelSize, family, flags, face, encoding); + } } + // was the font successfully created? - bool Ok() const; + DocDeclStr( + bool , Ok() const, + "Returns ``True`` if this font was successfully created.", ""); %pythoncode { def __nonzero__(self): return self.Ok() } + // comparison - bool operator == (const wxFont& font) const; - bool operator != (const wxFont& font) const; + %extend { + bool __eq__(const wxFont* other) { return other ? (*self == *other) : false; } + bool __ne__(const wxFont* other) { return other ? (*self != *other) : true; } + } - // accessors: get the font characteristics - virtual int GetPointSize() const; - virtual int GetFamily() const; - virtual int GetStyle() const; - virtual int GetWeight() const; - virtual bool GetUnderlined() const; - virtual wxString GetFaceName() const; - virtual wxFontEncoding GetEncoding() const; - virtual const wxNativeFontInfo *GetNativeFontInfo() const; + + DocDeclStr( + virtual int , GetPointSize() const, + "Gets the point size.", ""); + + DocDeclStr( + virtual wxSize , GetPixelSize() const, + "Returns the size in pixels if the font was constructed with a pixel +size.", ""); + + DocDeclStr( + virtual bool , IsUsingSizeInPixels() const, + "Returns ``True`` if the font is using a pixelSize.", ""); + + + DocDeclStr( + virtual int , GetFamily() const, + "Gets the font family. ", ""); + + DocDeclStr( + virtual int , GetStyle() const, + "Gets the font style.", ""); + + DocDeclStr( + virtual int , GetWeight() const, + "Gets the font weight. ", ""); + + DocDeclStr( + virtual bool , GetUnderlined() const, + "Returns ``True`` if the font is underlined, ``False`` otherwise.", ""); + + DocDeclStr( + virtual wxString , GetFaceName() const, + "Returns the typeface name associated with the font, or the empty +string if there is no typeface information.", ""); + + DocDeclStr( + virtual wxFontEncoding , GetEncoding() const, + "Get the font's encoding.", ""); + + DocDeclStr( + virtual const wxNativeFontInfo *, GetNativeFontInfo() const, + "Constructs a `wx.NativeFontInfo` object from this font.", ""); + - virtual bool IsFixedWidth() const; + DocDeclStr( + virtual bool , IsFixedWidth() const, + "Returns true if the font is a fixed width (or monospaced) font, false +if it is a proportional one or font is invalid.", ""); + - wxString GetNativeFontInfoDesc() const; - wxString GetNativeFontInfoUserDesc() const; + DocDeclStr( + wxString , GetNativeFontInfoDesc() const, + "Returns the platform-dependent string completely describing this font +or an empty string if the font isn't valid.", ""); + + DocDeclStr( + wxString , GetNativeFontInfoUserDesc() const, + "Returns a human readable version of `GetNativeFontInfoDesc`.", ""); + // change the font characteristics - virtual void SetPointSize( int pointSize ); - virtual void SetFamily( int family ); - virtual void SetStyle( int style ); - virtual void SetWeight( int weight ); - virtual void SetFaceName( const wxString& faceName ); - virtual void SetUnderlined( bool underlined ); - virtual void SetEncoding(wxFontEncoding encoding); - void SetNativeFontInfo(const wxNativeFontInfo& info); - %name(SetNativeFontInfoFromString) void SetNativeFontInfo(const wxString& info); - void SetNativeFontInfoUserDesc(const wxString& info); - - // translate the fonts into human-readable string (i.e. GetStyleString() - // will return "wxITALIC" for an italic font, ...) - wxString GetFamilyString() const; - wxString GetStyleString() const; - wxString GetWeightString() const; - - // Unofficial API, don't use - virtual void SetNoAntiAliasing( bool no = True ); - virtual bool GetNoAntiAliasing(); + DocDeclStr( + virtual void , SetPointSize( int pointSize ), + "Sets the point size.", ""); + + DocDeclStr( + virtual void , SetPixelSize( const wxSize& pixelSize ), + "Sets the size in pixels rather than points. If there is platform API +support for this then it is used, otherwise a font with the closest +size is found using a binary search.", ""); + + DocDeclStr( + virtual void , SetFamily( int family ), + "Sets the font family.", ""); + + DocDeclStr( + virtual void , SetStyle( int style ), + "Sets the font style.", ""); + + DocDeclStr( + virtual void , SetWeight( int weight ), + "Sets the font weight.", ""); + + DocDeclStr( + virtual void , SetFaceName( const wxString& faceName ), + "Sets the facename for the font. The facename, which should be a valid +font installed on the end-user's system. + +To avoid portability problems, don't rely on a specific face, but +specify the font family instead or as well. A suitable font will be +found on the end-user's system. If both the family and the facename +are specified, wxWidgets will first search for the specific face, and +then for a font belonging to the same family.", ""); + + DocDeclStr( + virtual void , SetUnderlined( bool underlined ), + "Sets underlining.", ""); + + DocDeclStr( + virtual void , SetEncoding(wxFontEncoding encoding), + "Set the font encoding.", ""); + + DocDeclStr( + void , SetNativeFontInfo(const wxNativeFontInfo& info), + "Set the font's attributes from a `wx.NativeFontInfo` object.", ""); + + + DocDeclStrName( + void , SetNativeFontInfo(const wxString& info), + "Set the font's attributes from string representation of a +`wx.NativeFontInfo` object.", "", + SetNativeFontInfoFromString); + + DocDeclStr( + void , SetNativeFontInfoUserDesc(const wxString& info), + "Set the font's attributes from a string formerly returned from +`GetNativeFontInfoDesc`.", ""); + + + DocDeclStr( + wxString , GetFamilyString() const, + "Returns a string representation of the font family.", ""); + + DocDeclStr( + wxString , GetStyleString() const, + "Returns a string representation of the font style.", ""); + + DocDeclStr( + wxString , GetWeightString() const, + "Return a string representation of the font weight.", ""); + + + virtual void SetNoAntiAliasing( bool no = true ); + virtual bool GetNoAntiAliasing() const; // the default encoding is used for creating all fonts with default // encoding parameter - static wxFontEncoding GetDefaultEncoding() { return ms_encodingDefault; } - static void SetDefaultEncoding(wxFontEncoding encoding); -}; - + DocDeclStr( + static wxFontEncoding , GetDefaultEncoding(), + "Returns the encoding used for all fonts created with an encoding of +``wx.FONTENCODING_DEFAULT``.", ""); + + DocDeclStr( + static void , SetDefaultEncoding(wxFontEncoding encoding), + "Sets the default font encoding.", ""); + +}; +%pythoncode { Font2 = wx._deprecated(FFont, "Use `wx.FFont` instead.") } //--------------------------------------------------------------------------- %newgroup @@ -521,9 +821,12 @@ IMP_PYCALLBACK_BOOL_STRINGSTRING(wxPyFontEnumerator, wxFontEnumerator, OnFontEnc %} -%name(FontEnumerator) class wxPyFontEnumerator { +MustHaveApp(wxPyFontEnumerator); + +%rename(FontEnumerator) wxPyFontEnumerator; +class wxPyFontEnumerator { public: - %addtofunc wxPyFontEnumerator "self._setCallbackInfo(self, FontEnumerator, 0)" + %pythonAppend wxPyFontEnumerator "self._setCallbackInfo(self, FontEnumerator, 0)" wxPyFontEnumerator(); ~wxPyFontEnumerator(); @@ -531,7 +834,7 @@ public: bool EnumerateFacenames( wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all - bool fixedWidthOnly = False); + bool fixedWidthOnly = false); bool EnumerateEncodings(const wxString& facename = wxPyEmptyString); @@ -540,12 +843,18 @@ public: %extend { PyObject* GetEncodings() { wxArrayString* arr = self->GetEncodings(); - return wxArrayString2PyList_helper(*arr); + if (arr) + return wxArrayString2PyList_helper(*arr); + else + return PyList_New(0); } PyObject* GetFacenames() { wxArrayString* arr = self->GetFacenames(); - return wxArrayString2PyList_helper(*arr); + if (arr) + return wxArrayString2PyList_helper(*arr); + else + return PyList_New(0); } } };