Implement creation of wxFont from wxNativeFontInfo.

Implement all of the getters to return the fields from the wxNativeFontInfo
contained in the wxFontRefData.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@49146 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Elliott
2007-10-13 08:47:38 +00:00
parent 065fe5b7e2
commit f11da5baf1

View File

@@ -39,6 +39,12 @@ public:
{ {
} }
wxFontRefData(const wxNativeFontInfo& info)
: wxGDIRefData()
, m_fontId(0)
, m_info(info)
{}
wxFontRefData(int size, wxFontRefData(int size,
int family, int family,
int style, int style,
@@ -89,9 +95,12 @@ wxFontRefData::~wxFontRefData()
#define M_FONTDATA ((wxFontRefData*)m_refData) #define M_FONTDATA ((wxFontRefData*)m_refData)
bool wxFont::Create(const wxNativeFontInfo&) bool wxFont::Create(const wxNativeFontInfo& nativeFontInfo)
{ {
return false; UnRef();
m_refData = new wxFontRefData(nativeFontInfo);
return true;
} }
void wxFont::SetEncoding(wxFontEncoding) void wxFont::SetEncoding(wxFontEncoding)
@@ -105,7 +114,8 @@ wxFontEncoding wxFont::GetEncoding() const
int wxFont::GetPointSize() const int wxFont::GetPointSize() const
{ {
return 0; wxCHECK_MSG( Ok(), 0, wxT("invalid font") );
return M_FONTDATA->m_info.pointSize;
} }
bool wxFont::GetUnderlined() const bool wxFont::GetUnderlined() const
@@ -118,17 +128,20 @@ bool wxFont::GetUnderlined() const
int wxFont::GetStyle() const int wxFont::GetStyle() const
{ {
return 0; wxCHECK_MSG( Ok(), 0, wxT("invalid font") );
return M_FONTDATA->m_info.style;
} }
int wxFont::GetFamily() const int wxFont::GetFamily() const
{ {
return 0; wxCHECK_MSG( Ok(), 0, wxT("invalid font") );
return M_FONTDATA->m_info.family;
} }
int wxFont::GetWeight() const int wxFont::GetWeight() const
{ {
return 0; wxCHECK_MSG( Ok(), 0, wxT("invalid font") );
return M_FONTDATA->m_info.weight;
} }
const wxNativeFontInfo *wxFont::GetNativeFontInfo() const const wxNativeFontInfo *wxFont::GetNativeFontInfo() const