]> git.saurik.com Git - wxWidgets.git/blob - include/wx/cocoa/cursor.h
fixed Cygwin compilation (there's no _get_osfhandle)
[wxWidgets.git] / include / wx / cocoa / cursor.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: cursor.h
3 // Purpose: wxCursor class
4 // Author: David Elliott <dfe@cox.net>
5 // Modified by:
6 // Created: 2002/11/27
7 // RCS-ID:
8 // Copyright: (c) David Elliott
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_COCOA_CURSOR_H_
13 #define _WX_COCOA_CURSOR_H_
14
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "cursor.h"
17 #endif
18
19 #include "wx/bitmap.h"
20
21 class WXDLLEXPORT wxCursorRefData: public wxObjectRefData
22 {
23 DECLARE_NO_COPY_CLASS(wxCursorRefData)
24
25 friend class WXDLLEXPORT wxBitmap;
26 friend class WXDLLEXPORT wxCursor;
27 public:
28 wxCursorRefData();
29 ~wxCursorRefData();
30
31 protected:
32 int m_width, m_height;
33 WX_NSCursor m_hCursor;
34 };
35
36 #define M_CURSORDATA ((wxCursorRefData *)m_refData)
37 #define M_CURSORHANDLERDATA ((wxCursorRefData *)bitmap->m_refData)
38
39 // Cursor
40 class WXDLLEXPORT wxCursor: public wxBitmap
41 {
42 DECLARE_DYNAMIC_CLASS(wxCursor)
43
44 public:
45 wxCursor();
46
47 // Copy constructors
48 wxCursor(const wxCursor& cursor)
49 : wxBitmap()
50 { Ref(cursor); }
51
52 wxCursor(const char bits[], int width, int height, int hotSpotX = -1, int hotSpotY = -1,
53 const char maskBits[] = NULL);
54
55 wxCursor(const wxString& name, long flags = 0,
56 int hotSpotX = 0, int hotSpotY = 0);
57
58 wxCursor(int cursor_type);
59 ~wxCursor();
60
61 virtual bool Ok() const { return m_refData ; }
62
63 inline wxCursor& operator = (const wxCursor& cursor) { if (*this == cursor) return (*this); Ref(cursor); return *this; }
64 inline bool operator == (const wxCursor& cursor) { return m_refData == cursor.m_refData; }
65 inline bool operator != (const wxCursor& cursor) { return m_refData != cursor.m_refData; }
66
67 inline WX_NSCursor GetNSCursor() const
68 {
69 return (M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0);
70 }
71
72 };
73
74 extern WXDLLEXPORT void wxSetCursor(const wxCursor& cursor);
75
76 #endif // _WX_COCOA_CURSOR_H_