provide backward-compat wxCursor(int) ctor; remove empty stubs of XBM ctor from all ports except gtk,motif; make all ports emit wxLogError on invalid bitmap types; implement wxCursor(const wxString&, ...) ctor on GTK (not tested yet)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55884 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi
2008-09-25 17:56:07 +00:00
parent 5a8009d2f1
commit 0ef5b1dad1
23 changed files with 216 additions and 167 deletions

View File

@@ -39,14 +39,13 @@ class WXDLLIMPEXP_CORE wxCursor: public wxBitmap
public:
wxCursor();
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,
wxCursor(const wxString& name, wxBitmapType type = wxCURSOR_DEFAULT_TYPE,
int hotSpotX = 0, int hotSpotY = 0);
wxCursor(wxStockCursor cursor_type);
wxCursor(wxStockCursor id) { InitFromStock(id); }
#if WXWIN_COMPATIBILITY_2_8
wxCursor(int id) { InitFromStock((wxStockCursor)id); }
#endif
virtual ~wxCursor();
// FIXME: operator==() is wrong!
@@ -55,6 +54,8 @@ public:
WX_NSCursor GetNSCursor() const { return M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0; }
private:
void InitFromStock(wxStockCursor);
DECLARE_DYNAMIC_CLASS(wxCursor)
};

View File

@@ -15,26 +15,37 @@
#include "wx/defs.h"
#if defined(__WXPALMOS__)
#define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE
#include "wx/palmos/cursor.h"
#elif defined(__WXMSW__)
#define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE
#include "wx/msw/cursor.h"
#elif defined(__WXMOTIF__)
#define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_XBM
#include "wx/motif/cursor.h"
#elif defined(__WXGTK20__)
#define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_XPM
#include "wx/gtk/cursor.h"
#elif defined(__WXGTK__)
#define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_XPM
#include "wx/gtk1/cursor.h"
#elif defined(__WXX11__)
#define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_XPM
#include "wx/x11/cursor.h"
#elif defined(__WXMGL__)
#define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE
#include "wx/mgl/cursor.h"
#elif defined(__WXDFB__)
#define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE
#include "wx/dfb/cursor.h"
#elif defined(__WXMAC__)
#define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_MACCURSOR_RESOURCE
#include "wx/osx/cursor.h"
#elif defined(__WXCOCOA__)
#define wxCURSOR_DEFAULT_TYPE 0
#include "wx/cocoa/cursor.h"
#elif defined(__WXPM__)
#define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE
#include "wx/os2/cursor.h"
#endif

View File

