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:
@@ -42,19 +42,15 @@ public:
|
||||
virtual int GetStyle() const;
|
||||
wxBitmap *GetStipple() const;
|
||||
|
||||
bool Ok() const { return IsOk(); }
|
||||
bool IsOk() const { return m_refData != NULL; }
|
||||
|
||||
// return the HBRUSH for this brush
|
||||
virtual WXHANDLE GetResourceHandle() const;
|
||||
|
||||
protected:
|
||||
virtual wxObjectRefData *CreateRefData() const;
|
||||
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
|
||||
virtual wxGDIRefData *CreateGDIRefData() const;
|
||||
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxBrush)
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_BRUSH_H_
|
||||
#endif // _WX_BRUSH_H_
|
||||
|
@@ -13,6 +13,7 @@
|
||||
#define _WX_PALMOS_ENHMETA_H_
|
||||
|
||||
#include "wx/dc.h"
|
||||
#include "wx/gdiobj.h"
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
#include "wx/dataobj.h"
|
||||
@@ -22,7 +23,7 @@
|
||||
// wxEnhMetaFile: encapsulation of Win32 HENHMETAFILE
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxEnhMetaFile : public wxObject
|
||||
class WXDLLEXPORT wxEnhMetaFile : public wxGDIObject
|
||||
{
|
||||
public:
|
||||
wxEnhMetaFile(const wxString& file = wxEmptyString) : m_filename(file)
|
||||
@@ -39,8 +40,7 @@ public:
|
||||
bool Play(wxDC *dc, wxRect *rectBound = (wxRect *)NULL);
|
||||
|
||||
// accessors
|
||||
bool Ok() const { return IsOk(); }
|
||||
bool IsOk() const { return m_hMF != 0; }
|
||||
virtual bool IsOk() const { return m_hMF != 0; }
|
||||
|
||||
wxSize GetSize() const;
|
||||
int GetWidth() const { return GetSize().x; }
|
||||
|
@@ -41,7 +41,7 @@ public:
|
||||
}
|
||||
|
||||
// accessors
|
||||
bool IsOk() const { return m_handle != 0; }
|
||||
virtual bool IsOk() const { return m_handle != 0; }
|
||||
|
||||
void SetSize(int w, int h) { m_width = w; m_height = h; }
|
||||
|
||||
@@ -147,9 +147,6 @@ public:
|
||||
void SetHandle(WXHANDLE handle)
|
||||
{ EnsureHasData(); GetGDIImageData()->m_handle = handle; }
|
||||
|
||||
bool Ok() const { return IsOk(); }
|
||||
bool IsOk() const { return GetHandle() != 0; }
|
||||
|
||||
int GetWidth() const { return IsNull() ? 0 : GetGDIImageData()->m_width; }
|
||||
int GetHeight() const { return IsNull() ? 0 : GetGDIImageData()->m_height; }
|
||||
int GetDepth() const { return IsNull() ? 0 : GetGDIImageData()->m_depth; }
|
||||
@@ -172,6 +169,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;
|
||||
};
|
||||
|
@@ -27,15 +27,18 @@ class WXDLLIMPEXP_FWD_CORE wxMetafile;
|
||||
|
||||
class WXDLLEXPORT wxMetafileRefData: public wxGDIRefData
|
||||
{
|
||||
friend class WXDLLIMPEXP_FWD_CORE wxMetafile;
|
||||
public:
|
||||
wxMetafileRefData();
|
||||
virtual ~wxMetafileRefData();
|
||||
|
||||
virtual bool IsOk() const { return m_metafile != 0; }
|
||||
|
||||
public:
|
||||
WXHANDLE m_metafile;
|
||||
int m_windowsMappingMode;
|
||||
int m_width, m_height;
|
||||
|
||||
friend class WXDLLIMPEXP_FWD_CORE wxMetafile;
|
||||
};
|
||||
|
||||
#define M_METAFILEDATA ((wxMetafileRefData *)m_refData)
|
||||
@@ -51,8 +54,6 @@ public:
|
||||
virtual bool SetClipboard(int width = 0, int height = 0);
|
||||
|
||||
virtual bool Play(wxDC *dc);
|
||||
bool Ok() const { return IsOk(); }
|
||||
bool IsOk() const { return (M_METAFILEDATA && (M_METAFILEDATA->m_metafile != 0)); };
|
||||
|
||||
// set/get the size of metafile for clipboard operations
|
||||
wxSize GetSize() const { return wxSize(GetWidth(), GetHeight()); }
|
||||
|
@@ -41,9 +41,6 @@ public:
|
||||
int GetPixel(unsigned char red, unsigned char green, unsigned char blue) const;
|
||||
bool GetRGB(int pixel, unsigned char *red, unsigned char *green, unsigned char *blue) const;
|
||||
|
||||
virtual bool Ok() const { return IsOk(); }
|
||||
virtual bool IsOk(void) const { return (m_refData != NULL) ; }
|
||||
|
||||
virtual bool FreeResource(bool force = false);
|
||||
|
||||
inline WXHPALETTE GetHPALETTE(void) const { return (M_PALETTEDATA ? M_PALETTEDATA->m_hPalette : 0); }
|
||||
|
@@ -89,9 +89,6 @@ public:
|
||||
|
||||
bool operator!=(const wxPen& pen) const { return !(*this == pen); }
|
||||
|
||||
virtual bool Ok() const { return IsOk(); }
|
||||
virtual bool IsOk() const { return (m_refData != NULL); }
|
||||
|
||||
// Override in order to recreate the pen
|
||||
void SetColour(const wxColour& col);
|
||||
void SetColour(unsigned char r, unsigned char g, unsigned char b);
|
||||
|
@@ -44,8 +44,8 @@ public:
|
||||
WXHRGN GetHRGN() const;
|
||||
|
||||
protected:
|
||||
virtual wxObjectRefData *CreateRefData() const;
|
||||
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
|
||||
virtual wxGDIRefData *CreateGDIRefData() const;
|
||||
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
|
||||
|
||||
virtual bool DoIsEqual(const wxRegion& region) const;
|
||||
virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const;
|
||||
|
Reference in New Issue
Block a user