X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c41c20a566cb7558661a68c0ed6712a84982093f..83c5d35ff3f22735f483edd56956b7a3baa6a798:/src/mgl/cursor.cpp diff --git a/src/mgl/cursor.cpp b/src/mgl/cursor.cpp index 0abbaccedb..709b59e34f 100644 --- a/src/mgl/cursor.cpp +++ b/src/mgl/cursor.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: cursor.cpp +// Name: src/mgl/cursor.cpp // Purpose: // Author: Vaclav Slavik // Id: $Id$ @@ -7,11 +7,6 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "cursor.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -20,11 +15,14 @@ #endif #include "wx/cursor.h" -#include "wx/module.h" -#include "wx/utils.h" -#include "wx/log.h" -#include "wx/intl.h" -#include "wx/hashmap.h" + +#ifndef WX_PRECOMP + #include "wx/intl.h" + #include "wx/log.h" + #include "wx/utils.h" + #include "wx/hashmap.h" + #include "wx/module.h" +#endif #include "wx/mgl/private.h" @@ -38,7 +36,7 @@ class wxCursorRefData: public wxObjectRefData public: wxCursorRefData(); - ~wxCursorRefData(); + virtual ~wxCursorRefData(); MGLCursor *m_cursor; }; @@ -57,7 +55,7 @@ wxCursorRefData::~wxCursorRefData() //----------------------------------------------------------------------------- -WX_DECLARE_HASH_MAP(int, wxCursor, wxIntegerHash, wxIntegerEqual, wxCursorsHash) +WX_DECLARE_HASH_MAP(int, wxCursor, wxIntegerHash, wxIntegerEqual, wxCursorsHash); static wxCursorsHash *gs_cursorsHash = NULL; @@ -85,6 +83,7 @@ wxCursor::wxCursor(int cursorId) switch (cursorId) { case wxCURSOR_ARROW: cursorname = "arrow.cur"; break; + case wxCURSOR_RIGHT_ARROW: cursorname = "rightarr.cur"; break; case wxCURSOR_BULLSEYE: cursorname = "bullseye.cur"; break; case wxCURSOR_CHAR: cursorname = "char.cur"; break; case wxCURSOR_CROSS: cursorname = "cross.cur"; break; @@ -113,13 +112,12 @@ wxCursor::wxCursor(int cursorId) case wxCURSOR_NONE: *this = wxNullCursor; return; - break; default: wxFAIL_MSG(wxT("unsupported cursor type")); break; } - + M_CURSORDATA->m_cursor = new MGLCursor(cursorname); // if we cannot load arrow cursor, use MGL's default arrow cursor: @@ -128,7 +126,7 @@ wxCursor::wxCursor(int cursorId) delete M_CURSORDATA->m_cursor; M_CURSORDATA->m_cursor = new MGLCursor(MGL_DEF_CURSOR); } - + if ( !M_CURSORDATA->m_cursor->valid() ) { wxLogError(_("Couldn't create cursor.")); @@ -137,7 +135,7 @@ wxCursor::wxCursor(int cursorId) else { (*gs_cursorsHash)[cursorId] = *this; - wxLogTrace(_T("mglcursor"), _T("cursor id %i added to cache (%s)"), + wxLogTrace(_T("mglcursor"), _T("cursor id %i added to cache (%s)"), cursorId, cursorname); } } @@ -154,7 +152,7 @@ wxCursor::wxCursor(const char WXUNUSED(bits)[], wxCursor::wxCursor(const wxString& cursor_file, long flags, - int hotSpotX, int hotSpotY) + int WXUNUSED(hotSpotX), int WXUNUSED(hotSpotY)) { if ( flags == wxBITMAP_TYPE_CUR || flags == wxBITMAP_TYPE_CUR_RESOURCE ) { @@ -172,24 +170,11 @@ wxCursor::wxCursor(const wxString& cursor_file, } } -wxCursor::wxCursor(const wxCursor &cursor) -{ - Ref(cursor); -} - wxCursor::~wxCursor() { // wxObject unrefs data } -wxCursor& wxCursor::operator = (const wxCursor& cursor) -{ - if ( *this == cursor ) - return (*this); - Ref(cursor); - return *this; -} - bool wxCursor::operator == (const wxCursor& cursor) const { return (m_refData == cursor.m_refData); @@ -200,7 +185,7 @@ bool wxCursor::operator != (const wxCursor& cursor) const return (m_refData != cursor.m_refData); } -bool wxCursor::Ok() const +bool wxCursor::IsOk() const { return (m_refData != NULL); } @@ -230,7 +215,7 @@ void wxSetCursor(const wxCursor& cursor) { if ( g_winMng ) MGL_wmSetGlobalCursor(g_winMng, NULL); - gs_globalCursor = wxNullCursor; + gs_globalCursor = wxNullCursor; } } @@ -261,7 +246,7 @@ void wxEndBusyCursor() gs_savedCursor = wxNullCursor; } -void wxBeginBusyCursor(wxCursor *cursor) +void wxBeginBusyCursor(const wxCursor *cursor) { if ( gs_busyCount++ > 0 ) return; @@ -289,8 +274,8 @@ bool wxIsBusy() class wxCursorModule : public wxModule { public: - virtual bool OnInit() { return TRUE; } - + virtual bool OnInit() { return true; } + virtual void OnExit() { wxDELETE(gs_cursorsHash);