X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/957d856c812a885467ccfe235fee51001790ffdb..cb332bc6b76dd095e85322a213363fa4409f5881:/src/gtk1/cursor.cpp diff --git a/src/gtk1/cursor.cpp b/src/gtk1/cursor.cpp index e660bcc9ea..25b07ea391 100644 --- a/src/gtk1/cursor.cpp +++ b/src/gtk1/cursor.cpp @@ -14,8 +14,10 @@ #include "wx/cursor.h" #include "wx/utils.h" +#include "wx/app.h" -#include "gdk/gdk.h" +#include +#include //----------------------------------------------------------------------------- // idle system @@ -107,6 +109,36 @@ wxCursor::wxCursor( int cursorId ) M_CURSORDATA->m_cursor = gdk_cursor_new( gdk_cur ); } +extern GtkWidget *wxRootWindow; + +wxCursor::wxCursor(const char bits[], int width, int height, + int hotSpotX, int hotSpotY, + const char maskBits[], wxColour *fg, wxColour *bg) +{ + if (!maskBits) + maskBits = bits; + if (!fg) + fg = wxBLACK; + if (!bg) + bg = wxWHITE; + if (hotSpotX < 0 || hotSpotX >= width) + hotSpotX = 0; + if (hotSpotY < 0 || hotSpotY >= height) + hotSpotY = 0; + + GdkBitmap *data = gdk_bitmap_create_from_data( wxRootWindow->window, (gchar *) bits, width, height ); + GdkBitmap *mask = gdk_bitmap_create_from_data( wxRootWindow->window, (gchar *) maskBits, width, height); + + m_refData = new wxCursorRefData; + M_CURSORDATA->m_cursor = gdk_cursor_new_from_pixmap( + data, mask, fg->GetColor(), bg->GetColor(), + hotSpotX, hotSpotY ); + + gdk_bitmap_unref( data ); + gdk_bitmap_unref( mask ); +} + + wxCursor::wxCursor( const wxCursor &cursor ) { Ref( cursor ); @@ -155,6 +187,16 @@ extern wxCursor g_globalCursor; static wxCursor gs_savedCursor; static int gs_busyCount = 0; +const wxCursor &wxBusyCursor::GetStoredCursor() +{ + return gs_savedCursor; +} + +const wxCursor wxBusyCursor::GetBusyCursor() +{ + return wxCursor(wxCURSOR_WATCH); +} + void wxEndBusyCursor() { if (--gs_busyCount > 0) @@ -163,7 +205,8 @@ void wxEndBusyCursor() wxSetCursor( gs_savedCursor ); gs_savedCursor = wxNullCursor; - wxYield(); + if (wxTheApp) + wxTheApp->SendIdleEvents(); } void wxBeginBusyCursor( wxCursor *WXUNUSED(cursor) ) @@ -178,7 +221,8 @@ void wxBeginBusyCursor( wxCursor *WXUNUSED(cursor) ) wxSetCursor( wxCursor(wxCURSOR_WATCH) ); - wxYield(); + if (wxTheApp) + wxTheApp->SendIdleEvents(); } bool wxIsBusy()