]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk/cursor.cpp
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
7 // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "cursor.h"
16 #include "wx/cursor.h"
18 //-----------------------------------------------------------------------------
20 //-----------------------------------------------------------------------------
22 class wxCursorRefData
: public wxObjectRefData
26 wxCursorRefData(void);
27 ~wxCursorRefData(void);
32 wxCursorRefData::wxCursorRefData(void)
37 wxCursorRefData::~wxCursorRefData(void)
39 if (m_cursor
) gdk_cursor_destroy( m_cursor
);
42 //-----------------------------------------------------------------------------
44 #define M_CURSORDATA ((wxCursorRefData *)m_refData)
46 IMPLEMENT_DYNAMIC_CLASS(wxCursor
,wxObject
)
48 wxCursor::wxCursor(void)
52 wxCursor::wxCursor( const int cursorId
)
54 m_refData
= new wxCursorRefData();
56 GdkCursorType gdk_cur
= GDK_LEFT_PTR
;
59 case wxCURSOR_HAND
: gdk_cur
= GDK_HAND1
; break;
60 case wxCURSOR_CROSS
: gdk_cur
= GDK_CROSSHAIR
; break;
61 case wxCURSOR_SIZEWE
: gdk_cur
= GDK_SB_H_DOUBLE_ARROW
; break;
62 case wxCURSOR_SIZENS
: gdk_cur
= GDK_SB_V_DOUBLE_ARROW
; break;
63 case wxCURSOR_WAIT
: gdk_cur
= GDK_WATCH
; break;
64 case wxCURSOR_WATCH
: gdk_cur
= GDK_WATCH
; break;
65 case wxCURSOR_SIZING
: gdk_cur
= GDK_SIZING
; break;
66 case wxCURSOR_SPRAYCAN
: gdk_cur
= GDK_SPRAYCAN
; break;
67 case wxCURSOR_IBEAM
: gdk_cur
= GDK_XTERM
; break;
68 case wxCURSOR_PENCIL
: gdk_cur
= GDK_PENCIL
; break;
69 case wxCURSOR_NO_ENTRY
: gdk_cur
= GDK_PIRATE
; break;
72 M_CURSORDATA
->m_cursor
= gdk_cursor_new( gdk_cur
);
81 wxCURSOR_MIDDLE_BUTTON,
86 wxCURSOR_QUESTION_ARROW,
87 wxCURSOR_RIGHT_BUTTON,
94 wxCURSOR_CROSS_REVERSE,
95 wxCURSOR_DOUBLE_ARROW,
96 wxCURSOR_BASED_ARROW_UP,
97 wxCURSOR_BASED_ARROW_DOWN
102 wxCursor::wxCursor( const wxCursor
&cursor
)
107 wxCursor::wxCursor( const wxCursor
*cursor
)
110 if (cursor
) Ref( *cursor
);
113 wxCursor::~wxCursor(void)
117 wxCursor
& wxCursor::operator = ( const wxCursor
& cursor
)
119 if (*this == cursor
) return (*this);
124 bool wxCursor::operator == ( const wxCursor
& cursor
)
126 return m_refData
== cursor
.m_refData
;
129 bool wxCursor::operator != ( const wxCursor
& cursor
)
131 return m_refData
!= cursor
.m_refData
;
134 bool wxCursor::Ok(void) const
139 GdkCursor
*wxCursor::GetCursor(void) const
141 return M_CURSORDATA
->m_cursor
;
144 //-----------------------------------------------------------------------------
145 // busy cursor routines
146 //-----------------------------------------------------------------------------
148 bool g_isBusy
= FALSE
;
150 void wxEndBusyCursor(void)
155 void wxBeginBusyCursor( wxCursor
*WXUNUSED(cursor
) )
165 void wxSetCursor( const wxCursor
& cursor
)
167 extern wxCursor
*g_globalCursor
;
168 if (g_globalCursor
) (*g_globalCursor
) = cursor
;