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

@@ -31,7 +31,7 @@ extern WXDLLIMPEXP_DATA_ADV(const wxChar) wxAnimationCtrlNameStr[];
// wxAnimationBase
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_ADV wxAnimationBase : public wxGDIObject
class WXDLLIMPEXP_ADV wxAnimationBase : public wxObject
{
public:
wxAnimationBase() {}

View File

@@ -133,9 +133,6 @@ public:
static void InitStandardHandlers();
*/
virtual bool Ok() const { return IsOk(); }
virtual bool IsOk() const = 0;
virtual int GetHeight() const = 0;
virtual int GetWidth() const = 0;
virtual int GetDepth() const = 0;

View File

@@ -64,7 +64,6 @@ protected:
// ========================================================================
class WXDLLEXPORT wxBitmap: public wxGDIObject
{
DECLARE_DYNAMIC_CLASS(wxBitmap)
// ------------------------------------------------------------------------
// initialization
// ------------------------------------------------------------------------
@@ -116,8 +115,6 @@ public:
// get the given part of bitmap
wxBitmap GetSubBitmap( const wxRect& rect ) const;
bool Ok() const { return IsOk(); }
bool IsOk() const;
int GetWidth() const;
int GetHeight() const;
int GetDepth() const;
@@ -140,10 +137,6 @@ public:
int GetBitmapType() const;
// wxObjectRefData
wxObjectRefData *CreateRefData() const;
wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
// wxCocoa
WX_NSBitmapImageRep GetNSBitmapImageRep();
void SetNSBitmapImageRep(WX_NSBitmapImageRep bitmapImageRep);
@@ -151,6 +144,12 @@ public:
static void InitStandardHandlers() { }
static void CleanUpHandlers() { }
protected:
wxGDIRefData *CreateGDIRefData() const;
wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
DECLARE_DYNAMIC_CLASS(wxBitmap)
};
class WXDLLIMPEXP_CORE wxBitmapHandler: public wxBitmapHandlerBase
@@ -158,5 +157,4 @@ class WXDLLIMPEXP_CORE wxBitmapHandler: public wxBitmapHandlerBase
DECLARE_ABSTRACT_CLASS(wxBitmapHandler)
};
#endif
// __WX_COCOA_BITMAP_H__
#endif // __WX_COCOA_BITMAP_H__

View File

@@ -52,16 +52,12 @@ public:
virtual int GetStyle() const;
wxBitmap *GetStipple() const;
virtual bool Ok() const { return IsOk(); }
virtual bool IsOk() const
{ return (m_refData != NULL); }
// wxObjectRefData
wxObjectRefData *CreateRefData() const;
wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
// wxCocoa
WX_NSColor GetNSColor();
protected:
wxGDIRefData *CreateGDIRefData() const;
wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
};
#endif // __WX_COCOA_BRUSH_H__

View File

@@ -50,7 +50,7 @@ public:
virtual ~wxColour();
// accessors
bool IsOk() const { return m_cocoaNSColor; }
virtual bool IsOk() const { return m_cocoaNSColor; }
WX_NSColor GetNSColor() { return m_cocoaNSColor; }
unsigned char Red() const { return m_red; }

View File