@@ -24,18 +24,20 @@ class WXDLLIMPEXP_CORE wxCursor : public wxGDIObject
{
public:
wxCursor() {}
wxCursor(wxStockCursor cursorId);
wxCursor(const char bits[], int width, int height,
int hotSpotX=-1, int hotSpotY=-1,
const char maskBits[]=0, wxColour *fg=0, wxColour *bg=0);
wxCursor(wxStockCursor id) { InitFromStock(id); }
#if WXWIN_COMPATIBILITY_2_8
wxCursor(int id) { InitFromStock((wxStockCursor)id); }
#endif
wxCursor(const wxString& name,
long flags = wxBITMAP_TYPE_CUR_RESOURCE,
wxBitmapType type = wxCURSOR_DEFAULT_TYPE,
int hotSpotX = 0, int hotSpotY = 0);
// implementation
wxBitmap GetBitmap() const;
protected:
void InitFromStock(wxStockCursor);
// ref counting code
virtual wxGDIRefData *CreateGDIRefData() const;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;

View File

@@ -24,7 +24,10 @@ class WXDLLIMPEXP_CORE wxCursor : public wxGDIObject
{
public:
wxCursor();
wxCursor( wxStockCursor cursorId );
wxCursor(wxStockCursor id) { InitFromStock(id); }
#if WXWIN_COMPATIBILITY_2_8
wxCursor(int id) { InitFromStock((wxStockCursor)id); }
#endif
#if wxUSE_IMAGE
wxCursor( const wxImage & image );
#endif
@@ -32,6 +35,9 @@ public:
int hotSpotX = -1, int hotSpotY = -1,
const char maskBits[] = NULL,
const wxColour* fg = NULL, const wxColour* bg = NULL);
wxCursor(const wxString& name,
wxBitmapType type = wxCURSOR_DEFAULT_TYPE,
int hotSpotX = 0, int hotSpotY = 0);
virtual ~wxCursor();
// implementation
@@ -39,6 +45,8 @@ public:
GdkCursor *GetCursor() const;
protected:
void InitFromStock(wxStockCursor);
virtual wxGDIRefData *CreateGDIRefData() const;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;

View File

@@ -25,13 +25,25 @@ class WXDLLIMPEXP_CORE wxCursor : public wxGDIObject
{
public:
wxCursor();
wxCursor( wxStockCursor cursorId );
wxCursor(wxStockCursor id) { InitFromStock(id); }
#if WXWIN_COMPATIBILITY_2_8
wxCursor(int id) { InitFromStock((wxStockCursor)id); }
#endif
#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[] = NULL, const wxColour *fg = NULL, const wxColour *bg = NULL );
const char maskBits[] = NULL,
const wxColour* fg = NULL, const wxColour* bg = NULL);
/* WARNING: the following ctor is missing:
wxCursor(const wxString& name,
wxBitmapType type = wxCURSOR_DEFAULT_TYPE,
int hotSpotX = 0, int hotSpotY = 0);
*/
virtual ~wxCursor();
// implementation
@@ -39,6 +51,8 @@ public:
GdkCursor *GetCursor() const;
protected:
void InitFromStock(wxStockCursor);
virtual wxGDIRefData *CreateGDIRefData() const;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;

View File

@@ -24,12 +24,12 @@ class WXDLLIMPEXP_CORE wxCursor : public wxGDIObject
public:
wxCursor();
wxCursor(wxStockCursor cursorId);
wxCursor(const char bits[], int width, int height,
int hotSpotX=-1, int hotSpotY=-1,
const char maskBits[]=0, wxColour *fg=0, wxColour *bg=0);
wxCursor(wxStockCursor id) { InitFromStock(id); }
#if WXWIN_COMPATIBILITY_2_8
wxCursor(int id) { InitFromStock((wxStockCursor)id); }
#endif
wxCursor(const wxString& name,
long flags = wxBITMAP_TYPE_CUR_RESOURCE,
wxBitmapType type = wxCURSOR_DEFAULT_TYPE,
int hotSpotX = 0, int hotSpotY = 0);
virtual ~wxCursor();
@@ -37,6 +37,8 @@ public:
MGLCursor *GetMGLCursor() const;
private:
void InitFromStock(wxStockCursor);
DECLARE_DYNAMIC_CLASS(wxCursor)
};

View File

@@ -25,16 +25,22 @@ public:
wxCursor(const char bits[], int width, int height,
int hotSpotX = -1, int hotSpotY = -1,
const char maskBits[] = NULL);
const char maskBits[] = NULL,
const wxColour* fg = NULL, const wxColour* bg = NULL);
wxCursor(const wxString& name, long flags = wxBITMAP_TYPE_XBM,
int hotSpotX = 0, int hotSpotY = 0);
wxCursor(const wxString& name,
wxBitmapType type = wxCURSOR_DEFAULT_TYPE,
int hotSpotX = 0, int hotSpotY = 0);
#if wxUSE_IMAGE
wxCursor(const wxImage& image);
#endif
wxCursor(wxStockCursor id);
wxCursor(wxStockCursor id) { InitFromStock(id); }
#if WXWIN_COMPATIBILITY_2_8
wxCursor(int id) { InitFromStock((wxStockCursor)id); }
#endif
virtual ~wxCursor();
// Motif-specific.
@@ -46,6 +52,8 @@ protected:
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
private:
void InitFromStock(wxStockCursor);
void Create(const char bits[], int width, int height,
int hotSpotX = -1, int hotSpotY = -1,
const char maskBits[] = NULL);

View File

@@ -23,13 +23,13 @@ public:
// constructors
wxCursor();
wxCursor(const wxImage& image);
wxCursor(const char bits[], int width, int height,
int hotSpotX = -1, int hotSpotY = -1,
const char maskBits[] = NULL);
wxCursor(const wxString& name,
wxBitmapType flags = wxBITMAP_TYPE_CUR_RESOURCE,
wxBitmapType type = wxCURSOR_DEFAULT_TYPE,
int hotSpotX = 0, int hotSpotY = 0);
wxCursor(wxStockCursor idCursor);
wxCursor(wxStockCursor id) { InitFromStock(id); }
#if WXWIN_COMPATIBILITY_2_8
wxCursor(int id) { InitFromStock((wxStockCursor)id); }
#endif
virtual ~wxCursor();
// implementation only
@@ -37,6 +37,8 @@ public:
WXHCURSOR GetHCURSOR() const { return (WXHCURSOR)GetHandle(); }
protected:
void InitFromStock(wxStockCursor);
virtual wxGDIImageRefData *CreateData() const;
private:

