Fix Ok/IsOk() mess in wxGDIObject-derived classes; also added

wxGDIObject::Create/CloneGDIRefData() and implemented them for (almost) all
ports


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50727 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-12-15 17:54:20 +00:00
parent d6906a06a2
commit 8f884a0dcc
161 changed files with 1244 additions and 1139 deletions

View File

@@ -216,9 +216,8 @@ protected:
bool CreateFromImage(const wxImage& image, int depth);
// ref counting code
virtual wxObjectRefData *CreateRefData() const;
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
virtual wxGDIRefData *CreateGDIRefData() const;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
private:
bool CopyFromIconOrCursor(const wxGDIImage& rIcon);

View File

@@ -68,9 +68,6 @@ public:
inline wxBitmap* GetStipple(void) const { return (M_BRUSHDATA ? & M_BRUSHDATA->m_vStipple : 0); };
inline int GetPS(void) const { return (M_BRUSHDATA ? M_BRUSHDATA->m_hBrush : 0); };
inline virtual bool Ok() const { return IsOk(); }
inline virtual bool IsOk(void) const { return (m_refData != NULL) ; }
//
// Implementation
//

View File

@@ -34,7 +34,7 @@ public:
virtual ~wxColour();
// Accessors
bool IsOk(void) const {return m_bIsInit; }
virtual bool IsOk(void) const { return m_bIsInit; }
unsigned char Red(void) const { return m_cRed; }
unsigned char Green(void) const { return m_cGreen; }

View File

@@ -41,7 +41,7 @@ public:
}
// accessors
bool IsOk() const
virtual bool IsOk() const
{
if (m_hHandle == 0)
return false;
@@ -187,9 +187,6 @@ public:
pData->m_hHandle = hHandle;
}
bool Ok() const { return IsOk(); }
bool IsOk() const { return GetHandle() != 0; }
int GetWidth() const { return IsNull() ? 0 : GetGDIImageData()->m_nWidth; }
int GetHeight() const { return IsNull() ? 0 : GetGDIImageData()->m_nHeight; }
int GetDepth() const { return IsNull() ? 0 : GetGDIImageData()->m_nDepth; }
@@ -232,6 +229,7 @@ public:
protected:
// create the data for the derived class here
virtual wxGDIImageRefData* CreateData() const = 0;
virtual wxGDIRefData *CreateGDIRefData() const { return CreateData(); }
static wxGDIImageHandlerList ms_handlers;
};

View File

@@ -39,6 +39,8 @@ public:
wxMetafileRefData(void);
virtual ~wxMetafileRefData(void);
virtual bool IsOk() const { return m_metafile != 0; }
public:
WXHANDLE m_metafile;
int m_windowsMappingMode;
@@ -58,8 +60,6 @@ public:
virtual bool SetClipboard(int width = 0, int height = 0);
virtual bool Play(wxDC *dc);
inline bool Ok() const { return IsOk(); }
inline bool IsOk(void) const { return (M_METAFILEDATA && (M_METAFILEDATA->m_metafile != 0)); };
// Implementation
inline WXHANDLE GetHMETAFILE(void) { return M_METAFILEDATA->m_metafile; }

View File

@@ -59,9 +59,6 @@ public:
,unsigned char* pBlue
) const;
virtual bool Ok() const { return IsOk(); }
virtual bool IsOk(void) const { return (m_refData != NULL) ; }
virtual bool FreeResource(bool bForce = false);
inline WXHPALETTE GetHPALETTE(void) const { return (M_PALETTEDATA ? M_PALETTEDATA->m_hPalette : 0); }

View File

@@ -81,9 +81,6 @@ public:
inline bool operator != (const wxPen& rPen) const
{ return !(*this == rPen); }
virtual bool Ok() const { return IsOk(); }
virtual bool IsOk(void) const { return (m_refData != NULL); }
//
// Override in order to recreate the pen
//

View File

@@ -64,8 +64,8 @@ public:
void SetPS(HPS hPS);
protected:
virtual wxObjectRefData* CreateData(void) const;
virtual wxObjectRefData* CloneData(const wxObjectRefData* pData) const;
virtual wxGDIRefData* CreateData(void) const;
virtual wxGDIRefData* CloneData(const wxGDIRefData* pData) const;
virtual bool DoIsEqual(const wxRegion& region) const;
virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const;