Centralize backwards compatibility code in wxFont
Add wxFontBase::AccountForCompatValues() and use it in all ports instead of redoing the same comparison with wxDEFAULT in all of them. This is done not so much to avoid the code duplication, which was minimal anyhow, but to make the code more clear and make it easier to remove it from all ports at once in the bright (but remote) future when we don't need these compatibility hacks any more. Also document that wxDEFAULT and wxNORMAL are only handled specially in the old-style ctor taking the individual font components and not the new one using wxFontInfo and extend the unit test to check this.
This commit is contained in:
@@ -492,6 +492,14 @@ protected:
|
||||
return (flags & wxFONTFLAG_STRIKETHROUGH) != 0;
|
||||
}
|
||||
|
||||
// For compatibility reasons, we continue to accept wxDEFAULT as meaning
|
||||
// "default font size" and wxNORMAL and similar deprecated constants
|
||||
// instead of wxFONT{WEIGHT,STYLE}_NORMAL. This function modifies its
|
||||
// parameters to account for this if necessary.
|
||||
static void AccountForCompatValues(int& pointSize,
|
||||
wxFontStyle& style,
|
||||
wxFontWeight& weight);
|
||||
|
||||
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