X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a11672a469f036436838911c268cb2f8d5da5bf8..04fa04d8067d235ab45b5bc05b65f0679634b541:/src/x11/cursor.cpp diff --git a/src/x11/cursor.cpp b/src/x11/cursor.cpp index 55847bb23e..c314e4f387 100644 --- a/src/x11/cursor.cpp +++ b/src/x11/cursor.cpp @@ -1,40 +1,51 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: cursor.cpp +// Name: src/x11/cursor.cpp // Purpose: wxCursor class // Author: Julian Smart // Modified by: // Created: 17/09/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ -#pragma implementation "cursor.h" -#endif +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" #include "wx/cursor.h" -#include "wx/gdicmn.h" -#include "wx/icon.h" -#include "wx/app.h" -#include "wx/utils.h" + +#ifndef WX_PRECOMP + #include "wx/app.h" + #include "wx/utils.h" + #include "wx/icon.h" + #include "wx/gdicmn.h" + #include "wx/image.h" +#endif #include "wx/x11/private.h" + +#if !wxUSE_NANOX #include +#endif //----------------------------------------------------------------------------- // wxCursor //----------------------------------------------------------------------------- -class wxCursorRefData: public wxObjectRefData +class wxCursorRefData: public wxGDIRefData { public: wxCursorRefData(); - ~wxCursorRefData(); + virtual ~wxCursorRefData(); WXCursor m_cursor; WXDisplay *m_display; + +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() @@ -60,13 +71,20 @@ wxCursor::wxCursor() } -wxCursor::wxCursor( int cursorId ) +void wxCursor::InitFromStock( wxStockCursor cursorId ) { m_refData = new wxCursorRefData(); +#if wxUSE_NANOX + // TODO Create some standard cursors from bitmaps. + + +#else + // !wxUSE_NANOX + M_CURSORDATA->m_display = wxGlobalDisplay(); wxASSERT_MSG( M_CURSORDATA->m_display, wxT("No display") ); - + int x_cur = XC_left_ptr; switch (cursorId) { @@ -108,25 +126,20 @@ wxCursor::wxCursor( int cursorId ) } M_CURSORDATA->m_cursor = (WXCursor) XCreateFontCursor( (Display*) M_CURSORDATA->m_display, x_cur ); +#endif } -wxCursor::wxCursor(const char bits[], int width, int height, - int hotSpotX, int hotSpotY, - const char maskBits[], wxColour *fg, wxColour *bg) -{ - wxFAIL_MSG( "wxCursor creation from bits not yet implemented" ); -} - - -wxCursor::wxCursor( const wxCursor &cursor ) +wxCursor::wxCursor(const wxString& WXUNUSED(name), + wxBitmapType WXUNUSED(type), + int WXUNUSED(hotSpotX), int WXUNUSED(hotSpotY)) { - Ref( cursor ); + wxFAIL_MSG( wxT("wxCursor creation from file not yet implemented") ); } #if wxUSE_IMAGE -wxCursor::wxCursor( const wxImage & image ) +wxCursor::wxCursor( const wxImage & WXUNUSED(image) ) { - wxFAIL_MSG( "wxCursor creation from wxImage not yet implemented" ); + wxFAIL_MSG( wxT("wxCursor creation from wxImage not yet implemented") ); } #endif @@ -134,29 +147,17 @@ wxCursor::~wxCursor() { } -wxCursor& wxCursor::operator = ( const wxCursor& cursor ) +wxGDIRefData *wxCursor::CreateGDIRefData() const { - if (*this == cursor) - return (*this); - - Ref( cursor ); - - return *this; + return new wxCursorRefData; } -bool wxCursor::operator == ( const wxCursor& cursor ) const +wxGDIRefData * +wxCursor::CloneGDIRefData(const wxGDIRefData * WXUNUSED(data)) const { - return m_refData == cursor.m_refData; -} + wxFAIL_MSG( wxS("Cloning cursors is not implemented in wxX11.") ); -bool wxCursor::operator != ( const wxCursor& cursor ) const -{ - return m_refData != cursor.m_refData; -} - -bool wxCursor::Ok() const -{ - return (m_refData != NULL); + return new wxCursorRefData; } WXCursor wxCursor::GetCursor() const @@ -192,15 +193,15 @@ void wxEndBusyCursor() gs_savedCursor = wxNullCursor; if (wxTheApp) - wxTheApp->SendIdleEvents(); + 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; @@ -208,7 +209,7 @@ void wxBeginBusyCursor( wxCursor *WXUNUSED(cursor) ) wxSetCursor( wxCursor(wxCURSOR_WATCH) ); if (wxTheApp) - wxTheApp->SendIdleEvents(); + wxTheApp->ProcessIdle(); } bool wxIsBusy()