wxFontRefData()
{
Init(-1, wxSize(0,0), false, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
- wxFONTWEIGHT_NORMAL, false, wxEmptyString,
+ wxFONTWEIGHT_NORMAL, false, false, wxEmptyString,
wxFONTENCODING_DEFAULT);
}
wxFontStyle style,
wxFontWeight weight,
bool underlined,
+ bool strikethrough,
const wxString& faceName,
wxFontEncoding encoding)
{
Init(size, pixelSize, sizeUsingPixels, family, style, weight,
- underlined, faceName, encoding);
+ underlined, strikethrough, faceName, encoding);
}
wxFontRefData(const wxNativeFontInfo& info, WXHFONT hFont = 0)
return m_nativeFontInfo.GetUnderlined();
}
+ bool GetStrikethrough() const
+ {
+ return m_nativeFontInfo.GetStrikethrough();
+ }
+
wxString GetFaceName() const
{
wxString facename = m_nativeFontInfo.GetFaceName();
m_nativeFontInfo.SetUnderlined(underlined);
}
+ void SetStrikethrough(bool strikethrough)
+ {
+ Free();
+
+ m_nativeFontInfo.SetStrikethrough(strikethrough);
+ }
+
void SetEncoding(wxFontEncoding encoding)
{
Free();
wxFontStyle style,
wxFontWeight weight,
bool underlined,
+ bool strikethrough,
const wxString& faceName,
wxFontEncoding encoding);
wxFontStyle style,
wxFontWeight weight,
bool underlined,
+ bool strikethrough,
const wxString& faceName,
wxFontEncoding encoding)
{
SetStyle(style);
SetWeight(weight);
SetUnderlined(underlined);
+ SetStrikethrough(strikethrough);
// set the family/facename
SetFamily(family);
return lf.lfUnderline != 0;
}
+bool wxNativeFontInfo::GetStrikethrough() const
+{
+ return lf.lfStrikeOut != 0;
+}
+
wxString wxNativeFontInfo::GetFaceName() const
{
return lf.lfFaceName;
lf.lfUnderline = underlined;
}
+void wxNativeFontInfo::SetStrikethrough(bool strikethrough)
+{
+ lf.lfStrikeOut = strikethrough;
+}
+
bool wxNativeFontInfo::SetFaceName(const wxString& facename)
{
wxStrlcpy(lf.lfFaceName, facename.c_str(), WXSIZEOF(lf.lfFaceName));
(void)Create(info);
}
-wxFont::wxFont(int pointSize,
- wxFontFamily family,
- int flags,
- const wxString& face,
- wxFontEncoding encoding)
+wxFont::wxFont(const wxFontInfo& info)
{
- m_refData = new wxFontRefData(pointSize, wxDefaultSize, false,
- family,
- GetStyleFromFlags(flags),
- GetWeightFromFlags(flags),
- GetUnderlinedFromFlags(flags),
- face, encoding);
+ m_refData = new wxFontRefData(info.GetPointSize(),
+ info.GetPixelSize(),
+ info.IsUsingSizeInPixels(),
+ info.GetFamily(),
+ info.GetStyle(),
+ info.GetWeight(),
+ info.IsUnderlined(),
+ info.IsStrikethrough(),
+ info.GetFaceName(),
+ info.GetEncoding());
}
bool wxFont::Create(const wxNativeFontInfo& info, WXHFONT hFont)
// wxDEFAULT is a valid value for the font size too so we must treat it
// specially here (otherwise the size would be 70 == wxDEFAULT value)
- if ( pointSize == wxDEFAULT )
+ if ( pointSize == wxDEFAULT || pointSize == -1 )
{
pointSize = wxNORMAL_FONT->GetPointSize();
}
m_refData = new wxFontRefData(pointSize, pixelSize, sizeUsingPixels,
family, style, weight,
- underlined, faceName, encoding);
+ underlined, false, faceName, encoding);
return RealizeResource();
}
M_FONTDATA->SetUnderlined(underlined);
}
+void wxFont::SetStrikethrough(bool strikethrough)
+{
+ AllocExclusive();
+
+ M_FONTDATA->SetStrikethrough(strikethrough);
+}
+
void wxFont::SetEncoding(wxFontEncoding encoding)
{
AllocExclusive();
return M_FONTDATA->GetUnderlined();
}
+bool wxFont::GetStrikethrough() const
+{
+ wxCHECK_MSG( IsOk(), false, wxT("invalid font") );
+
+ return M_FONTDATA->GetStrikethrough();
+}
+
wxString wxFont::GetFaceName() const
{
wxCHECK_MSG( IsOk(), wxEmptyString, wxT("invalid font") );