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;

View File

@ -13,7 +13,7 @@
pointer is, with a picture that might indicate the interpretation of a
mouse click. As with icons, cursors in X and MS Windows are created in a
different manner. Therefore, separate cursors will be created for the
different environments. Platform-specific methods for creating a wxCursor
different environments. Platform-specific methods for creating a wxCursor
object are catered for, and this is an occasion where conditional
compilation will probably be required (see wxIcon for an example).
@ -26,8 +26,8 @@
The following is an example of creating a cursor from 32x32 bitmap data
(down_bits) and a mask (down_mask) where 1 is black and 0 is white for the
bits, and 1 is opaque and 0 is transparent for the mask. It works on
Windows and GTK+.
bits, and 1 is opaque and 0 is transparent for the mask.
It works on Windows and GTK+.
@code
static char down_bits[] = { 255, 255, 255, 255, 31,
@ -63,7 +63,7 @@
down_image.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_X, 6);
down_image.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_Y, 14);
wxCursor down_cursor = wxCursor(down_image);
#else
#elif defined(__WXGTK__) or defined(__WXMOTIF__)
wxCursor down_cursor = wxCursor(down_bits, 32, 32, 6, 14,
down_mask, wxWHITE, wxBLACK);
#endif
@ -78,8 +78,7 @@
- ::wxHOURGLASS_CURSOR
- ::wxCROSS_CURSOR
@see wxBitmap, wxIcon, wxWindow::SetCursor(), wxSetCursor(),
::wxStockCursor
@see wxBitmap, wxIcon, wxWindow::SetCursor(), wxSetCursor(), ::wxStockCursor
*/
class wxCursor : public wxBitmap
{
@ -88,19 +87,18 @@ public:
Default constructor.
*/
wxCursor();
/**
Constructs a cursor by passing an array of bits (Motif and GTK+ only).
@a maskBits is used only under Motif and GTK+. The parameters @a fg and
@a bg are only present on GTK+, and force the cursor to use particular
background and foreground colours.
Constructs a cursor by passing an array of bits (XBM data).
The parameters @a fg and @a bg have an effect only on GTK+, and force
the cursor to use particular background and foreground colours.
If either @a hotSpotX or @a hotSpotY is -1, the hotspot will be the
centre of the cursor image (Motif only).
@param bits
An array of bits.
@param maskBits
Bits for a mask bitmap.
An array of XBM data bits.
@param width
Cursor width.
@param height
@ -109,14 +107,19 @@ public:
Hotspot x coordinate.
@param hotSpotY
Hotspot y coordinate.
@param maskBits
Bits for a mask bitmap.
@onlyfor{wxgtk,wxmotif}
*/
wxCursor(const char bits[], int width, int height,
int hotSpotX = -1, int hotSpotY = -1,
const char maskBits[] = NULL,
wxColour* fg = NULL, wxColour* bg = NULL);
const char maskBits[] = NULL);
/**
Constructs a cursor by passing a string resource name or filename.
@note
On MacOS when specifying a string resource name, first the color
cursors 'crsr' and then the black/white cursors 'CURS' in the resource
chain are scanned through.
@ -125,20 +128,24 @@ public:
loading from an icon file, to specify the cursor hotspot relative to
the top left of the image.
@param cursorName
The name of the resource or the image file to load.
@param type
Icon type to load. Under Motif, type defaults to wxBITMAP_TYPE_XBM.
Under Windows, it defaults to wxBITMAP_TYPE_CUR_RESOURCE. Under
MacOS, it defaults to wxBITMAP_TYPE_MACCURSOR_RESOURCE.
Under X, the permitted cursor types are:
<ul>
<li>wxBITMAP_TYPE_XBM - Load an X bitmap file.</li>
</ul>
Icon type to load. It defaults to wxCURSOR_DEFAULT_TYPE,
which is a #define associated to different values on different
platforms:
- under Windows, it defaults to wxBITMAP_TYPE_CUR_RESOURCE.
- under MacOS, it defaults to wxBITMAP_TYPE_MACCURSOR_RESOURCE.
- under GTK, it defaults to wxBITMAP_TYPE_XPM.
- under X11, it defaults to wxBITMAP_TYPE_XPM.
- under Motif, type defaults to wxBITMAP_TYPE_XBM.
Under Windows, the permitted types are:
- wxBITMAP_TYPE_CUR - Load a cursor from a .cur cursor file (only
if USE_RESOURCE_LOADING_IN_MSW is enabled in
setup.h).
- wxBITMAP_TYPE_CUR_RESOURCE - Load a Windows resource (as
specified in the .rc file).
- wxBITMAP_TYPE_CUR_RESOURCE - Load a Windows resource
(as specified in the .rc file).
- wxBITMAP_TYPE_ICO - Load a cursor from a .ico icon file (only if
USE_RESOURCE_LOADING_IN_MSW is enabled in
setup.h). Specify @a hotSpotX and @a hotSpotY.
@ -147,8 +154,10 @@ public:
@param hotSpotY
Hotspot y coordinate.
*/
wxCursor(const wxString& cursorName, long type,
wxCursor(const wxString& cursorName,
wxBitmapType type = wxCURSOR_DEFAULT_TYPE,
int hotSpotX = 0, int hotSpotY = 0);
/**
Constructs a cursor using a cursor identifier.
@ -156,24 +165,26 @@ public:
A stock cursor identifier. See ::wxStockCursor.
*/
wxCursor(wxStockCursor cursorId);
/**
Constructs a cursor from a wxImage. If cursor are monochrome on the
current platform, colors with the RGB elements all greater than 127
will be foreground, colors less than this background. The mask (if any)
will be used to specify the transparent area.
In wxMSW the foreground will be white and the background black. If the
cursor is larger than 32x32 it is resized.
In wxMSW the foreground will be white and the background black.
If the cursor is larger than 32x32 it is resized.
In wxGTK, colour cursors and alpha channel are supported (starting from
GTK+ 2.2). Otherwise the two most frequent colors will be used for
foreground and background. In any case, the cursor will be displayed at
the size of the image.
foreground and background. In any case, the cursor will be displayed
at the size of the image.
In wxMac, if the cursor is larger than 16x16 it is resized and
currently only shown as black/white (mask respected).
*/
wxCursor(const wxImage& image);
/**
Copy constructor, uses @ref overview_refcount "reference counting".
@ -201,7 +212,7 @@ public:
/**
Assignment operator, using @ref overview_refcount "reference counting".
*/
wxCursor operator =(const wxCursor& cursor);
wxCursor& operator =(const wxCursor& cursor);
};

