diff --git a/docs/changes.txt b/docs/changes.txt index 5fccff31e7..239b8ebde6 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -346,6 +346,7 @@ All (GUI): - Added wxMouseEventsManager. - Building OpenGL library is now enabled by default. - Improve wxTreeCtrl::ScrollTo() in generic version (Raanan Barzel). +- Added wxFont::Make{Bold,Italic,Smaller,Larger} and Scale() methods. - Added wxDC::CopyAttributes() and use it in wxBufferedDC. - Added wxTextWrapper helper class useful for wrapping lines of text. diff --git a/include/wx/cocoa/font.h b/include/wx/cocoa/font.h index acda832c69..ae5686f98d 100644 --- a/include/wx/cocoa/font.h +++ b/include/wx/cocoa/font.h @@ -119,7 +119,7 @@ public: virtual void SetUnderlined(bool underlined); virtual void SetEncoding(wxFontEncoding encoding); - WXDECLARE_COMPAT_SETTERS + wxDECLARE_COMMON_FONT_METHODS(); // implementation only from now on // ------------------------------- diff --git a/include/wx/dfb/font.h b/include/wx/dfb/font.h index 941f513dee..def7085e07 100644 --- a/include/wx/dfb/font.h +++ b/include/wx/dfb/font.h @@ -88,7 +88,7 @@ public: virtual void SetUnderlined(bool underlined); virtual void SetEncoding(wxFontEncoding encoding); - WXDECLARE_COMPAT_SETTERS + wxDECLARE_COMMON_FONT_METHODS(); // Unofficial API, don't use virtual void SetNoAntiAliasing(bool no = true); diff --git a/include/wx/font.h b/include/wx/font.h index ec8ed80d6c..873ba84a4a 100644 --- a/include/wx/font.h +++ b/include/wx/font.h @@ -276,7 +276,7 @@ WXDLLIMPEXP_CORE bool wxFromString(const wxString& str, wxFontBase* font); #if FUTURE_WXWIN_COMPATIBILITY_3_0 -#define WXDECLARE_COMPAT_SETTERS \ +#define wxDECLARE_FONT_COMPAT_SETTER \ wxDEPRECATED_FUTURE( void SetFamily(int family) ) \ { SetFamily((wxFontFamily)family); } \ wxDEPRECATED_FUTURE( void SetStyle(int style) ) \ @@ -290,9 +290,20 @@ WXDLLIMPEXP_CORE bool wxFromString(const wxString& str, wxFontBase* font); wxDEPRECATED_FUTURE( void SetWeight(wxDeprecatedGUIConstants weight) ) \ { SetWeight((wxFontWeight)weight); } #else -#define WXDECLARE_COMPAT_SETTERS /*empty*/ +#define wxDECLARE_FONT_COMPAT_SETTER /*empty*/ #endif +// this macro must be used in all derived wxFont classes declarations +#define wxDECLARE_COMMON_FONT_METHODS() \ + wxDECLARE_FONT_COMPAT_SETTER \ + \ + /* functions for creating fonts based on this one */ \ + wxFont MakeBold() const; \ + wxFont MakeItalic() const; \ + wxFont MakeLarger() const { return Scale(1.2f); } \ + wxFont MakeSmaller() const { return Scale(1/1.2f); } \ + wxFont Scale(float x) const + // include the real class declaration #if defined(__WXPALMOS__) #include "wx/palmos/font.h" diff --git a/include/wx/gtk/font.h b/include/wx/gtk/font.h index 4fb065741c..8e03364bca 100644 --- a/include/wx/gtk/font.h +++ b/include/wx/gtk/font.h @@ -95,7 +95,7 @@ public: virtual void SetUnderlined( bool underlined ); virtual void SetEncoding(wxFontEncoding encoding); - WXDECLARE_COMPAT_SETTERS + wxDECLARE_COMMON_FONT_METHODS(); virtual void SetNoAntiAliasing( bool no = true ); virtual bool GetNoAntiAliasing() const ; diff --git a/include/wx/gtk1/font.h b/include/wx/gtk1/font.h index de10438926..0686c3934f 100644 --- a/include/wx/gtk1/font.h +++ b/include/wx/gtk1/font.h @@ -109,7 +109,7 @@ public: virtual void SetUnderlined( bool underlined ); virtual void SetEncoding(wxFontEncoding encoding); - WXDECLARE_COMPAT_SETTERS + wxDECLARE_COMMON_FONT_METHODS(); virtual void SetNoAntiAliasing( bool no = true ); virtual bool GetNoAntiAliasing() const ; diff --git a/include/wx/mgl/font.h b/include/wx/mgl/font.h index 8625ccdd59..a94a28c3ea 100644 --- a/include/wx/mgl/font.h +++ b/include/wx/mgl/font.h @@ -104,7 +104,7 @@ public: virtual void SetUnderlined(bool underlined); virtual void SetEncoding(wxFontEncoding encoding); - WXDECLARE_COMPAT_SETTERS + wxDECLARE_COMMON_FONT_METHODS(); // Unofficial API, don't use virtual void SetNoAntiAliasing(bool no = true); diff --git a/include/wx/motif/font.h b/include/wx/motif/font.h index 6c59225a13..80f86980ae 100644 --- a/include/wx/motif/font.h +++ b/include/wx/motif/font.h @@ -99,7 +99,7 @@ public: virtual void SetUnderlined(bool underlined); virtual void SetEncoding(wxFontEncoding encoding); - WXDECLARE_COMPAT_SETTERS + wxDECLARE_COMMON_FONT_METHODS(); // Implementation diff --git a/include/wx/msw/font.h b/include/wx/msw/font.h index 4756c68eab..afadf95e08 100644 --- a/include/wx/msw/font.h +++ b/include/wx/msw/font.h @@ -135,7 +135,7 @@ public: virtual void SetUnderlined(bool underlined); virtual void SetEncoding(wxFontEncoding encoding); - WXDECLARE_COMPAT_SETTERS + wxDECLARE_COMMON_FONT_METHODS(); virtual bool IsFixedWidth() const; diff --git a/include/wx/os2/font.h b/include/wx/os2/font.h index e4a2f1d608..ef692625d2 100644 --- a/include/wx/os2/font.h +++ b/include/wx/os2/font.h @@ -109,7 +109,7 @@ public: virtual void SetUnderlined(bool bUnderlined); virtual void SetEncoding(wxFontEncoding vEncoding); - WXDECLARE_COMPAT_SETTERS + wxDECLARE_COMMON_FONT_METHODS(); // // For internal use only! diff --git a/include/wx/osx/font.h b/include/wx/osx/font.h index c005e55be3..79fb78b7c4 100644 --- a/include/wx/osx/font.h +++ b/include/wx/osx/font.h @@ -113,7 +113,7 @@ public: virtual void SetUnderlined(bool underlined); virtual void SetEncoding(wxFontEncoding encoding); - WXDECLARE_COMPAT_SETTERS + wxDECLARE_COMMON_FONT_METHODS(); // implementation only from now on // ------------------------------- diff --git a/include/wx/palmos/font.h b/include/wx/palmos/font.h index a800719d7c..716fd9a247 100644 --- a/include/wx/palmos/font.h +++ b/include/wx/palmos/font.h @@ -116,7 +116,7 @@ public: virtual void SetUnderlined(bool underlined); virtual void SetEncoding(wxFontEncoding encoding); - WXDECLARE_COMPAT_SETTERS + wxDECLARE_COMMON_FONT_METHODS(); virtual bool IsFixedWidth() const; diff --git a/include/wx/x11/font.h b/include/wx/x11/font.h index 1093602daf..bfe33ee3e0 100644 --- a/include/wx/x11/font.h +++ b/include/wx/x11/font.h @@ -98,7 +98,7 @@ public: virtual void SetUnderlined(bool underlined); virtual void SetEncoding(wxFontEncoding encoding); - WXDECLARE_COMPAT_SETTERS + wxDECLARE_COMMON_FONT_METHODS(); virtual void SetNoAntiAliasing( bool no = TRUE ); virtual bool GetNoAntiAliasing() const ; diff --git a/interface/wx/font.h b/interface/wx/font.h index b880ee1cec..c814de2baa 100644 --- a/interface/wx/font.h +++ b/interface/wx/font.h @@ -19,23 +19,23 @@ enum wxFontFamily { wxFONTFAMILY_DEFAULT = wxDEFAULT, //!< Chooses a default font. - + wxFONTFAMILY_DECORATIVE = wxDECORATIVE, //!< A decorative font. wxFONTFAMILY_ROMAN = wxROMAN, //!< A formal, serif font. wxFONTFAMILY_SCRIPT = wxSCRIPT, //!< A handwriting font. wxFONTFAMILY_SWISS = wxSWISS, //!< A sans-serif font. - + /// A fixed pitch font. Note that wxFont currently does not make distinctions /// between @c wxFONTFAMILY_MODERN and @c wxFONTFAMILY_TELETYPE. wxFONTFAMILY_MODERN = wxMODERN, - + /// A teletype (i.e. monospaced) font. - /// Monospace fonts have a fixed width like typewriters and often have strong angular - /// or block serifs. Monospace font faces are often used code samples and have a simple, + /// Monospace fonts have a fixed width like typewriters and often have strong angular + /// or block serifs. Monospace font faces are often used code samples and have a simple, /// functional font style. /// See also wxFont::IsFixedWidth() for an easy way to test for monospace property. wxFONTFAMILY_TELETYPE = wxTELETYPE, - + /// Returned by wxFont::GetFamily() when the face name of the font cannot /// be classified into one of the previous wxFontFamily values. wxFONTFAMILY_UNKNOWN = wxFONTFAMILY_MAX, @@ -53,8 +53,8 @@ enum wxFontStyle /// The font is slanted in an italic style. wxFONTSTYLE_ITALIC = wxITALIC, - - /// The font is slanted, but in a roman style. + + /// The font is slanted, but in a roman style. /// Note that under wxMSW this style is the same as @c wxFONTSTYLE_ITALIC. wxFONTSTYLE_SLANT = wxSLANT, @@ -111,7 +111,7 @@ enum wxFontFlag /** Font encodings. - + See wxFont::SetEncoding(). */ enum wxFontEncoding @@ -298,7 +298,7 @@ public: @param style One of @c wxFONTSTYLE_NORMAL, @c wxFONTSTYLE_SLANT and @c wxFONTSTYLE_ITALIC. @param weight - Font weight, sometimes also referred to as font boldness. + Font weight, sometimes also referred to as font boldness. One of the ::wxFontWeight enumeration values. @param underline The value can be @true or @false. @@ -313,8 +313,8 @@ public: