Move {Get,Set}Weight() implementations to wxFontBase

Implement these methods in the base class in terms of
{Get,Set}NumericWeight() in order to avoid having to do it for each
platform.

No real changes.
This commit is contained in:
Vadim Zeitlin
2018-09-05 02:16:10 +02:00
parent dcb12e633b
commit 8ff36f98f3
8 changed files with 29 additions and 81 deletions

View File

@@ -72,8 +72,6 @@ public:
wxFontStyle GetStyle() const { return m_info.GetStyle(); }
wxFontWeight GetWeight() const { return m_info.GetWeight(); }
int GetNumericWeight() const { return m_info.GetNumericWeight(); }
bool GetUnderlined() const { return m_info.GetUnderlined(); }
@@ -121,15 +119,6 @@ public:
}
}
void SetWeight(wxFontWeight weight)
{
if (m_info.GetWeight() != weight)
{
m_info.SetWeight(weight);
Free();
}
}
void SetNumericWeight(int weight)
{
if (m_info.GetNumericWeight() != weight)
@@ -312,7 +301,7 @@ void wxFontRefData::Init(float size,
else
SetFamily(family);
SetPointSize(size < 0 ? wxNORMAL_FONT->GetFractionalPointSize() : size);
SetWeight(weight);
SetNumericWeight(weight);
SetStyle(style);
SetUnderlined(underlined);
SetStrikethrough(strikethrough);
@@ -651,13 +640,6 @@ void wxFont::SetStyle(wxFontStyle style)
M_FONTDATA->SetStyle(style);
}
void wxFont::SetWeight(wxFontWeight weight)
{
AllocExclusive();
M_FONTDATA->SetWeight(weight);
}
void wxFont::SetNumericWeight(int weight)
{
AllocExclusive();
@@ -738,13 +720,6 @@ wxFontStyle wxFont::GetStyle() const
return M_FONTDATA->GetStyle();
}
wxFontWeight wxFont::GetWeight() const
{
wxCHECK_MSG(IsOk(), wxFONTWEIGHT_MAX, wxT("invalid font"));
return M_FONTDATA->GetWeight();
}
int wxFont::GetNumericWeight() const
{
wxCHECK_MSG(IsOk(), wxFONTWEIGHT_MAX, wxT("invalid font"));