View File

@ -43,23 +43,13 @@ public:
IMPLEMENT_DYNAMIC_CLASS(wxCursor, wxObject)
wxCursor::wxCursor(wxStockCursor cursorId)
void wxCursor::InitFromStock(wxStockCursor cursorId)
{
#warning "FIXME -- implement the cursor as bitmaps (that's what DFB uses)"
}
wxCursor::wxCursor(const char WXUNUSED(bits)[],
int WXUNUSED(width),
int WXUNUSED(height),
int WXUNUSED(hotSpotX), int WXUNUSED(hotSpotY),
const char WXUNUSED(maskBits)[],
wxColour * WXUNUSED(fg), wxColour * WXUNUSED(bg) )
{
#warning "FIXME"
}
wxCursor::wxCursor(const wxString& cursor_file,
long flags,
wxBitmapType type,
int WXUNUSED(hotSpotX), int WXUNUSED(hotSpotY))
{
#warning "FIXME"

View File

@ -56,7 +56,7 @@ wxCursor::wxCursor()
{
}
wxCursor::wxCursor( wxStockCursor cursorId )
void wxCursor::InitFromStock( wxStockCursor cursorId )
{
m_refData = new wxCursorRefData();
@ -122,9 +122,49 @@ wxCursor::wxCursor( wxStockCursor cursorId )
M_CURSORDATA->m_cursor = gdk_cursor_new( gdk_cur );
}
// used in the following two ctors
extern GtkWidget *wxGetRootWindow();
wxCursor::wxCursor(const char bits[], int width, int height,
wxCursor::wxCursor(const wxString& cursor_file,
wxBitmapType type,
int hotSpotX, int hotSpotY)
{
/* TODO: test this code! */
// Must be an XBM file
if (type != wxBITMAP_TYPE_XPM) {
wxLogError("Invalid cursor bitmap type '%d'", type);
return;
}
// load the XPM
GdkBitmap *mask = NULL;
GdkBitmap *data = gdk_pixmap_create_from_xpm( wxGetRootWindow()->window,
&mask, NULL, cursor_file.mb_str() );
if (!data)
return;
// check given hotspot
gint w, h;
gdk_drawable_get_size( data, &w, &h );
if (hotSpotX < 0 || hotSpotX >= w)
hotSpotX = 0;
if (hotSpotY < 0 || hotSpotY >= h)
hotSpotY = 0;
// create the real cursor
m_refData = new wxCursorRefData;
M_CURSORDATA->m_cursor =
gdk_cursor_new_from_pixmap( data, mask,
wxBLACK->GetColor(), wxWHITE->GetColor(),
hotSpotX, hotSpotY );
g_object_unref (data);
g_object_unref (mask);
}
wxCursor::wxCursor(const char bits[], int width, int height,
int hotSpotX, int hotSpotY,
const char maskBits[], const wxColour *fg, const wxColour *bg)
{

View File

@ -61,7 +61,7 @@ wxCursor::wxCursor()
}
wxCursor::wxCursor( wxStockCursor cursorId )
void wxCursor::InitFromStock( wxStockCursor cursorId )
{
m_refData = new wxCursorRefData();

View File

@ -65,7 +65,7 @@ wxCursor::wxCursor()
{
}
wxCursor::wxCursor(wxStockCursor cursorId)
void wxCursor::InitFromStock(wxStockCursor cursorId)
{
if ( !gs_cursorsHash )
gs_cursorsHash = new wxCursorsHash;
@ -140,21 +140,11 @@ wxCursor::wxCursor(wxStockCursor cursorId)
}
}
wxCursor::wxCursor(const char WXUNUSED(bits)[],
int WXUNUSED(width),
int WXUNUSED(height),
int WXUNUSED(hotSpotX), int WXUNUSED(hotSpotY),
const char WXUNUSED(maskBits)[],
wxColour * WXUNUSED(fg), wxColour * WXUNUSED(bg) )
{
//FIXME_MGL
}
wxCursor::wxCursor(const wxString& cursor_file,
long flags,
wxBitmapType type,
int WXUNUSED(hotSpotX), int WXUNUSED(hotSpotY))
{
if ( flags == wxBITMAP_TYPE_CUR || flags == wxBITMAP_TYPE_CUR_RESOURCE )
if ( type == wxBITMAP_TYPE_CUR || type == wxBITMAP_TYPE_CUR_RESOURCE )
{
m_refData = new wxCursorRefData();
M_CURSORDATA->m_cursor = new MGLCursor(cursor_file.mb_str());

View File

@ -244,11 +244,14 @@ wxCursor::wxCursor(const char bits[], int width, int height,
Create(bits, width, height, hotSpotX, hotSpotY, maskBits);
}
wxCursor::wxCursor(const wxString& name, long flags, int hotSpotX, int hotSpotY)
wxCursor::wxCursor(const wxString& name, wxBitmapType type, int hotSpotX, int hotSpotY,
const wxColour* WXUNUSED(fg), const wxColour* WXUNUSED(bg))
{
// Must be an XBM file
if (flags != wxBITMAP_TYPE_XBM)
if (type != wxBITMAP_TYPE_XBM) {
wxLogError("Invalid cursor bitmap type '%d'", type);
return;
}
m_refData = new wxCursorRefData;
@ -284,7 +287,7 @@ wxCursor::wxCursor(const wxString& name, long flags, int hotSpotX, int hotSpotY)
}
// Cursors by stock number
wxCursor::wxCursor(wxStockCursor id)
void wxCursor::InitFromStock(wxStockCursor id)
{
m_refData = new wxCursorRefData;
M_CURSORDATA->m_cursorId = id;

View File

@ -219,25 +219,10 @@ wxCursor::wxCursor(const wxImage& image)
}
#endif // wxUSE_IMAGE
wxCursor::wxCursor(const char WXUNUSED(bits)[],
int WXUNUSED(width),
int WXUNUSED(height),
int WXUNUSED(hotSpotX), int WXUNUSED(hotSpotY),
const char WXUNUSED(maskBits)[])
{
}
// MicroWin doesn't have support needed for the other ctors
#ifdef __WXMICROWIN__
wxCursor::wxCursor(const wxString& WXUNUSED(filename),
wxBitmapType WXUNUSED(kind),
int WXUNUSED(hotSpotX),
int WXUNUSED(hotSpotY))
{
}
wxCursor::wxCursor(int WXUNUSED(cursor_type))
wxCursor::InitFromStock(wxStockCursor WXUNUSED(cursor_type))
{
}
@ -280,7 +265,7 @@ wxCursor::wxCursor(const wxString& filename,
break;
default:
wxFAIL_MSG( _T("unknown cursor resource type") );
wxLogError( _T("unknown cursor resource type '%d'"), kind );
hcursor = NULL;
}
@ -292,7 +277,7 @@ wxCursor::wxCursor(const wxString& filename,
}
// Cursors by stock number
wxCursor::wxCursor(wxStockCursor idCursor)
void wxCursor::InitFromStock(wxStockCursor idCursor)
{
// all wxWidgets standard cursors
static const struct StdCursor

View File

@ -53,15 +53,6 @@ wxCursor::wxCursor(void)
{
}
wxCursor::wxCursor(const char WXUNUSED(bits)[],
int WXUNUSED(width),
int WXUNUSED(height),
int WXUNUSED(hotSpotX),
int WXUNUSED(hotSpotY),
const char WXUNUSED(maskBits)[])
{
}
wxCursor::wxCursor(const wxImage& rImage)
{
wxImage vImage32 = rImage.Scale(32,32);
@ -94,7 +85,7 @@ wxCursor::wxCursor(const wxImage& rImage)
} // end of wxCursor::wxCursor
wxCursor::wxCursor( const wxString& WXUNUSED(rsCursorFile),
long lFlags,
wxBitmapType type,
int WXUNUSED(nHotSpotX),
int WXUNUSED(nHotSpotY) )
{
@ -103,17 +94,19 @@ wxCursor::wxCursor( const wxString& WXUNUSED(rsCursorFile),
pRefData = new wxCursorRefData;
m_refData = pRefData;
pRefData->m_bDestroyCursor = false;
if (lFlags == wxBITMAP_TYPE_CUR_RESOURCE)
if (type == wxBITMAP_TYPE_CUR_RESOURCE)
{
pRefData->m_hCursor = (WXHCURSOR) ::WinLoadPointer( HWND_DESKTOP
,0
,(ULONG)lFlags // if OS/2 this should be the resource Id
,(ULONG)type // if OS/2 this should be the resource Id
);
}
else
wxLogError("Invalid cursor bitmap type '%d'", type);
} // end of wxCursor::wxCursor
// Cursors by stock number
wxCursor::wxCursor(wxStockCursor nCursorType)
void wxCursor::InitFromStock(wxStockCursor nCursorType)
{
wxCursorRefData* pRefData = new wxCursorRefData;

View File

@ -274,11 +274,6 @@ wxCursor::wxCursor()
{
}
wxCursor::wxCursor(const char WXUNUSED(bits)[], int WXUNUSED(width), int WXUNUSED(height),
int WXUNUSED(hotSpotX), int WXUNUSED(hotSpotY), const char WXUNUSED(maskBits)[])
{
}
wxCursor::wxCursor( const wxImage &image )
{
#if wxUSE_IMAGE
@ -556,7 +551,7 @@ wxCursor::wxCursor(const wxString& cursor_file, wxBitmapType flags, int hotSpotX
}
// Cursors by stock number
wxCursor::wxCursor(wxStockCursor cursor_type)
wxCursor::InitFromStock(wxStockCursor cursor_type)
{
m_refData = new wxCursorRefData;
#if wxOSX_USE_COCOA

View File

@ -80,23 +80,15 @@ wxCursor::wxCursor(const wxImage& image)
}
#endif
wxCursor::wxCursor(const char WXUNUSED(bits)[],
int WXUNUSED(width),
int WXUNUSED(height),
int WXUNUSED(hotSpotX), int WXUNUSED(hotSpotY),
const char WXUNUSED(maskBits)[])
{
}
wxCursor::wxCursor(const wxString& filename,
long kind,
wxBitmapType kind,
int hotSpotX,
int hotSpotY)
{
}
// Cursors by stock number
wxCursor::wxCursor(wxStockCursor idCursor)
void wxCursor::InitFromStock(wxStockCursor idCursor)
{
}

View File

@ -66,7 +66,7 @@ wxCursor::wxCursor()
}
wxCursor::wxCursor( wxStockCursor cursorId )
void wxCursor::InitFromStock( wxStockCursor cursorId )
{
m_refData = new wxCursorRefData();
@ -124,13 +124,11 @@ wxCursor::wxCursor( wxStockCursor cursorId )
#endif
}
wxCursor::wxCursor(const char WXUNUSED(bits)[],
int WXUNUSED(width), int WXUNUSED(height),
int WXUNUSED(hotSpotX), int WXUNUSED(hotSpotY),
const char WXUNUSED(maskBits)[],
wxColour *WXUNUSED(fg), wxColour *WXUNUSED(bg))
wxCursor::wxCursor(const wxString& name,
wxBitmapType type,
int hotSpotX, int hotSpotY)
{
wxFAIL_MSG( wxT("wxCursor creation from bits not yet implemented") );
wxFAIL_MSG( wxT("wxCursor creation from file not yet implemented") );
}
#if wxUSE_IMAGE