Add wxFontInfo::Style() for consistency with Weight()

This will also be useful when changing the existing code to use
wxFontInfo().
This commit is contained in:
Vadim Zeitlin
2018-09-12 23:16:29 +02:00
parent 11ab3b4786
commit c61fc16f96
2 changed files with 23 additions and 0 deletions

View File

@@ -164,6 +164,16 @@ public:
{ SetFlag(wxFONTFLAG_ITALIC, italic); return *this; } { SetFlag(wxFONTFLAG_ITALIC, italic); return *this; }
wxFontInfo& Slant(bool slant = true) wxFontInfo& Slant(bool slant = true)
{ SetFlag(wxFONTFLAG_SLANT, slant); return *this; } { SetFlag(wxFONTFLAG_SLANT, slant); return *this; }
wxFontInfo& Style(wxFontStyle style)
{
if ( style == wxFONTSTYLE_ITALIC )
return Italic();
if ( style == wxFONTSTYLE_SLANT )
return Slant();
return *this;
}
wxFontInfo& AntiAliased(bool antiAliased = true) wxFontInfo& AntiAliased(bool antiAliased = true)
{ SetFlag(wxFONTFLAG_ANTIALIASED, antiAliased); return *this; } { SetFlag(wxFONTFLAG_ANTIALIASED, antiAliased); return *this; }

View File

@@ -398,6 +398,9 @@ public:
/** /**
Use an italic version of the font. Use an italic version of the font.
This is a wrapper for Style() calling it with ::wxFONTSTYLE_ITALIC
argument.
@see ::wxFontStyle, wxFont::SetStyle() @see ::wxFontStyle, wxFont::SetStyle()
*/ */
wxFontInfo& Italic(bool italic = true); wxFontInfo& Italic(bool italic = true);
@@ -405,10 +408,20 @@ public:
/** /**
Use a slanted version of the font. Use a slanted version of the font.
This is a wrapper for Style() calling it with ::wxFONTSTYLE_SLANT
argument.
@see ::wxFontStyle, wxFont::SetStyle() @see ::wxFontStyle, wxFont::SetStyle()
*/ */
wxFontInfo& Slant(bool slant = true); wxFontInfo& Slant(bool slant = true);
/**
Specify the style of the font using one of wxFontStyle constants.
@since 3.1.2
*/
wxFontInfo& Style(wxFontStyle style);
/** /**
Set anti-aliasing flag. Set anti-aliasing flag.