]>
git.saurik.com Git - wxWidgets.git/blob - src/dfb/cursor.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/dfb/cursor.cpp
3 // Purpose: wxCursor implementation
4 // Author: Vaclav Slavik
7 // Copyright: (c) 2006 REA Elektronik GmbH
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
18 #include "wx/cursor.h"
19 #include "wx/bitmap.h"
21 //-----------------------------------------------------------------------------
23 //-----------------------------------------------------------------------------
25 class wxCursorRefData
: public wxObjectRefData
28 wxCursorRefData(const wxBitmap
& bmp
= wxNullBitmap
, int id
= -1)
29 : m_id(id
), m_bitmap(bmp
) {}
35 #define M_CURSOR_OF(c) ((wxCursorRefData*)((c).m_refData))
36 #define M_CURSOR M_CURSOR_OF(*this)
38 //-----------------------------------------------------------------------------
40 //-----------------------------------------------------------------------------
42 IMPLEMENT_DYNAMIC_CLASS(wxCursor
, wxObject
)
44 wxCursor::wxCursor(int cursorId
)
46 #warning "FIXME -- implement the cursor as bitmaps (that's what DFB uses)"
49 wxCursor::wxCursor(const char WXUNUSED(bits
)[],
52 int WXUNUSED(hotSpotX
), int WXUNUSED(hotSpotY
),
53 const char WXUNUSED(maskBits
)[],
54 wxColour
* WXUNUSED(fg
), wxColour
* WXUNUSED(bg
) )
59 wxCursor::wxCursor(const wxString
& cursor_file
,
61 int WXUNUSED(hotSpotX
), int WXUNUSED(hotSpotY
))
66 bool wxCursor::Ok() const
68 return m_refData
&& M_CURSOR
->m_bitmap
.Ok();
71 bool wxCursor::operator==(const wxCursor
& cursor
) const
77 else if ( M_CURSOR
->m_id
!= M_CURSOR_OF(cursor
)->m_id
)
79 else if ( M_CURSOR
->m_id
== -1 ) // non-stock cursor
80 return (m_refData
== cursor
.m_refData
);
82 return true; // IDs != -1 and are the same
90 wxObjectRefData
*wxCursor::CreateRefData() const
92 return new wxCursorRefData
;
95 wxObjectRefData
*wxCursor::CloneRefData(const wxObjectRefData
*data
) const
97 return new wxCursorRefData(*(wxCursorRefData
*)data
);
101 // ----------------------------------------------------------------------------
102 // Global cursor setting
103 // ----------------------------------------------------------------------------
105 void wxSetCursor(const wxCursor
& cursor
)
107 #warning "FIXME: implement"
112 //-----------------------------------------------------------------------------
113 // busy cursor routines
114 //-----------------------------------------------------------------------------
116 #warning "FIXME: this should be common code"
118 static wxCursor gs_savedCursor
= wxNullCursor
;
119 static int gs_busyCount
= 0;
121 const wxCursor
&wxBusyCursor::GetStoredCursor()
123 return gs_savedCursor
;
126 const wxCursor
wxBusyCursor::GetBusyCursor()
128 return gs_globalCursor
;
132 void wxEndBusyCursor()
134 #warning "FIXME - do this logic in common code?"
137 void wxBeginBusyCursor(const wxCursor
*cursor
)