@@ -14,12 +14,8 @@
#include "wx/bitmap.h"
class WXDLLEXPORT wxCursorRefData: public wxObjectRefData
class WXDLLEXPORT wxCursorRefData : public wxGDIRefData
{
DECLARE_NO_COPY_CLASS(wxCursorRefData)
friend class WXDLLIMPEXP_FWD_CORE wxBitmap;
friend class WXDLLIMPEXP_FWD_CORE wxCursor;
public:
wxCursorRefData();
virtual ~wxCursorRefData();
@@ -27,6 +23,11 @@ public:
protected:
int m_width, m_height;
WX_NSCursor m_hCursor;
friend class WXDLLIMPEXP_FWD_CORE wxBitmap;
friend class WXDLLIMPEXP_FWD_CORE wxCursor;
DECLARE_NO_COPY_CLASS(wxCursorRefData)
};
#define M_CURSORDATA ((wxCursorRefData *)m_refData)
@@ -35,12 +36,11 @@ protected:
// Cursor
class WXDLLEXPORT wxCursor: public wxBitmap
{
DECLARE_DYNAMIC_CLASS(wxCursor)
public:
wxCursor();
wxCursor(const char bits[], int width, int height, int hotSpotX = -1, int hotSpotY = -1,
wxCursor(const char bits[], int width, int height,
int hotSpotX = -1, int hotSpotY = -1,
const char maskBits[] = NULL);
wxCursor(const wxString& name, long flags = 0,
@@ -49,17 +49,13 @@ public:
wxCursor(int cursor_type);
virtual ~wxCursor();
virtual bool Ok() const { return IsOk(); }
virtual bool IsOk() const { return m_refData ; }
// FIXME: operator==() is wrong!
bool operator==(const wxCursor& cursor) const { return m_refData == cursor.m_refData; }
bool operator!=(const wxCursor& cursor) const { return !(*this == cursor); }
inline bool operator == (const wxCursor& cursor) const { return m_refData == cursor.m_refData; }
inline bool operator != (const wxCursor& cursor) const { return m_refData != cursor.m_refData; }
inline WX_NSCursor GetNSCursor() const
{
return (M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0);
}
WX_NSCursor GetNSCursor() const { return M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0; }
DECLARE_DYNAMIC_CLASS(wxCursor)
};
extern WXDLLEXPORT void wxSetCursor(const wxCursor& cursor);

View File

@@ -110,15 +110,6 @@ public:
virtual bool RealizeResource();
protected:
/*! @abstract Helper method for COW.
@discussion
wxFont can be considered a mutable holder of an immutable opaque implementation object.
All methods that mutate the font should first call Unshare() to ensure that mutating
the implementation object does not cause another wxFont that happened to share the
same ref data to mutate.
*/
void Unshare();
/*! @abstract Internal constructor with ref data
@discussion
Takes ownership of @a refData. That is, it is assumed that refData has either just been
@@ -128,6 +119,10 @@ protected:
explicit wxFont(wxFontRefData *refData)
{ Create(refData); }
bool Create(wxFontRefData *refData);
virtual wxGDIRefData *CreateGDIRefData() const;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
private:
DECLARE_DYNAMIC_CLASS(wxFont)
};

View File

@@ -20,7 +20,6 @@
// ========================================================================
class WXDLLEXPORT wxIcon : public wxGDIObject
{
DECLARE_DYNAMIC_CLASS(wxIcon)
public:
wxIcon();
@@ -49,14 +48,18 @@ public:
// ctors, assignment operators...), but it's ok to have such function
void CopyFromBitmap(const wxBitmap& bmp);
bool Ok() const { return IsOk(); }
bool IsOk() const;
int GetWidth() const;
int GetHeight() const;
WX_NSImage GetNSImage() const;
bool CreateFromXpm(const char **bits);
protected:
virtual wxGDIRefData *CreateGDIRefData() const;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
private:
DECLARE_DYNAMIC_CLASS(wxIcon)
};
#endif
// _WX_COCOA_ICON_H__
#endif // _WX_COCOA_ICON_H__

View File

@@ -23,24 +23,15 @@ class WXDLLIMPEXP_FWD_CORE wxBitmap;
// ========================================================================
class WXDLLEXPORT wxPen: public wxGDIObject
{
DECLARE_DYNAMIC_CLASS(wxPen)
public:
wxPen();
wxPen(const wxColour& col, int width = 1, int style = wxSOLID);
wxPen(const wxBitmap& stipple, int width);
virtual ~wxPen();
// wxObjectRefData
wxObjectRefData *CreateRefData() const;
wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
inline bool operator == (const wxPen& pen) const
{ return m_refData == pen.m_refData; }
inline bool operator != (const wxPen& pen) const
{ return m_refData != pen.m_refData; }
virtual bool Ok() const { return IsOk(); }
virtual bool IsOk() const { return (m_refData != NULL) ; }
// FIXME: operator==() is wrong
bool operator==(const wxPen& pen) const { return m_refData == pen.m_refData; }
bool operator!=(const wxPen& pen) const { return !(*this == pen); }
void SetColour(const wxColour& col) ;
void SetColour(unsigned char r, unsigned char g, unsigned char b) ;
@@ -62,6 +53,12 @@ public:
WX_NSColor GetNSColor();
int GetCocoaLineDash(const CGFloat **pattern);
protected:
wxGDIRefData *CreateGDIRefData() const;
wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
DECLARE_DYNAMIC_CLASS(wxPen)
};
#endif // __WX_COCOA_PEN_H__

View File

@@ -92,9 +92,6 @@ public:
// accessors
// ---------
virtual bool Ok() const { return IsOk(); }
virtual bool IsOk() const = 0;
virtual ChannelType Red() const = 0;
virtual ChannelType Green() const = 0;
virtual ChannelType Blue() const = 0;
@@ -119,6 +116,23 @@ protected:
InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a) = 0;
virtual bool FromString(const wxString& s);
// wxColour doesn't use reference counted data (at least not in all ports)
// so provide stubs for the functions which need to be defined if we do use
// them
virtual wxGDIRefData *CreateGDIRefData() const
{
wxFAIL_MSG( "must be overridden if used" );
return NULL;
}
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *WXUNUSED(data)) const
{
wxFAIL_MSG( "must be overridden if used" );
return NULL;
}
};

View File

@@ -39,9 +39,6 @@ public:
wxBitmap(const wxImage& image, int depth = -1);
#endif
bool Ok() const { return IsOk(); }
bool IsOk() const;
bool Create(const wxIDirectFBSurfacePtr& surface);
bool Create(int width, int height, int depth = -1);
@@ -86,9 +83,8 @@ public:
wxIDirectFBSurfacePtr GetDirectFBSurface() const;
protected:
// 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;
bool CreateWithFormat(int width, int height, int dfbFormat);

View File

@@ -35,8 +35,6 @@ public:
wxBrush(const wxColour &colour, int style = wxSOLID);
wxBrush(const wxBitmap &stippleBitmap);
bool Ok() const { return IsOk(); }
bool IsOk() const;
bool operator==(const wxBrush& brush) const;
bool operator!=(const wxBrush& brush) const { return !(*this == brush); }
@@ -50,9 +48,8 @@ public:
void SetStipple(const wxBitmap& stipple);
protected:
// 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;
DECLARE_DYNAMIC_CLASS(wxBrush)
};

View File

@@ -11,7 +11,7 @@
#ifndef _WX_DFB_CURSOR_H_
#define _WX_DFB_CURSOR_H_
#include "wx/object.h"
#include "wx/gdiobj.h"
#include "wx/gdicmn.h"
class WXDLLIMPEXP_FWD_CORE wxBitmap;
@@ -20,7 +20,7 @@ class WXDLLIMPEXP_FWD_CORE wxBitmap;
// wxCursor
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxCursor: public wxObject
class WXDLLIMPEXP_CORE wxCursor : public wxGDIObject
{
public:
wxCursor() {}
@@ -32,16 +32,13 @@ public:
long flags = wxBITMAP_TYPE_CUR_RESOURCE,
int hotSpotX = 0, int hotSpotY = 0);
bool Ok() const { return IsOk(); }
bool IsOk() const;
// implementation
wxBitmap GetBitmap() const;
protected:
// 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;
DECLARE_DYNAMIC_CLASS(wxCursor)
};

View File

@@ -71,9 +71,8 @@ public:
wxIDirectFBFontPtr GetDirectFBFont(bool antialiased) const;
protected:
// 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:
DECLARE_DYNAMIC_CLASS(wxFont)

View File

@@ -57,13 +57,9 @@ public:
wxDash* GetDash() const;
wxBitmap *GetStipple() const;
bool Ok() const { return IsOk(); }
bool IsOk() const;
protected:
// 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;
DECLARE_DYNAMIC_CLASS(wxPen)
};

View File

@@ -40,9 +40,8 @@ public:
wxRect AsRect() const { return GetBox(); }
protected:
// 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;
// wxRegionBase pure virtuals
virtual bool DoIsEqual(const wxRegion& region) const;

View File

@@ -155,13 +155,9 @@ public:
// from the string representation of wxNativeFontInfo
static wxFont *New(const wxString& strNativeFontDesc);
// was the font successfully created?
bool Ok() const { return IsOk(); }
bool IsOk() const { return m_refData != NULL; }
// comparison
bool operator==(const wxFont& font) const;
bool operator != (const wxFont& font) const;
bool operator!=(const wxFont& font) const { return !(*this == font); }
// accessors: get the font characteristics
virtual int GetPointSize() const = 0;

View File

@@ -20,22 +20,36 @@
// the same native GDI object
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_CORE wxGDIRefData: public wxObjectRefData { };
class WXDLLIMPEXP_FWD_CORE wxGDIRefData : public wxObjectRefData
{
public:
// override this in the derived classes to check if this data object is
// really fully initialized
virtual bool IsOk() const { return true; }
};
// ----------------------------------------------------------------------------
// wxGDIObject
// wxGDIObject: base class for bitmaps, pens, brushes, ...
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxGDIObject : public wxObject
{
public:
// checks if the object can be used
bool IsOk() const
{
// the cast here is safe because the derived classes always create
// wxGDIRefData objects
return m_refData && wx_static_cast(wxGDIRefData *, m_refData)->IsOk();
}
// don't use in the new code, use IsOk() instead
bool IsNull() const { return m_refData == NULL; }
// older version, for backwards compat
// older version, for backwards compatibility only (but not deprecated
// because it's still widely used)
bool Ok() const { return IsOk(); }
virtual bool IsOk() const { return (m_refData != NULL) ; }
#if defined(__WXMSW__) || defined(__WXPM__) || defined(__WXPALMOS__)
// Creates the resource
virtual bool RealizeResource() { return false; }
@@ -49,8 +63,24 @@ public:
virtual WXHANDLE GetResourceHandle() const { return 0; }
#endif // defined(__WXMSW__) || defined(__WXPM__)
protected:
// replace base class functions using wxObjectRefData with our own which
// use wxGDIRefData to ensure that we always work with data objects of the
// correct type (i.e. derived from wxGDIRefData)
virtual wxObjectRefData *CreateRefData() const
{
return CreateGDIRefData();
}
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const
{
return CloneGDIRefData(wx_static_cast(const wxGDIRefData *, data));
}
virtual wxGDIRefData *CreateGDIRefData() const = 0;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const = 0;
DECLARE_DYNAMIC_CLASS(wxGDIObject)
};
#endif
// _WX_GDIOBJ_H_BASE_
#endif // _WX_GDIOBJ_H_BASE_

View File

@@ -33,7 +33,7 @@ public:
virtual ~wxColour();
// accessors
bool IsOk() const { return m_isInit; }
virtual bool IsOk() const { return m_isInit; }
unsigned char Red() const { return m_red; }
unsigned char Green() const { return m_green; }

View File

@@ -33,8 +33,6 @@ public:
wxPalette();
wxPalette( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue );
virtual ~wxPalette();
virtual bool Ok() const { return IsOk(); }
virtual bool IsOk() const;
bool Create( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
int GetPixel( unsigned char red, unsigned char green, unsigned char blue ) const;
@@ -42,6 +40,10 @@ public:
virtual int GetColoursCount() const;
protected:
virtual wxGDIRefData *CreateGDIRefData() const;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
private:
DECLARE_DYNAMIC_CLASS(wxPalette)
};

View File

@@ -26,8 +26,8 @@ public:
virtual bool IsEmpty() const;
protected:
virtual wxObjectRefData *CreateRefData() const;
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
virtual wxGDIRefData *CreateGDIRefData() const;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
// wxRegionBase pure virtuals
virtual bool DoIsEqual(const wxRegion& region) const;

View File

@@ -66,14 +66,12 @@ public:
wxBitmap( const wxImage& image, int depth = -1 ) { (void)CreateFromImage(image, depth); }
#endif // wxUSE_IMAGE
virtual ~wxBitmap();
bool Ok() const { return IsOk(); }
bool IsOk() const;
bool Create(int width, int height, int depth = -1);
int GetHeight() const;
int GetWidth() const;
int GetDepth() const;
virtual int GetHeight() const;
virtual int GetWidth() const;
virtual int GetDepth() const;
#if wxUSE_IMAGE
wxImage ConvertToImage() const;
@@ -127,8 +125,8 @@ protected:
bool CreateFromImage(const wxImage& image, int depth);
#endif // wxUSE_IMAGE
virtual wxObjectRefData* CreateRefData() const;
virtual wxObjectRefData* CloneRefData(const wxObjectRefData* data) const;
virtual wxGDIRefData* CreateGDIRefData() const;
virtual wxGDIRefData* CloneGDIRefData(const wxGDIRefData* data) const;
private:
#if wxUSE_IMAGE

View File

@@ -26,9 +26,6 @@ public:
wxBrush( const wxBitmap &stippleBitmap );
virtual ~wxBrush();
bool Ok() const { return IsOk(); }
bool IsOk() const { return m_refData != NULL; }
bool operator==(const wxBrush& brush) const;
bool operator!=(const wxBrush& brush) const { return !(*this == brush); }
@@ -42,9 +39,8 @@ public:
void SetStipple( const wxBitmap& stipple );
protected:
// 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;
DECLARE_DYNAMIC_CLASS(wxBrush)
};

View File

@@ -27,8 +27,6 @@ public:
virtual ~wxColour();
bool IsOk() const { return m_refData != NULL; }
bool operator==(const wxColour& col) const;
bool operator!=(const wxColour& col) const { return !(*this == col); }

View File

@@ -10,7 +10,7 @@
#ifndef _WX_GTK_CURSOR_H_
#define _WX_GTK_CURSOR_H_
#include "wx/object.h"
#include "wx/gdiobj.h"
class WXDLLIMPEXP_FWD_CORE wxColour;
class WXDLLIMPEXP_FWD_CORE wxImage;
@@ -19,10 +19,9 @@ class WXDLLIMPEXP_FWD_CORE wxImage;
// wxCursor
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxCursor: public wxObject
class WXDLLIMPEXP_CORE wxCursor : public wxGDIObject
{
public:
wxCursor();
wxCursor( int cursorId );
#if wxUSE_IMAGE
@@ -30,15 +29,18 @@ public:
#endif
wxCursor( const char bits[], int width, int height,
int hotSpotX=-1, int hotSpotY=-1,
const char maskBits[] = NULL, const wxColour *fg = NULL, const wxColour *bg = NULL );
const char maskBits[] = NULL,
const wxColour *fg = NULL, const wxColour *bg = NULL );
virtual ~wxCursor();
bool Ok() const { return IsOk(); }
bool IsOk() const;
// implementation
GdkCursor *GetCursor() const;
protected:
virtual wxGDIRefData *CreateGDIRefData() const;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
private:
DECLARE_DYNAMIC_CLASS(wxCursor)
};

View File

@@ -84,8 +84,8 @@ protected:
// common part of all ctors
void Init();
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(wxFont)

View File

@@ -27,9 +27,6 @@ public:
wxPen( const wxColour &colour, int width = 1, int style = wxSOLID );
virtual ~wxPen();
bool Ok() const { return IsOk(); }
bool IsOk() const { return m_refData != NULL; }
bool operator==(const wxPen& pen) const;
bool operator!=(const wxPen& pen) const { return !(*this == pen); }
@@ -51,9 +48,8 @@ public:
wxDash* GetDash() const;
protected:
// 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;
DECLARE_DYNAMIC_CLASS(wxPen)
};

View File

@@ -63,9 +63,8 @@ public:
GdkRegion *GetRegion() const;
protected:
// 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;
// wxRegionBase pure virtuals
virtual bool DoIsEqual(const wxRegion& region) const;

View File

@@ -78,14 +78,12 @@ public:
wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM );
wxBitmap( const wxImage& image, int depth = -1 ) { (void)CreateFromImage(image, depth); }
virtual ~wxBitmap();
bool Ok() const { return IsOk(); }
bool IsOk() const;
bool Create(int width, int height, int depth = -1);
int GetHeight() const;
int GetWidth() const;
int GetDepth() const;
virtual int GetHeight() const;
virtual int GetWidth() const;
virtual int GetDepth() const;
wxImage ConvertToImage() const;
@@ -134,8 +132,8 @@ public:
protected:
bool CreateFromImage(const wxImage& image, int depth);
virtual wxObjectRefData *CreateRefData() const;
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
virtual wxGDIRefData *CreateGDIRefData() const;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
private:
// to be called from CreateFromImage only!

View File

@@ -36,9 +36,6 @@ public:
wxBrush( const wxBitmap &stippleBitmap );
virtual ~wxBrush();
bool Ok() const { return IsOk(); }
bool IsOk() const { return m_refData != NULL; }
bool operator==(const wxBrush& brush) const;
bool operator!=(const wxBrush& brush) const { return !(*this == brush); }
@@ -52,9 +49,8 @@ public:
void SetStipple( const wxBitmap& stipple );
private:
// 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;
DECLARE_DYNAMIC_CLASS(wxBrush)
};

View File

@@ -45,8 +45,6 @@ public:
virtual bool FromString(const wxString& str);
bool IsOk() const { return m_refData != NULL; }
bool operator==(const wxColour& col) const;
bool operator!=(const wxColour& col) const { return !(*this == col); }
@@ -62,8 +60,8 @@ public:
protected:
// 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;
virtual void
InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a);

View File

@@ -10,8 +10,7 @@
#ifndef __GTKCURSORH__
#define __GTKCURSORH__
#include "wx/defs.h"
#include "wx/object.h"
#include "wx/gdiobj.h"
#include "wx/gdicmn.h"
#if wxUSE_IMAGE
@@ -22,10 +21,9 @@
// wxCursor
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxCursor: public wxObject
class WXDLLIMPEXP_CORE wxCursor : public wxGDIObject
{
public:
wxCursor();
wxCursor( int cursorId );
#if wxUSE_IMAGE
@@ -35,13 +33,15 @@ public:
int hotSpotX=-1, int hotSpotY=-1,
const char maskBits[] = NULL, const wxColour *fg = NULL, const wxColour *bg = NULL );
virtual ~wxCursor();
bool Ok() const { return IsOk(); }
bool IsOk() const;
// implementation
GdkCursor *GetCursor() const;
protected:
virtual wxGDIRefData *CreateGDIRefData() const;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
private:
DECLARE_DYNAMIC_CLASS(wxCursor)
};

View File

@@ -91,9 +91,10 @@ public:
GdkFont* GetInternalFont(float scale = 1.0) const;
// no data :-)
protected:
virtual wxGDIRefData *CreateGDIRefData() const;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info );
private:

View File

@@ -40,9 +40,6 @@ public:
wxPen( const wxColour &colour, int width = 1, int style = wxSOLID );
virtual ~wxPen();
bool Ok() const { return IsOk(); }
bool IsOk() const { return m_refData != NULL; }
bool operator==(const wxPen& pen) const;
bool operator!=(const wxPen& pen) const { return !(*this == pen); }
@@ -64,9 +61,8 @@ public:
wxDash* GetDash() const;
private:
// 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;
DECLARE_DYNAMIC_CLASS(wxPen)
};

View File

@@ -63,9 +63,8 @@ public:
GdkRegion *GetRegion() const;
protected:
// 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;
// wxRegionBase pure virtuals
virtual bool DoIsEqual(const wxRegion& region) const;

View File

@@ -46,8 +46,6 @@ public:
wxIconBundle& operator=(const wxIconBundle& ic)
{ if ( this != &ic) Ref(ic); return *this; }
virtual bool IsOk() const;
// adds all the icons contained in the file to the collection,
// if the collection already contains icons with the same
@@ -87,8 +85,8 @@ public:
bool IsEmpty() const { return GetIconCount() == 0; }
protected:
virtual wxObjectRefData *CreateRefData() const;
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
virtual wxGDIRefData *CreateGDIRefData() const;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
private:
// delete all icons

View File

@@ -134,8 +134,6 @@ public:
// copies the contents and mask of the given (colour) icon to the bitmap
virtual bool CopyFromIcon(const wxIcon& icon);
bool Ok() const { return IsOk(); }
bool IsOk() const;
int GetWidth() const;
int GetHeight() const;
int GetDepth() const;
@@ -181,9 +179,8 @@ public:
void EndRawAccess() ;
protected:
// 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;
};
#endif
// _WX_BITMAP_H_
#endif // _WX_BITMAP_H_

View File

@@ -33,19 +33,18 @@ class WXDLLEXPORT wxBrush: public wxBrushBase
virtual void SetStipple(const wxBitmap& stipple) ;
bool operator==(const wxBrush& brush) const;
bool operator != (const wxBrush& brush) const
{ return !(*this == brush); }
bool operator!=(const wxBrush& brush) const { return !(*this == brush); }
const wxColour& GetColour() const ;
virtual int GetStyle() const ;
wxBitmap *GetStipple() 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_

View File

@@ -34,7 +34,7 @@ public:
virtual ~wxColour();
// accessors
bool IsOk() const;
virtual bool IsOk() const { return m_cgColour; }
ChannelType Red() const { return m_red; }
ChannelType Green() const { return m_green; }

View File

@@ -17,12 +17,11 @@
// Cursor
class WXDLLEXPORT wxCursor : public wxGDIObject
{
DECLARE_DYNAMIC_CLASS(wxCursor)
public:
wxCursor();
wxCursor(const char bits[], int width, int height, int hotSpotX = -1, int hotSpotY = -1,
wxCursor(const char bits[], int width, int height,
int hotSpotX = -1, int hotSpotY = -1,
const char maskBits[] = NULL);
wxCursor(const wxImage & image) ;
@@ -35,18 +34,21 @@ public:
virtual ~wxCursor();
bool CreateFromXpm(const char **bits) ;
virtual bool Ok() const { return IsOk(); }
virtual bool IsOk() const ;
void MacInstall() const ;
void SetHCURSOR(WXHCURSOR cursor);
inline WXHCURSOR GetHCURSOR() const ;
WXHCURSOR GetHCURSOR() const;
private:
virtual wxGDIRefData *CreateGDIRefData() const;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
void CreateFromImage(const wxImage & image) ;
DECLARE_DYNAMIC_CLASS(wxCursor)
};
extern WXDLLEXPORT void wxSetCursor(const wxCursor& cursor);
#endif
// _WX_CURSOR_H_
#endif // _WX_CURSOR_H_

View File

@@ -110,11 +110,14 @@ public:
void* MacGetATSUStyle() const ;
#endif
protected:
virtual wxGDIRefData *CreateGDIRefData() const;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
private:
void Unshare();
DECLARE_DYNAMIC_CLASS(wxFont)
};
#endif
// _WX_FONT_H_
#endif // _WX_FONT_H_

View File

@@ -45,8 +45,6 @@ public:
// ctors, assignment operators...), but it's ok to have such function
void CopyFromBitmap(const wxBitmap& bmp);
bool Ok() const { return IsOk(); }
bool IsOk() const;
int GetWidth() const;
int GetHeight() const;
int GetDepth() const;
@@ -57,6 +55,11 @@ public:
WXHICON GetHICON() const ;
protected:
virtual wxGDIRefData *CreateGDIRefData() const;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
private:
DECLARE_DYNAMIC_CLASS(wxIcon)
};

View File

@@ -39,7 +39,6 @@ class wxMetafileRefData ;
class WXDLLEXPORT wxMetafile : public wxGDIObject
{
DECLARE_DYNAMIC_CLASS(wxMetafile)
public:
wxMetafile(const wxString& file = wxEmptyString);
virtual ~wxMetafile(void);
@@ -49,8 +48,6 @@ public:
virtual bool SetClipboard(int width = 0, int height = 0);
virtual bool Play(wxDC *dc);
bool Ok() const { return IsOk(); }
bool IsOk() const ;
wxSize GetSize() const;
int GetWidth() const { return GetSize().x; }
@@ -65,6 +62,12 @@ public:
// backwards compatibility
void SetPICT(void* pictHandle) ;
#endif
protected:
virtual wxGDIRefData *CreateGDIRefData() const;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
DECLARE_DYNAMIC_CLASS(wxMetafile)
};

View File

@@ -12,24 +12,8 @@
#ifndef _WX_PALETTE_H_
#define _WX_PALETTE_H_
#include "wx/colour.h"
#include "wx/gdiobj.h"
class WXDLLIMPEXP_FWD_CORE wxPalette;
class WXDLLEXPORT wxPaletteRefData: public wxGDIRefData
{
DECLARE_NO_COPY_CLASS(wxPaletteRefData)
friend class WXDLLIMPEXP_FWD_CORE wxPalette;
public:
wxPaletteRefData();
virtual ~wxPaletteRefData();
protected:
wxColour* m_palette;
wxInt32 m_count ;
};
#define M_PALETTEDATA ((wxPaletteRefData *)m_refData)
class WXDLLEXPORT wxPalette : public wxPaletteBase
@@ -44,14 +28,14 @@ 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() const { return (m_refData != NULL) ; }
virtual int GetColoursCount() const;
protected:
virtual wxGDIRefData *CreateGDIRefData() const;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
private:
DECLARE_DYNAMIC_CLASS(wxPalette)
};
#endif
// _WX_PALETTE_H_
#endif // _WX_PALETTE_H_

View File

@@ -16,12 +16,9 @@
#include "wx/colour.h"
#include "wx/bitmap.h"
class WXDLLIMPEXP_FWD_CORE wxPen;
// Pen
class WXDLLEXPORT wxPen : public wxGDIObject
{
DECLARE_DYNAMIC_CLASS(wxPen)
public:
wxPen();
wxPen(const wxColour& col, int width = 1, int style = wxSOLID);
@@ -56,8 +53,14 @@ public:
// Useful helper: create the brush resource
bool RealizeResource();
protected:
virtual wxGDIRefData *CreateGDIRefData() const;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
private:
void Unshare();
DECLARE_DYNAMIC_CLASS(wxPen)
};
#endif

View File

@@ -43,6 +43,9 @@ public:
const WXHRGN GetWXHRGN() const ;
protected:
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;
virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const;

View File

@@ -38,8 +38,6 @@ public:
wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_RESOURCE);
wxBitmap(const wxImage& image, int depth = -1);
virtual ~wxBitmap() {}
bool Ok() const { return IsOk(); }
bool IsOk() const;
bool Create(int width, int height, int depth = -1);

View File

@@ -33,11 +33,9 @@ public:
wxBrush() {}
wxBrush(const wxColour &colour, int style = wxSOLID);
wxBrush(const wxBitmap &stippleBitmap);
virtual ~wxBrush() {}
bool operator==(const wxBrush& brush) const;
bool operator!=(const wxBrush& brush) const;
bool Ok() const { return IsOk(); }
bool IsOk() const;
virtual int GetStyle() const;
wxColour &GetColour() const;
@@ -54,9 +52,8 @@ public:
void* GetPixPattern() const;
protected:
// 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:
DECLARE_DYNAMIC_CLASS(wxBrush)

View File

@@ -10,8 +10,7 @@
#ifndef __WX_CURSOR_H__
#define __WX_CURSOR_H__
#include "wx/defs.h"
#include "wx/object.h"
#include "wx/gdiobj.h"
#include "wx/gdicmn.h"
class MGLCursor;
@@ -20,7 +19,7 @@ class MGLCursor;
// wxCursor
//-----------------------------------------------------------------------------
class WXDLLEXPORT wxCursor: public wxObject
class WXDLLEXPORT wxCursor : public wxGDIObject
{
public:
@@ -33,8 +32,6 @@ public:
long flags = wxBITMAP_TYPE_CUR_RESOURCE,
int hotSpotX = 0, int hotSpotY = 0);
virtual ~wxCursor();
bool Ok() const { return IsOk(); }
bool IsOk() const;
// implementation
MGLCursor *GetMGLCursor() const;

View File

@@ -87,8 +87,8 @@ public:
protected:
// 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:
DECLARE_DYNAMIC_CLASS(wxFont)

View File

@@ -29,14 +29,10 @@ struct palette_t;
class WXDLLEXPORT wxPalette : public wxPaletteBase
{
DECLARE_DYNAMIC_CLASS(wxPalette)
public:
wxPalette();
wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
virtual ~wxPalette();
virtual bool Ok() const { return IsOk(); }
virtual bool IsOk() const;
bool Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
int GetPixel(unsigned char red, unsigned char green, unsigned char blue) const;
@@ -46,6 +42,8 @@ public:
virtual int GetColoursCount() const;
palette_t *GetMGLpalette_t() const;
DECLARE_DYNAMIC_CLASS(wxPalette)
};
#endif // __WX_PALETTE_H__

View File

@@ -56,16 +56,12 @@ public:
wxDash* GetDash() const;
wxBitmap *GetStipple() const;
bool Ok() const { return IsOk(); }
bool IsOk() const;
// implementation:
void* GetPixPattern() const;
protected:
// 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:
DECLARE_DYNAMIC_CLASS(wxPen)

View File

@@ -44,9 +44,8 @@ public:
const MGLRegion& GetMGLRegion() const;
protected:
// 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;
// wxRegionBase pure virtuals
virtual bool DoIsEqual(const wxRegion& region) const;

View File

@@ -36,7 +36,7 @@ public:
// accessors
bool IsOk() const {return m_isInit; }
virtual bool IsOk() const {return m_isInit; }
unsigned char Red() const { return m_red; }
unsigned char Green() const { return m_green; }
unsigned char Blue() const { return m_blue; }

View File

@@ -12,16 +12,14 @@
#ifndef _WX_CURSOR_H_
#define _WX_CURSOR_H_
#include "wx/object.h"
#include "wx/gdiobj.h"
#include "wx/gdicmn.h"
class WXDLLIMPEXP_FWD_CORE wxImage;
// Cursor
class WXDLLEXPORT wxCursor: public wxObject
class WXDLLEXPORT wxCursor : public wxGDIObject
{
DECLARE_DYNAMIC_CLASS(wxCursor)
public:
wxCursor();
@@ -39,12 +37,14 @@ public:
wxCursor(wxStockCursor id);
virtual ~wxCursor();
virtual bool Ok() const { return IsOk(); }
virtual bool IsOk() const;
// Motif-specific.
// Create/get a cursor for the current display
WXCursor GetXCursor(WXDisplay* display) const;
protected:
virtual wxGDIRefData *CreateGDIRefData() const;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
private:
void Create(const char bits[], int width, int height,
int hotSpotX = -1, int hotSpotY = -1,
@@ -53,6 +53,8 @@ private:
// Make a cursor from standard id
WXCursor MakeCursor(WXDisplay* display, wxStockCursor id) const;
DECLARE_DYNAMIC_CLASS(wxCursor)
};
extern WXDLLEXPORT void wxSetCursor(const wxCursor& cursor);

View File

@@ -107,7 +107,11 @@ public:
// like the function above but does a copy for XmFontList
WXFontType GetFontTypeC(WXDisplay* display) const;
static WXString GetFontTag();
protected:
virtual wxGDIRefData *CreateGDIRefData() const;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info );
void Unshare();
@@ -116,5 +120,4 @@ private:
DECLARE_DYNAMIC_CLASS(wxFont)
};
#endif
// _WX_FONT_H_
#endif // _WX_FONT_H_

View File

@@ -176,7 +176,7 @@ public:
protected:
virtual wxGDIImageRefData *CreateData() const;
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
// creates an uninitialized bitmap, called from Create()s above
bool DoCreate(int w, int h, int depth, WXHDC hdc);

View File

@@ -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_

View File

@@ -36,7 +36,7 @@ public:
// accessors
// ---------
bool IsOk() const { return m_isInit; }
virtual bool IsOk() const { return m_isInit; }
unsigned char Red() const { return m_red; }
unsigned char Green() const { return m_green; }

View File

@@ -13,6 +13,7 @@
#define _WX_MSW_ENHMETA_H_
#include "wx/dc.h"
#include "wx/gdiobj.h"
#if wxUSE_DRAG_AND_DROP
#include "wx/dataobj.h"
@@ -22,12 +23,12 @@
// wxEnhMetaFile: encapsulation of Win32 HENHMETAFILE
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxEnhMetaFile : public wxObject
class WXDLLEXPORT wxEnhMetaFile : public wxGDIObject
{
public:
wxEnhMetaFile(const wxString& file = wxEmptyString) : m_filename(file)
{ Init(); }
wxEnhMetaFile(const wxEnhMetaFile& metafile) : wxObject()
wxEnhMetaFile(const wxEnhMetaFile& metafile) : wxGDIObject()
{ Init(); Assign(metafile); }
wxEnhMetaFile& operator=(const wxEnhMetaFile& metafile)
{ Free(); Assign(metafile); return *this; }
@@ -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; }
@@ -62,6 +62,11 @@ protected:
void Free();
void Assign(const wxEnhMetaFile& mf);
// we don't use these functions (but probably should) but have to implement
// them as they're pure virtual in the base class
virtual wxGDIRefData *CreateGDIRefData() const;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
private:
wxString m_filename;
WXHANDLE m_hMF;

View File

@@ -135,8 +135,8 @@ protected:
virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info);
// implement wxObject virtuals which are used by AllocExclusive()
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(wxFont)

View File

@@ -51,7 +51,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; }
@@ -154,9 +154,6 @@ public:
void SetHandle(WXHANDLE handle)
{ AllocExclusive(); 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; }
@@ -180,8 +177,17 @@ protected:
// create the data for the derived class here
virtual wxGDIImageRefData *CreateData() const = 0;
// implement the wxObject method in terms of our, more specific, one
virtual wxObjectRefData *CreateRefData() const { return CreateData(); }
// implement the wxGDIObject method in terms of our, more specific, one
virtual wxGDIRefData *CreateGDIRefData() const { return CreateData(); }
// we can't [efficiently] clone objects of this class
virtual wxGDIRefData *
CloneGDIRefData(const wxGDIRefData *WXUNUSED(data)) const
{
wxFAIL_MSG( _T("must be implemented if used") );
return NULL;
}
static wxGDIImageHandlerList ms_handlers;
};

View File

@@ -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()); }
@@ -96,6 +97,9 @@ public:
protected:
virtual void DoGetSize(int *width, int *height) const;
virtual wxGDIRefData *CreateGDIRefData() const;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
int m_windowsMappingMode;
wxMetafile* m_metaFile;

View File

@@ -14,45 +14,38 @@
#include "wx/gdiobj.h"
class WXDLLIMPEXP_FWD_CORE wxPalette;
class WXDLLEXPORT wxPaletteRefData: public wxGDIRefData
{
friend class WXDLLIMPEXP_FWD_CORE wxPalette;
public:
wxPaletteRefData(void);
virtual ~wxPaletteRefData(void);
protected:
WXHPALETTE m_hPalette;
};
#define M_PALETTEDATA ((wxPaletteRefData *)m_refData)
class WXDLLEXPORT wxPalette : public wxPaletteBase
{
public:
wxPalette();
wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
virtual ~wxPalette(void);
bool Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
wxPalette() { }
wxPalette(int n,
unsigned char *red, unsigned char *green, unsigned char *blue)
{
Create(n, red, green, blue);
}
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;
bool Create(int n,
unsigned char *red, unsigned char *green, unsigned char *blue);
virtual int GetColoursCount() const;
virtual bool Ok() const { return IsOk(); }
virtual bool IsOk(void) const { return (m_refData != NULL) ; }
int
GetPixel(unsigned char red, unsigned char green, unsigned char blue) const;
virtual bool FreeResource(bool force = false);
bool
GetRGB(int pixel,
unsigned char *red, unsigned char *green, unsigned char *blue) const;
// implemetation
inline WXHPALETTE GetHPALETTE(void) const { return (M_PALETTEDATA ? M_PALETTEDATA->m_hPalette : 0); }
WXHPALETTE GetHPALETTE() const;
void SetHPALETTE(WXHPALETTE pal);
protected:
virtual wxGDIRefData *CreateGDIRefData() const;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
private:
DECLARE_DYNAMIC_CLASS(wxPalette)
};
#endif
// _WX_PALETTE_H_
#endif // _WX_PALETTE_H_

View File

@@ -30,9 +30,6 @@ public:
bool operator==(const wxPen& pen) const;
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);
@@ -61,8 +58,8 @@ public:
virtual bool IsFree() const;
protected:
virtual wxObjectRefData* CreateRefData() const;
virtual wxObjectRefData* CloneRefData(const wxObjectRefData* data) const;
virtual wxGDIRefData* CreateGDIRefData() const;
virtual wxGDIRefData* CloneGDIRefData(const wxGDIRefData* data) const;
// same as FreeResource() + RealizeResource()
bool Recreate();

View File

@@ -43,8 +43,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;

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;

View File

@@ -25,8 +25,6 @@ class WXDLLEXPORT wxPaletteBase: public wxGDIObject
public:
virtual ~wxPaletteBase() { }
virtual bool Ok() const { return IsOk(); }
virtual bool IsOk() const = 0;
virtual int GetColoursCount() const { wxFAIL_MSG( _T("not implemented") ); return 0; }
};

View File

@@ -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_

View File

@@ -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; }

View File

@@ -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;
};

View File

@@ -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()); }

View File

@@ -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); }

View File

@@ -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);

View File

@@ -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;

View File

@@ -201,7 +201,7 @@ protected:
/// wxFontMgrFontRefData implementation using wxFontsManager classes
class wxFontMgrFontRefData : public wxObjectRefData
class wxFontMgrFontRefData : public wxGDIRefData
{
public:
wxFontMgrFontRefData(int size = wxDEFAULT,

View File

@@ -82,9 +82,6 @@ public:
// accessors
// ---------
bool Ok() const { return IsOk(); }
bool IsOk() const { return m_refData != NULL; }
// Is region empty?
virtual bool IsEmpty() const = 0;
bool Empty() const { return IsEmpty(); }

View File

@@ -84,9 +84,6 @@ public:
wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM );
virtual ~wxBitmap();
bool Ok() const { return IsOk(); }
bool IsOk() const;
static void InitStandardHandlers();
bool Create(int width, int height, int depth = -1);
@@ -138,8 +135,8 @@ public:
WXDisplay *GetDisplay() 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(wxBitmap)

View File

@@ -35,9 +35,6 @@ public:
wxBrush( const wxBitmap &stippleBitmap );
virtual ~wxBrush();
bool Ok() const { return IsOk(); }
bool IsOk() const { return m_refData != NULL; }
bool operator==(const wxBrush& brush) const;
bool operator!=(const wxBrush& brush) const { return !(*this == brush); }
@@ -51,12 +48,10 @@ public:
void SetStipple( const wxBitmap& stipple );
protected:
// 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;
DECLARE_DYNAMIC_CLASS(wxBrush)
};
#endif
// _WX_BRUSH_H_
#endif // _WX_BRUSH_H_

View File

@@ -44,8 +44,6 @@ public:
virtual ~wxColour();
bool IsOk() const { return m_refData != NULL; }
bool operator==(const wxColour& col) const;
bool operator!=(const wxColour& col) const { return !(*this == col); }
@@ -60,9 +58,8 @@ public:
WXColor *GetColor() const;
protected:
// 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;
virtual void
InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
@@ -73,6 +70,4 @@ private:
DECLARE_DYNAMIC_CLASS(wxColour)
};
#endif
// _WX_COLOUR_H_
#endif // _WX_COLOUR_H_

View File

@@ -12,40 +12,38 @@
#ifndef _WX_CURSOR_H_
#define _WX_CURSOR_H_
#include "wx/bitmap.h"
#include "wx/gdiobj.h"
#if wxUSE_IMAGE
#include "wx/image.h"
#endif
class WXDLLIMPEXP_FWD_CORE wxImage;
//-----------------------------------------------------------------------------
// wxCursor
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxCursor: public wxObject
class WXDLLIMPEXP_CORE wxCursor : public wxGDIObject
{
public:
wxCursor();
wxCursor( int cursorId );
#if wxUSE_IMAGE
wxCursor( const wxImage & image );
#endif
wxCursor( const char bits[], int width, int height,
int hotSpotX=-1, int hotSpotY=-1,
const char maskBits[]=0, wxColour *fg=0, wxColour *bg=0 );
virtual ~wxCursor();
bool Ok() const { return IsOk(); }
bool IsOk() const;
// implementation
WXCursor GetCursor() const;
protected:
virtual wxGDIRefData *CreateGDIRefData() const;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
private:
DECLARE_DYNAMIC_CLASS(wxCursor)
};
#endif
// _WX_CURSOR_H_
#endif // _WX_CURSOR_H_

View File

@@ -101,6 +101,9 @@ public:
#endif
protected:
virtual wxGDIRefData *CreateGDIRefData() const;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info );
void Unshare();

View File

@@ -12,7 +12,6 @@
#ifndef _WX_PALETTE_H_
#define _WX_PALETTE_H_
#include "wx/gdiobj.h"
#include "wx/list.h"
class WXDLLIMPEXP_FWD_CORE wxPalette;
@@ -58,16 +57,16 @@ 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() const { return (m_refData != NULL) ; }
// X-specific
WXColormap GetXColormap(WXDisplay* display = NULL) const;
bool TransferBitmap(void *data, int depth, int size);
bool TransferBitmap8(unsigned char *data, unsigned long size, void *dest, unsigned int bpp);
unsigned long *GetXPixArray(WXDisplay* display, int *pix_array_n);
void PutXColormap(WXDisplay* display, WXColormap cmap, bool destroyable);
protected:
virtual wxGDIRefData *CreateGDIRefData() const;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
};
#endif
// _WX_PALETTE_H_
#endif // _WX_PALETTE_H_

View File

@@ -38,9 +38,6 @@ public:
wxPen( const wxBitmap &stipple, int width );
virtual ~wxPen();
bool Ok() const { return IsOk(); }
bool IsOk() const { return m_refData != NULL; }
bool operator == ( const wxPen& pen ) const;
bool operator != (const wxPen& pen) const { return !(*this == pen); }
@@ -64,12 +61,10 @@ public:
wxBitmap* GetStipple() const;
protected:
// 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;
DECLARE_DYNAMIC_CLASS(wxPen)
};
#endif
// _WX_PEN_H_
#endif // _WX_PEN_H_

View File

@@ -61,9 +61,8 @@ public:
WXRegion *GetX11Region() const;
protected:
// 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;
// wxRegionBase pure virtuals
virtual bool DoIsEqual(const wxRegion& region) const;

View File

@@ -46,6 +46,8 @@ public:
wxBitmapRefData( const wxBitmapRefData& data );
virtual ~wxBitmapRefData();
virtual bool IsOk() const { return m_ok; }
protected:
int m_width;
int m_height;
@@ -145,12 +147,12 @@ wxBitmap::wxBitmap(const wxString& filename, wxBitmapType type)
LoadFile(filename, type);
}
wxObjectRefData *wxBitmap::CreateRefData() const
wxGDIRefData *wxBitmap::CreateGDIRefData() const
{
return new wxBitmapRefData;
}
wxObjectRefData *wxBitmap::CloneRefData(const wxObjectRefData *data) const
wxGDIRefData *wxBitmap::CloneGDIRefData(const wxGDIRefData *data) const
{
return new wxBitmapRefData(*(wxBitmapRefData*)data);
}
@@ -254,11 +256,6 @@ void wxBitmap::SetMask(wxMask *mask)
M_BITMAPDATA->m_bitmapMask = mask ;
}
bool wxBitmap::IsOk() const
{
return m_refData && M_BITMAPDATA->m_ok;
}
wxPalette* wxBitmap::GetPalette() const
{
if(!m_refData)

View File

@@ -159,12 +159,12 @@ wxBrush::wxBrush(const wxBitmap& stipple)
m_refData = new wxBrushRefData(stipple);
}
wxObjectRefData *wxBrush::CreateRefData() const
wxGDIRefData *wxBrush::CreateGDIRefData() const
{
return new wxBrushRefData;
}
wxObjectRefData *wxBrush::CloneRefData(const wxObjectRefData *data) const
wxGDIRefData *wxBrush::CloneGDIRefData(const wxGDIRefData *data) const
{
return new wxBrushRefData(*(wxBrushRefData *)data);
}

View File

@@ -331,6 +331,16 @@ bool wxFont::Create(const wxNativeFontInfo& nativeFontInfo)
return true;
}
wxGDIRefData *wxFont::CreateGDIRefData() const
{
return new wxFontRefData;
}
wxGDIRefData *wxFont::CloneGDIRefData(const wxGDIRefData *data) const
{
return new wxFontRefData(*wx_static_cast(const wxFontRefData *, data));
}
void wxFont::SetEncoding(wxFontEncoding)
{
}
@@ -398,24 +408,9 @@ bool wxFont::RealizeResource()
return false;
}
void wxFont::Unshare()
{
// Don't change shared data
if (!m_refData)
{
m_refData = new wxFontRefData();
}
else
{
wxFontRefData* ref = new wxFontRefData(*(wxFontRefData*)m_refData);
UnRef();
m_refData = ref;
}
}
void wxFont::SetPointSize(int pointSize)
{
Unshare();
AllocExclusive();
M_FONTDATA->m_info.pointSize = pointSize;
@@ -424,7 +419,7 @@ void wxFont::SetPointSize(int pointSize)
void wxFont::SetFamily(int family)
{
Unshare();
AllocExclusive();
M_FONTDATA->m_info.family = static_cast<wxFontFamily>(family);
@@ -433,7 +428,7 @@ void wxFont::SetFamily(int family)
void wxFont::SetStyle(int style)
{
Unshare();
AllocExclusive();
M_FONTDATA->m_info.style = static_cast<wxFontStyle>(style);
@@ -442,7 +437,7 @@ void wxFont::SetStyle(int style)
void wxFont::SetWeight(int weight)
{
Unshare();
AllocExclusive();
M_FONTDATA->m_info.weight = static_cast<wxFontWeight>(weight);
@@ -451,7 +446,7 @@ void wxFont::SetWeight(int weight)
bool wxFont::SetFaceName(const wxString& faceName)
{
Unshare();
AllocExclusive();
M_FONTDATA->m_info.faceName = faceName;
@@ -462,7 +457,7 @@ bool wxFont::SetFaceName(const wxString& faceName)
void wxFont::SetUnderlined(bool underlined)
{
Unshare();
AllocExclusive();
M_FONTDATA->m_info.underlined = underlined;

View File

@@ -32,6 +32,8 @@ public:
wxIconRefData( const wxIconRefData& data );
virtual ~wxIconRefData();
virtual bool IsOk() const { return m_ok; }
protected:
int m_width;
int m_height;
@@ -98,6 +100,16 @@ wxIcon::~wxIcon()
{
}
wxGDIRefData *wxIcon::CreateGDIRefData() const
{
return new wxIconRefData;
}
wxGDIRefData *wxIcon::CloneGDIRefData(const wxGDIRefData *data) const
{
return new wxIconRefData(*wx_static_cast(const wxIconRefData *, data));
}
bool wxIcon::CreateFromXpm(const char **xpm)
{
wxBitmap bitmap(xpm);
@@ -126,11 +138,6 @@ void wxIcon::CopyFromBitmap(const wxBitmap& bitmap)
M_ICONDATA->m_quality = 0;
}
bool wxIcon::IsOk() const
{
return m_refData && M_ICONDATA->m_ok;
}
int wxIcon::GetWidth() const
{
if(!m_refData)

View File

@@ -266,12 +266,12 @@ wxPen::wxPen(const wxBitmap& stipple, int width)
m_refData = new wxPenRefData(wxNullColour,width,wxSTIPPLE,stipple);
}
wxObjectRefData *wxPen::CreateRefData() const
wxGDIRefData *wxPen::CreateGDIRefData() const
{
return new wxPenRefData;
}
wxObjectRefData *wxPen::CloneRefData(const wxObjectRefData *data) const
wxGDIRefData *wxPen::CloneGDIRefData(const wxGDIRefData *data) const
{
return new wxPenRefData(*(wxPenRefData *)data);
}

View File

@@ -341,11 +341,6 @@ bool wxFontBase::operator==(const wxFont& font) const
);
}
bool wxFontBase::operator!=(const wxFont& font) const
{
return !(*this == font);
}
wxString wxFontBase::GetFamilyString() const
{
wxCHECK_MSG( Ok(), wxT("wxDEFAULT"), wxT("invalid font") );

View File

@@ -34,7 +34,7 @@
#endif
IMPLEMENT_DYNAMIC_CLASS(wxGDIObject, wxObject)
IMPLEMENT_ABSTRACT_CLASS(wxGDIObject, wxObject)
WXDLLIMPEXP_DATA_CORE(wxBrushList*) wxTheBrushList;

View File

@@ -51,6 +51,8 @@ class WXDLLEXPORT wxIconBundleRefData : public wxGDIRefData
public:
// default and copy ctors and assignment operators are ok
virtual bool IsOk() const { return !m_icons.empty(); }
protected:
wxIconArray m_icons;
@@ -84,12 +86,12 @@ wxIconBundle::wxIconBundle(const wxIcon& icon)
AddIcon(icon);
}
wxObjectRefData *wxIconBundle::CreateRefData() const
wxGDIRefData *wxIconBundle::CreateGDIRefData() const
{
return new wxIconBundleRefData;
}
wxObjectRefData *wxIconBundle::CloneRefData(const wxObjectRefData *data) const
wxGDIRefData *wxIconBundle::CloneGDIRefData(const wxGDIRefData *data) const
{
return new wxIconBundleRefData(*wx_static_cast(const wxIconBundleRefData *, data));
}
@@ -99,11 +101,6 @@ void wxIconBundle::DeleteIcons()
UnRef();
}
bool wxIconBundle::IsOk() const
{
return M_ICONBUNDLEDATA && !M_ICONBUNDLEDATA->m_icons.IsEmpty();
}
void wxIconBundle::AddIcon(const wxString& file, long type)
{
#ifdef __WXMAC__

Some files were not shown because too many files have changed in this diff Show More