#include "wx/colour.h"
#endif // WX_PRECOMP
-#include "wx/gtk/private.h" //for idle stuff
+#include <gtk/gtk.h>
//-----------------------------------------------------------------------------
// wxCursor
//-----------------------------------------------------------------------------
-class wxCursorRefData: public wxObjectRefData
+class wxCursorRefData: public wxGDIRefData
{
- public:
-
+public:
wxCursorRefData();
virtual ~wxCursorRefData();
+ virtual bool IsOk() const { return m_cursor != NULL; }
+
GdkCursor *m_cursor;
};
case wxCURSOR_ARROWWAIT:
case wxCURSOR_WAIT:
case wxCURSOR_WATCH: gdk_cur = GDK_WATCH; break;
- case wxCURSOR_SIZING: gdk_cur = GDK_FLEUR; break;
+ case wxCURSOR_SIZING: gdk_cur = GDK_SIZING; break;
case wxCURSOR_SPRAYCAN: gdk_cur = GDK_SPRAYCAN; break;
case wxCURSOR_IBEAM: gdk_cur = GDK_XTERM; break;
case wxCURSOR_PENCIL: gdk_cur = GDK_PENCIL; break;
bool bHasMask = image.HasMask();
int imagebitcount = (w*h)/8;
-#if GTK_CHECK_VERSION(2,2,0)
if ( gdk_display_supports_cursor_color(gdk_display_get_default()) )
{
unsigned char rMask = 0,
m_refData = new wxCursorRefData;
M_CURSORDATA->m_cursor = gdk_cursor_new_from_pixbuf
- (
- gdk_display_get_default(),
- pixbuf,
- hotSpotX, hotSpotY
- );
+ (
+ gdk_display_get_default(),
+ pixbuf,
+ hotSpotX, hotSpotY
+ );
g_object_unref (pixbuf);
return;
}
-#endif // GTK+ 2.2+
unsigned char * bits = new unsigned char [imagebitcount];
unsigned char * maskBits = new unsigned char [imagebitcount];
{
}
-bool wxCursor::IsOk() const
+GdkCursor *wxCursor::GetCursor() const
+{
+ return M_CURSORDATA->m_cursor;
+}
+
+wxGDIRefData *wxCursor::CreateGDIRefData() const
{
- return (m_refData != NULL);
+ return new wxCursorRefData;
}
-GdkCursor *wxCursor::GetCursor() const
+wxGDIRefData *wxCursor::CloneGDIRefData(const wxGDIRefData *data) const
{
- return M_CURSORDATA->m_cursor;
+ return new wxCursorRefData(*wx_static_cast(const wxCursorRefData *, data));
}
//-----------------------------------------------------------------------------
// busy cursor routines
//-----------------------------------------------------------------------------
-extern wxCursor g_globalCursor;
+/* Current cursor, in order to hang on to
+ * cursor handle when setting the cursor globally */
+wxCursor g_globalCursor;
static wxCursor gs_savedCursor;
static int gs_busyCount = 0;
void wxSetCursor( const wxCursor& cursor )
{
- if (g_isIdle)
- wxapp_install_idle_handler();
-
g_globalCursor = cursor;
+ wxTheApp->WakeUpIdle();
}