Add wxFont ctor taking a single flags argument instead of style/weight/...
Currently this ctor just does the same thing as the existing ctors in a different way but it will be extended to support wxFONTFLAG_STRIKETHROUGH in the next commits. See #9907. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70445 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -290,6 +290,33 @@ protected:
|
||||
// wxFONTFAMILY_UNKNOWN unlike the public method (see comment there).
|
||||
virtual wxFontFamily DoGetFamily() const = 0;
|
||||
|
||||
|
||||
// Helper functions to recover wxFONTSTYLE/wxFONTWEIGHT and underlined flg
|
||||
// values from flags containing a combination of wxFONTFLAG_XXX.
|
||||
static wxFontStyle GetStyleFromFlags(int flags)
|
||||
{
|
||||
return flags & wxFONTFLAG_ITALIC
|
||||
? wxFONTSTYLE_ITALIC
|
||||
: flags & wxFONTFLAG_SLANT
|
||||
? wxFONTSTYLE_SLANT
|
||||
: wxFONTSTYLE_NORMAL;
|
||||
}
|
||||
|
||||
static wxFontWeight GetWeightFromFlags(int flags)
|
||||
{
|
||||
return flags & wxFONTFLAG_LIGHT
|
||||
? wxFONTWEIGHT_LIGHT
|
||||
: flags & wxFONTFLAG_BOLD
|
||||
? wxFONTWEIGHT_BOLD
|
||||
: wxFONTWEIGHT_NORMAL;
|
||||
}
|
||||
|
||||
static bool GetUnderlinedFromFlags(int flags)
|
||||
{
|
||||
return (flags & wxFONTFLAG_UNDERLINED) != 0;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
// the currently default encoding: by default, it's the default system
|
||||
// encoding, but may be changed by the application using
|
||||
|
Reference in New Issue
Block a user