]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk/cursor.cpp
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
12 #pragma implementation "cursor.h"
15 #include "wx/cursor.h"
17 //-----------------------------------------------------------------------------
19 //-----------------------------------------------------------------------------
21 class wxCursorRefData
: public wxObjectRefData
25 wxCursorRefData(void);
26 ~wxCursorRefData(void);
31 wxCursorRefData::wxCursorRefData(void)
33 m_cursor
= (GdkCursor
*) NULL
;
36 wxCursorRefData::~wxCursorRefData(void)
38 if (m_cursor
) gdk_cursor_destroy( m_cursor
);
41 //-----------------------------------------------------------------------------
43 #define M_CURSORDATA ((wxCursorRefData *)m_refData)
45 IMPLEMENT_DYNAMIC_CLASS(wxCursor
,wxObject
)
47 wxCursor::wxCursor(void)
51 wxCursor::wxCursor( int cursorId
)
53 m_refData
= new wxCursorRefData();
55 GdkCursorType gdk_cur
= GDK_LEFT_PTR
;
58 case wxCURSOR_HAND
: gdk_cur
= GDK_HAND1
; break;
59 case wxCURSOR_CROSS
: gdk_cur
= GDK_CROSSHAIR
; break;
60 case wxCURSOR_SIZEWE
: gdk_cur
= GDK_SB_H_DOUBLE_ARROW
; break;
61 case wxCURSOR_SIZENS
: gdk_cur
= GDK_SB_V_DOUBLE_ARROW
; break;
62 case wxCURSOR_WAIT
: gdk_cur
= GDK_WATCH
; break;
63 case wxCURSOR_WATCH
: gdk_cur
= GDK_WATCH
; break;
64 case wxCURSOR_SIZING
: gdk_cur
= GDK_SIZING
; break;
65 case wxCURSOR_SPRAYCAN
: gdk_cur
= GDK_SPRAYCAN
; break;
66 case wxCURSOR_IBEAM
: gdk_cur
= GDK_XTERM
; break;
67 case wxCURSOR_PENCIL
: gdk_cur
= GDK_PENCIL
; break;
68 case wxCURSOR_NO_ENTRY
: gdk_cur
= GDK_PIRATE
; break;
71 M_CURSORDATA
->m_cursor
= gdk_cursor_new( gdk_cur
);
80 wxCURSOR_MIDDLE_BUTTON,
85 wxCURSOR_QUESTION_ARROW,
86 wxCURSOR_RIGHT_BUTTON,
93 wxCURSOR_CROSS_REVERSE,
94 wxCURSOR_DOUBLE_ARROW,
95 wxCURSOR_BASED_ARROW_UP,
96 wxCURSOR_BASED_ARROW_DOWN
101 wxCursor::wxCursor( const wxCursor
&cursor
)
106 wxCursor::wxCursor( const wxCursor
*cursor
)
109 if (cursor
) Ref( *cursor
);
112 wxCursor::~wxCursor(void)
116 wxCursor
& wxCursor::operator = ( const wxCursor
& cursor
)
118 if (*this == cursor
) return (*this);
123 bool wxCursor::operator == ( const wxCursor
& cursor
)
125 return m_refData
== cursor
.m_refData
;
128 bool wxCursor::operator != ( const wxCursor
& cursor
)
130 return m_refData
!= cursor
.m_refData
;
133 bool wxCursor::Ok(void) const
135 return (m_refData
!= NULL
);
138 GdkCursor
*wxCursor::GetCursor(void) const
140 return M_CURSORDATA
->m_cursor
;
143 //-----------------------------------------------------------------------------
144 // busy cursor routines
145 //-----------------------------------------------------------------------------
147 bool g_isBusy
= FALSE
;
149 void wxEndBusyCursor(void)
154 void wxBeginBusyCursor( wxCursor
*WXUNUSED(cursor
) )
164 void wxSetCursor( const wxCursor
& cursor
)
166 extern wxCursor
*g_globalCursor
;
167 if (g_globalCursor
) (*g_globalCursor
) = cursor
;