View File

@@ -34,25 +34,22 @@ public:
wxCursor(const wxImage& rImage);
wxCursor( const char acBits[]
,int nWidth
,int nHeight
,int nHotSpotX = -1
,int nHotSpotY = -1
,const char zMaskBits[] = NULL
);
wxCursor( const wxString& rsName
,long lFlags = wxBITMAP_TYPE_CUR_RESOURCE
,wxBitmapType lType = wxCURSOR_DEFAULT_TYPE
,int nHotSpotX = 0
,int nHotSpotY = 0
);
wxCursor(wxStockCursor nCursorType);
wxCursor(wxStockCursor id) { InitFromStock(id); }
#if WXWIN_COMPATIBILITY_2_8
wxCursor(int id) { InitFromStock((wxStockCursor)id); }
#endif
inline ~wxCursor() { }
inline WXHCURSOR GetHCURSOR(void) const { return (M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0); }
inline void SetHCURSOR(WXHCURSOR hCursor) { SetHandle((WXHANDLE)hCursor); }
protected:
void InitFromStock(wxStockCursor);
inline virtual wxGDIImageRefData* CreateData(void) const { return (new wxCursorRefData); }
private:

View File

@@ -20,17 +20,16 @@ class WXDLLIMPEXP_CORE wxCursor : public wxGDIObject
public:
wxCursor();
wxCursor(const char bits[], int width, int height,
int hotSpotX = -1, int hotSpotY = -1,
const char maskBits[] = NULL);
wxCursor(const wxImage & image) ;
wxCursor(const char* const* bits);
wxCursor(const wxString& name,
wxBitmapType flags = wxBITMAP_TYPE_MACCURSOR_RESOURCE,
wxBitmapType type = wxCURSOR_DEFAULT_TYPE,
int hotSpotX = 0, int hotSpotY = 0);
wxCursor(wxStockCursor cursor_type);
wxCursor(wxStockCursor id) { InitFromStock(id); }
#if WXWIN_COMPATIBILITY_2_8
wxCursor(int id) { InitFromStock((wxStockCursor)id); }
#endif
virtual ~wxCursor();
bool CreateFromXpm(const char* const* bits);
@@ -41,6 +40,8 @@ public:
WXHCURSOR GetHCURSOR() const;
private:
void InitFromStock(wxStockCursor);
virtual wxGDIRefData *CreateGDIRefData() const;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;

View File

@@ -23,13 +23,13 @@ public:
// constructors
wxCursor();
wxCursor(const wxImage& image);
wxCursor(const char bits[], int width, int height,
int hotSpotX = -1, int hotSpotY = -1,
const char maskBits[] = NULL);
wxCursor(const wxString& name,
long flags = wxBITMAP_TYPE_CUR_RESOURCE,
wxBitmapType type = wxCURSOR_DEFAULT_TYPE,
int hotSpotX = 0, int hotSpotY = 0);
wxCursor(wxStockCursor idCursor);
wxCursor(wxStockCursor id) { InitFromStock(id); }
#if WXWIN_COMPATIBILITY_2_8
wxCursor(int id) { InitFromStock((wxStockCursor)id); }
#endif
virtual ~wxCursor();
// implementation only
@@ -37,6 +37,7 @@ public:
WXHCURSOR GetHCURSOR() const { return (WXHCURSOR)GetHandle(); }
protected:
void InitFromStock(wxStockCursor);
virtual wxGDIImageRefData *CreateData() const;
private:

View File

@@ -25,14 +25,17 @@ class WXDLLIMPEXP_CORE wxCursor : public wxGDIObject
{
public:
wxCursor();
wxCursor( wxStockCursor cursorId );
wxCursor(wxStockCursor id) { InitFromStock(id); }
#if WXWIN_COMPATIBILITY_2_8
wxCursor(int id) { InitFromStock((wxStockCursor)id); }
#endif
#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 );
wxCursor(const wxString& name,
wxBitmapType type = wxCURSOR_DEFAULT_TYPE,
int hotSpotX = 0, int hotSpotY = 0);
virtual ~wxCursor();
// implementation
@@ -40,6 +43,8 @@ public:
WXCursor GetCursor() const;
protected:
void InitFromStock(wxStockCursor);
virtual wxGDIRefData *CreateGDIRefData() const;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;