X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e6f85a8554aeaa47863ef5e17a38309794f91ef8..bce169798613bd3143f9fbeb3dc41488d9571bbf:/wxPython/src/_font.i diff --git a/wxPython/src/_font.i b/wxPython/src/_font.i index 0e3fc5ba79..dcfe53b952 100644 --- a/wxPython/src/_font.i +++ b/wxPython/src/_font.i @@ -250,10 +250,18 @@ public: void SetStyle(wxFontStyle style); void SetWeight(wxFontWeight weight); void SetUnderlined(bool underlined); - void SetFaceName(wxString facename); + bool SetFaceName(wxString facename); void SetFamily(wxFontFamily family); void SetEncoding(wxFontEncoding encoding); +// TODO: +// // sets the first facename in the given array which is found +// // to be valid. If no valid facename is given, sets the +// // first valid facename returned by wxFontEnumerator::GetFacenames(). +// // Does not return a bool since it cannot fail. +// void SetFaceName(const wxArrayString &facenames); + + // it is important to be able to serialize wxNativeFontInfo objects to be // able to store them (in config file, for example) bool FromString(const wxString& s); @@ -270,6 +278,14 @@ public: // hopefully be understood by the user) bool FromUserString(const wxString& s); wxString ToUserString() const; + + %property(Encoding, GetEncoding, SetEncoding, doc="See `GetEncoding` and `SetEncoding`"); + %property(FaceName, GetFaceName, SetFaceName, doc="See `GetFaceName` and `SetFaceName`"); + %property(Family, GetFamily, SetFamily, doc="See `GetFamily` and `SetFamily`"); + %property(PointSize, GetPointSize, SetPointSize, doc="See `GetPointSize` and `SetPointSize`"); + %property(Style, GetStyle, SetStyle, doc="See `GetStyle` and `SetStyle`"); + %property(Underlined, GetUnderlined, SetUnderlined, doc="See `GetUnderlined` and `SetUnderlined`"); + %property(Weight, GetWeight, SetWeight, doc="See `GetWeight` and `SetWeight`"); }; @@ -421,6 +437,8 @@ public: // the title for the dialogs (note that default is quite reasonable) void SetDialogTitle(const wxString& title); + + %property(AltForEncoding, GetAltForEncoding, doc="See `GetAltForEncoding`"); }; @@ -638,9 +656,10 @@ the closest size is found using a binary search. // was the font successfully created? DocDeclStr( - bool , Ok() const, + bool , IsOk() const, "Returns ``True`` if this font was successfully created.", ""); - %pythoncode { def __nonzero__(self): return self.Ok() } + %pythoncode { Ok = IsOk } + %pythoncode { def __nonzero__(self): return self.IsOk() } // comparison @@ -734,7 +753,7 @@ size is found using a binary search.", ""); "Sets the font weight.", ""); DocDeclStr( - virtual void , SetFaceName( const wxString& faceName ), + virtual bool , 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. @@ -758,13 +777,13 @@ then for a font belonging to the same family.", ""); DocDeclStrName( - void , SetNativeFontInfo(const wxString& info), + bool , SetNativeFontInfo(const wxString& info), "Set the font's attributes from string representation of a `wx.NativeFontInfo` object.", "", SetNativeFontInfoFromString); DocDeclStr( - void , SetNativeFontInfoUserDesc(const wxString& info), + bool , SetNativeFontInfoUserDesc(const wxString& info), "Set the font's attributes from a string formerly returned from `GetNativeFontInfoDesc`.", ""); @@ -795,6 +814,22 @@ then for a font belonging to the same family.", ""); DocDeclStr( static void , SetDefaultEncoding(wxFontEncoding encoding), "Sets the default font encoding.", ""); + + %property(Encoding, GetEncoding, SetEncoding, doc="See `GetEncoding` and `SetEncoding`"); + %property(FaceName, GetFaceName, SetFaceName, doc="See `GetFaceName` and `SetFaceName`"); + %property(Family, GetFamily, SetFamily, doc="See `GetFamily` and `SetFamily`"); + %property(FamilyString, GetFamilyString, doc="See `GetFamilyString`"); + %property(NativeFontInfo, GetNativeFontInfo, SetNativeFontInfo, doc="See `GetNativeFontInfo` and `SetNativeFontInfo`"); + %property(NativeFontInfoDesc, GetNativeFontInfoDesc, doc="See `GetNativeFontInfoDesc`"); + %property(NativeFontInfoUserDesc, GetNativeFontInfoUserDesc, SetNativeFontInfoUserDesc, doc="See `GetNativeFontInfoUserDesc` and `SetNativeFontInfoUserDesc`"); + %property(NoAntiAliasing, GetNoAntiAliasing, SetNoAntiAliasing, doc="See `GetNoAntiAliasing` and `SetNoAntiAliasing`"); + %property(PixelSize, GetPixelSize, SetPixelSize, doc="See `GetPixelSize` and `SetPixelSize`"); + %property(PointSize, GetPointSize, SetPointSize, doc="See `GetPointSize` and `SetPointSize`"); + %property(Style, GetStyle, SetStyle, doc="See `GetStyle` and `SetStyle`"); + %property(StyleString, GetStyleString, doc="See `GetStyleString`"); + %property(Underlined, GetUnderlined, SetUnderlined, doc="See `GetUnderlined` and `SetUnderlined`"); + %property(Weight, GetWeight, SetWeight, doc="See `GetWeight` and `SetWeight`"); + %property(WeightString, GetWeightString, doc="See `GetWeightString`"); }; @@ -838,33 +873,31 @@ public: bool EnumerateEncodings(const wxString& facename = wxPyEmptyString); - //wxArrayString* GetEncodings(); - //wxArrayString* GetFacenames(); %extend { - PyObject* GetEncodings() { + static PyObject* GetEncodings() { PyObject* ret; - wxArrayString* arr = self->GetEncodings(); + wxArrayString arr = wxFontEnumerator::GetEncodings(); wxPyBlock_t blocked = wxPyBeginBlockThreads(); - if (arr) - ret = wxArrayString2PyList_helper(*arr); - else - ret = PyList_New(0); + ret = wxArrayString2PyList_helper(arr); wxPyEndBlockThreads(blocked); return ret; } - PyObject* GetFacenames() { + static PyObject* GetFacenames() { PyObject* ret; - wxArrayString* arr = self->GetFacenames(); + wxArrayString arr = wxFontEnumerator::GetFacenames(); wxPyBlock_t blocked = wxPyBeginBlockThreads(); - if (arr) - ret = wxArrayString2PyList_helper(*arr); - else - ret = PyList_New(0); + ret = wxArrayString2PyList_helper(arr); wxPyEndBlockThreads(blocked); return ret; } } + + DocDeclStr( + static bool , IsValidFacename(const wxString &str), + "Convenience function that returns true if the given face name exist in +the user's system", ""); + };