2005-05-04 18:57:50 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/cursor.h
|
|
|
|
// Purpose: wxCursor base header
|
2014-11-11 01:02:45 +00:00
|
|
|
// Author: Julian Smart, Vadim Zeitlin
|
2005-05-04 18:57:50 +00:00
|
|
|
// Created:
|
|
|
|
// Copyright: (c) Julian Smart
|
2014-11-11 01:02:45 +00:00
|
|
|
// (c) 2014 Vadim Zeitlin (wxCursorBase)
|
2005-05-04 18:57:50 +00:00
|
|
|
// Licence: wxWindows Licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-15 00:23:28 +00:00
|
|
|
#ifndef _WX_CURSOR_H_BASE_
|
|
|
|
#define _WX_CURSOR_H_BASE_
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2014-11-11 01:02:45 +00:00
|
|
|
#include "wx/gdiobj.h"
|
2014-11-11 07:50:33 +00:00
|
|
|
#include "wx/gdicmn.h"
|
2014-11-11 01:02:45 +00:00
|
|
|
|
|
|
|
// Under most ports, wxCursor derives directly from wxGDIObject, but in wxMSW
|
|
|
|
// there is an intermediate wxGDIImage class.
|
|
|
|
#ifdef __WXMSW__
|
|
|
|
#include "wx/msw/gdiimage.h"
|
|
|
|
#else
|
|
|
|
typedef wxGDIObject wxGDIImage;
|
|
|
|
#endif
|
2009-05-16 10:42:48 +00:00
|
|
|
|
2014-11-11 01:02:45 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxCursorBase : public wxGDIImage
|
2009-05-16 10:42:48 +00:00
|
|
|
{
|
|
|
|
public:
|
2014-11-11 01:02:45 +00:00
|
|
|
/*
|
|
|
|
wxCursor classes should provide the following ctors:
|
|
|
|
|
2009-05-16 10:42:48 +00:00
|
|
|
wxCursor();
|
|
|
|
wxCursor(const wxImage& image);
|
|
|
|
wxCursor(const wxString& name,
|
|
|
|
wxBitmapType type = wxCURSOR_DEFAULT_TYPE,
|
|
|
|
int hotSpotX = 0, int hotSpotY = 0);
|
|
|
|
wxCursor(wxStockCursor id) { InitFromStock(id); }
|
|
|
|
#if WXWIN_COMPATIBILITY_2_8
|
|
|
|
wxCursor(int id) { InitFromStock((wxStockCursor)id); }
|
|
|
|
#endif
|
|
|
|
*/
|
2014-11-11 01:02:50 +00:00
|
|
|
|
|
|
|
virtual wxPoint GetHotSpot() const { return wxDefaultPosition; }
|
2014-11-11 01:02:45 +00:00
|
|
|
};
|
2009-05-16 10:42:48 +00:00
|
|
|
|
2012-01-15 01:05:28 +00:00
|
|
|
#if defined(__WXMSW__)
|
2008-09-25 17:56:07 +00:00
|
|
|
#define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE
|
2005-05-22 14:03:47 +00:00
|
|
|
#include "wx/msw/cursor.h"
|
1998-07-10 14:15:17 +00:00
|
|
|
#elif defined(__WXMOTIF__)
|
2008-09-25 17:56:07 +00:00
|
|
|
#define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_XBM
|
2005-05-22 14:03:47 +00:00
|
|
|
#include "wx/motif/cursor.h"
|
2006-01-23 03:27:34 +00:00
|
|
|
#elif defined(__WXGTK20__)
|
2012-06-30 16:33:23 +00:00
|
|
|
#ifdef __WINDOWS__
|
|
|
|
#define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE
|
|
|
|
#else
|
|
|
|
#define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_XPM
|
|
|
|
#endif
|
2005-05-22 14:03:47 +00:00
|
|
|
#include "wx/gtk/cursor.h"
|
2006-01-23 03:27:34 +00:00
|
|
|
#elif defined(__WXGTK__)
|
2008-09-25 17:56:07 +00:00
|
|
|
#define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_XPM
|
2006-01-23 03:27:34 +00:00
|
|
|
#include "wx/gtk1/cursor.h"
|
2002-02-05 16:34:33 +00:00
|
|
|
#elif defined(__WXX11__)
|
2008-09-25 17:56:07 +00:00
|
|
|
#define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_XPM
|
2005-05-22 14:03:47 +00:00
|
|
|
#include "wx/x11/cursor.h"
|
2006-08-27 09:42:42 +00:00
|
|
|
#elif defined(__WXDFB__)
|
2008-09-25 17:56:07 +00:00
|
|
|
#define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE
|
2006-08-27 09:42:42 +00:00
|
|
|
#include "wx/dfb/cursor.h"
|
1998-08-15 00:23:28 +00:00
|
|
|
#elif defined(__WXMAC__)
|
2008-09-25 17:56:07 +00:00
|
|
|
#define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_MACCURSOR_RESOURCE
|
2008-06-11 19:17:41 +00:00
|
|
|
#include "wx/osx/cursor.h"
|
2014-08-24 01:50:11 +00:00
|
|
|
#elif defined(__WXQT__)
|
|
|
|
#define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR
|
|
|
|
#include "wx/qt/cursor.h"
|
1998-05-20 14:01:55 +00:00
|
|
|
#endif
|
|
|
|
|
1999-08-12 15:36:50 +00:00
|
|
|
#include "wx/utils.h"
|
2000-09-12 15:15:44 +00:00
|
|
|
|
1999-08-12 15:36:50 +00:00
|
|
|
/* This is a small class which can be used by all ports
|
|
|
|
to temporarily suspend the busy cursor. Useful in modal
|
|
|
|
dialogs.
|
2000-07-15 19:51:35 +00:00
|
|
|
|
|
|
|
Actually that is not (any longer) quite true.. currently it is
|
|
|
|
only used in wxGTK Dialog::ShowModal() and now uses static
|
|
|
|
wxBusyCursor methods that are only implemented for wxGTK so far.
|
|
|
|
The BusyCursor handling code should probably be implemented in
|
|
|
|
common code somewhere instead of the separate implementations we
|
|
|
|
currently have. Also the name BusyCursorSuspender is a little
|
|
|
|
misleading since it doesn't actually suspend the BusyCursor, just
|
|
|
|
masks one that is already showing.
|
|
|
|
If another call to wxBeginBusyCursor is made while this is active
|
|
|
|
the Busy Cursor will again be shown. But at least now it doesn't
|
|
|
|
interfere with the state of wxIsBusy() -- RL
|
|
|
|
|
1999-08-12 15:36:50 +00:00
|
|
|
*/
|
|
|
|
class wxBusyCursorSuspender
|
|
|
|
{
|
|
|
|
public:
|
2000-07-15 19:51:35 +00:00
|
|
|
wxBusyCursorSuspender()
|
|
|
|
{
|
|
|
|
if( wxIsBusy() )
|
|
|
|
{
|
|
|
|
wxSetCursor( wxBusyCursor::GetStoredCursor() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
~wxBusyCursorSuspender()
|
|
|
|
{
|
|
|
|
if( wxIsBusy() )
|
|
|
|
{
|
|
|
|
wxSetCursor( wxBusyCursor::GetBusyCursor() );
|
|
|
|
}
|
|
|
|
}
|
1999-08-12 15:36:50 +00:00
|
|
|
};
|
1998-05-20 14:01:55 +00:00
|
|
|
#endif
|
1998-08-15 00:23:28 +00:00
|
|
|
// _WX_CURSOR_H_BASE_
|