wxFontRefData(int size,
const wxSize& pixelSize,
bool sizeUsingPixels,
- int family,
- int style,
- int weight,
+ wxFontFamily family,
+ wxFontStyle style,
+ wxFontWeight weight,
bool underlined,
const wxString& faceName,
wxFontEncoding encoding)
return m_nativeFontInfoOk ? true : m_sizeUsingPixels;
}
- int GetFamily() const
+ wxFontFamily GetFamily() const
{
return m_family;
}
- int GetStyle() const
+ wxFontStyle GetStyle() const
{
return m_nativeFontInfoOk ? m_nativeFontInfo.GetStyle()
: m_style;
}
- int GetWeight() const
+ wxFontWeight GetWeight() const
{
return m_nativeFontInfoOk ? m_nativeFontInfo.GetWeight()
: m_weight;
WXHFONT GetHFONT(const wxFont *font) const
{
if ( !m_hFont )
- wx_const_cast(wxFontRefData *, this)->Alloc(font);
+ const_cast<wxFontRefData *>(this)->Alloc(font);
return (WXHFONT)m_hFont;
}
}
}
- void SetFamily(int family)
+ void SetFamily(wxFontFamily family)
{
Free();
m_family = family;
}
- void SetStyle(int style)
+ void SetStyle(wxFontStyle style)
{
Free();
m_style = style;
}
- void SetWeight(int weight)
+ void SetWeight(wxFontWeight weight)
{
Free();
void Init(int size,
const wxSize& pixelSize,
bool sizeUsingPixels,
- int family,
- int style,
- int weight,
+ wxFontFamily family,
+ wxFontStyle style,
+ wxFontWeight weight,
bool underlined,
const wxString& faceName,
wxFontEncoding encoding);
int m_pointSize;
wxSize m_pixelSize;
bool m_sizeUsingPixels;
- int m_family;
- int m_style;
- int m_weight;
+ wxFontFamily m_family;
+ wxFontStyle m_style;
+ wxFontWeight m_weight;
bool m_underlined;
wxString m_faceName;
wxFontEncoding m_encoding;
void wxFontRefData::Init(int pointSize,
const wxSize& pixelSize,
bool sizeUsingPixels,
- int family,
- int style,
- int weight,
+ wxFontFamily family,
+ wxFontStyle style,
+ wxFontWeight weight,
bool underlined,
const wxString& faceName,
wxFontEncoding encoding)
m_nativeFontInfo = info;
// This is the best we can do since we don't have the
// correct information at this point.
- m_family = wxSWISS;
+ m_family = wxFONTFAMILY_SWISS;
}
wxFontRefData::~wxFontRefData()
bool wxNativeFontInfo::SetFaceName(const wxString& facename)
{
- size_t len = WXSIZEOF(lf.lfFaceName);
- wxStrncpy(lf.lfFaceName, facename, len);
- lf.lfFaceName[len - 1] = '\0'; // truncate the face name
+ wxStrlcpy(lf.lfFaceName, facename.c_str(), WXSIZEOF(lf.lfFaceName));
return true;
}
bool wxFont::DoCreate(int pointSize,
const wxSize& pixelSize,
bool sizeUsingPixels,
- int family,
- int style,
- int weight,
+ wxFontFamily family,
+ wxFontStyle style,
+ wxFontWeight weight,
bool underlined,
const wxString& faceName,
wxFontEncoding encoding)
wxGDIRefData *wxFont::CloneGDIRefData(const wxGDIRefData *data) const
{
- return new wxFontRefData(*wx_static_cast(const wxFontRefData *, data));
+ return new wxFontRefData(*static_cast<const wxFontRefData *>(data));
}
bool wxFont::RealizeResource()
M_FONTDATA->SetPixelSize(pixelSize);
}
-void wxFont::SetFamily(int family)
+void wxFont::SetFamily(wxFontFamily family)
{
AllocExclusive();
M_FONTDATA->SetFamily(family);
}
-void wxFont::SetStyle(int style)
+void wxFont::SetStyle(wxFontStyle style)
{
AllocExclusive();
M_FONTDATA->SetStyle(style);
}
-void wxFont::SetWeight(int weight)
+void wxFont::SetWeight(wxFontWeight weight)
{
AllocExclusive();
return M_FONTDATA->IsUsingSizeInPixels();
}
-int wxFont::GetFamily() const
+wxFontFamily wxFont::GetFamily() const
{
- wxCHECK_MSG( Ok(), 0, wxT("invalid font") );
+ wxCHECK_MSG( Ok(), wxFONTFAMILY_MAX, wxT("invalid font") );
return M_FONTDATA->GetFamily();
}
-int wxFont::GetStyle() const
+wxFontStyle wxFont::GetStyle() const
{
- wxCHECK_MSG( Ok(), 0, wxT("invalid font") );
+ wxCHECK_MSG( Ok(), wxFONTSTYLE_MAX, wxT("invalid font") );
return M_FONTDATA->GetStyle();
}
-int wxFont::GetWeight() const
+wxFontWeight wxFont::GetWeight() const
{
- wxCHECK_MSG( Ok(), 0, wxT("invalid font") );
+ wxCHECK_MSG( Ok(), wxFONTWEIGHT_MAX, wxT("invalid font") );
return M_FONTDATA->GetWeight();
}