X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/76471ff7f52b9b579b699e53e7811d22f12bff89..bc7d2e9dd4e84cf2938eee89a3f2ae5a2267043d:/src/gtk1/cursor.cpp diff --git a/src/gtk1/cursor.cpp b/src/gtk1/cursor.cpp index 1421608aa9..b3e56ef837 100644 --- a/src/gtk1/cursor.cpp +++ b/src/gtk1/cursor.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: cursor.cpp +// Name: src/gtk1/cursor.cpp // Purpose: // Author: Robert Roebling // Id: $Id$ @@ -11,8 +11,11 @@ #include "wx/wxprec.h" #include "wx/cursor.h" -#include "wx/utils.h" -#include "wx/app.h" + +#ifndef WX_PRECOMP + #include "wx/app.h" + #include "wx/utils.h" +#endif // WX_PRECOMP #include #include @@ -28,19 +31,23 @@ extern bool g_isIdle; // wxCursor //----------------------------------------------------------------------------- -class wxCursorRefData: public wxObjectRefData +class wxCursorRefData : public wxGDIRefData { - public: - +public: wxCursorRefData(); - ~wxCursorRefData(); + virtual ~wxCursorRefData(); GdkCursor *m_cursor; + +private: + // There is no way to copy m_cursor so we can't implement a copy ctor + // properly. + wxDECLARE_NO_COPY_CLASS(wxCursorRefData); }; wxCursorRefData::wxCursorRefData() { - m_cursor = (GdkCursor *) NULL; + m_cursor = NULL; } wxCursorRefData::~wxCursorRefData() @@ -59,7 +66,7 @@ wxCursor::wxCursor() } -wxCursor::wxCursor( int cursorId ) +void wxCursor::InitFromStock( wxStockCursor cursorId ) { m_refData = new wxCursorRefData(); @@ -69,7 +76,7 @@ wxCursor::wxCursor( int cursorId ) case wxCURSOR_BLANK: { static const gchar bits[] = { 0 }; - static const GdkColor color = { 0, 0, 0, 0 }; + static /* const -- not in GTK1 */ GdkColor color = { 0, 0, 0, 0 }; GdkPixmap *pixmap = gdk_bitmap_create_from_data(NULL, bits, 1, 1); M_CURSORDATA->m_cursor = gdk_cursor_new_from_pixmap(pixmap, @@ -128,7 +135,7 @@ extern GtkWidget *wxGetRootWindow(); wxCursor::wxCursor(const char bits[], int width, int height, int hotSpotX, int hotSpotY, - const char maskBits[], wxColour *fg, wxColour *bg) + const char maskBits[], const wxColour *fg, const wxColour *bg) { if (!maskBits) maskBits = bits; @@ -153,13 +160,6 @@ wxCursor::wxCursor(const char bits[], int width, int height, gdk_bitmap_unref( mask ); } - -wxCursor::wxCursor( const wxCursor &cursor ) - : wxObject() -{ - Ref( cursor ); -} - #if wxUSE_IMAGE wxCursor::wxCursor( const wxImage & image ) @@ -320,34 +320,22 @@ wxCursor::~wxCursor() { } -wxCursor& wxCursor::operator = ( const wxCursor& cursor ) -{ - if (*this == cursor) - return (*this); - - Ref( cursor ); - - return *this; -} - -bool wxCursor::operator == ( const wxCursor& cursor ) const +GdkCursor *wxCursor::GetCursor() const { - return m_refData == cursor.m_refData; + return M_CURSORDATA->m_cursor; } -bool wxCursor::operator != ( const wxCursor& cursor ) const +wxGDIRefData *wxCursor::CreateGDIRefData() const { - return m_refData != cursor.m_refData; + return new wxCursorRefData; } -bool wxCursor::Ok() const +wxGDIRefData * +wxCursor::CloneGDIRefData(const wxGDIRefData * WXUNUSED(data)) const { - return (m_refData != NULL); -} + wxFAIL_MSG( wxS("Cloning cursors is not implemented in wxGTK.") ); -GdkCursor *wxCursor::GetCursor() const -{ - return M_CURSORDATA->m_cursor; + return new wxCursorRefData; } //----------------------------------------------------------------------------- @@ -381,12 +369,12 @@ void wxEndBusyCursor() wxTheApp->ProcessIdle(); } -void wxBeginBusyCursor( wxCursor *WXUNUSED(cursor) ) +void wxBeginBusyCursor( const wxCursor *WXUNUSED(cursor) ) { if (gs_busyCount++ > 0) return; - wxASSERT_MSG( !gs_savedCursor.Ok(), + wxASSERT_MSG( !gs_savedCursor.IsOk(), wxT("forgot to call wxEndBusyCursor, will leak memory") ); gs_savedCursor = g_globalCursor;