Implemented wxGDIObject::Create/CloneGDIRefData() for the relevant classes.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51177 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -931,6 +931,16 @@ wxFont::~wxFont()
|
||||
// here, but we may check that font definition is true
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxGDIRefData *wxFont::CreateGDIRefData() const
|
||||
{
|
||||
return new wxFontRefData();
|
||||
}
|
||||
|
||||
wxGDIRefData *wxFont::CloneGDIRefData(const wxGDIRefData *data) const
|
||||
{
|
||||
return new wxFontRefData(*wx_static_cast(const wxFontRefData *, data));
|
||||
}
|
||||
|
||||
bool wxFont::RealizeResource()
|
||||
{
|
||||
if ( GetResourceHandle() )
|
||||
@@ -965,21 +975,6 @@ bool wxFont::IsFree() const
|
||||
return M_FONTDATA && (M_FONTDATA->GetHFONT() == 0);
|
||||
} // end of wxFont::IsFree
|
||||
|
||||
void wxFont::Unshare()
|
||||
{
|
||||
// Don't change shared data
|
||||
if ( !m_refData )
|
||||
{
|
||||
m_refData = new wxFontRefData();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxFontRefData* ref = new wxFontRefData(*M_FONTDATA);
|
||||
UnRef();
|
||||
m_refData = ref;
|
||||
}
|
||||
} // end of wxFont::Unshare
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// change font attribute: we recreate font when doing it
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -988,7 +983,7 @@ void wxFont::SetPointSize(
|
||||
int nPointSize
|
||||
)
|
||||
{
|
||||
Unshare();
|
||||
AllocExclusive();
|
||||
|
||||
M_FONTDATA->SetPointSize(nPointSize);
|
||||
|
||||
@@ -999,7 +994,7 @@ void wxFont::SetFamily(
|
||||
int nFamily
|
||||
)
|
||||
{
|
||||
Unshare();
|
||||
AllocExclusive();
|
||||
|
||||
M_FONTDATA->SetFamily(nFamily);
|
||||
|
||||
@@ -1010,7 +1005,7 @@ void wxFont::SetStyle(
|
||||
int nStyle
|
||||
)
|
||||
{
|
||||
Unshare();
|
||||
AllocExclusive();
|
||||
|
||||
M_FONTDATA->SetStyle(nStyle);
|
||||
|
||||
@@ -1021,7 +1016,7 @@ void wxFont::SetWeight(
|
||||
int nWeight
|
||||
)
|
||||
{
|
||||
Unshare();
|
||||
AllocExclusive();
|
||||
|
||||
M_FONTDATA->SetWeight(nWeight);
|
||||
|
||||
@@ -1032,7 +1027,7 @@ bool wxFont::SetFaceName(
|
||||
const wxString& rsFaceName
|
||||
)
|
||||
{
|
||||
Unshare();
|
||||
AllocExclusive();
|
||||
|
||||
bool refdataok = M_FONTDATA->SetFaceName(rsFaceName);
|
||||
|
||||
@@ -1045,7 +1040,7 @@ void wxFont::SetUnderlined(
|
||||
bool bUnderlined
|
||||
)
|
||||
{
|
||||
Unshare();
|
||||
AllocExclusive();
|
||||
|
||||
M_FONTDATA->SetUnderlined(bUnderlined);
|
||||
|
||||
@@ -1056,7 +1051,7 @@ void wxFont::SetEncoding(
|
||||
wxFontEncoding vEncoding
|
||||
)
|
||||
{
|
||||
Unshare();
|
||||
AllocExclusive();
|
||||
|
||||
M_FONTDATA->SetEncoding(vEncoding);
|
||||
|
||||
@@ -1067,7 +1062,7 @@ void wxFont::DoSetNativeFontInfo(
|
||||
const wxNativeFontInfo& rInfo
|
||||
)
|
||||
{
|
||||
Unshare();
|
||||
AllocExclusive();
|
||||
|
||||
FreeResource();
|
||||
|
||||
@@ -1147,7 +1142,7 @@ void wxFont::SetFM( PFONTMETRICS pFM, int nNumFonts )
|
||||
|
||||
void wxFont::SetPS( HPS hPS )
|
||||
{
|
||||
Unshare();
|
||||
AllocExclusive();
|
||||
|
||||
M_FONTDATA->SetPS(hPS);
|
||||
|
||||
|
Reference in New Issue
Block a user