]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/cursor.h
Added
[wxWidgets.git] / include / wx / msw / cursor.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: cursor.h
3 // Purpose: wxCursor class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_CURSOR_H_
13 #define _WX_CURSOR_H_
14
15 #ifdef __GNUG__
16 #pragma interface "cursor.h"
17 #endif
18
19 #include "wx/bitmap.h"
20
21 class WXDLLEXPORT wxCursorRefData: public wxBitmapRefData
22 {
23 friend class WXDLLEXPORT wxBitmap;
24 friend class WXDLLEXPORT wxCursor;
25 public:
26 wxCursorRefData(void);
27 ~wxCursorRefData(void);
28
29 protected:
30 WXHCURSOR m_hCursor;
31 bool m_destroyCursor;
32 };
33
34 #define M_CURSORDATA ((wxCursorRefData *)m_refData)
35 #define M_CURSORHANDLERDATA ((wxCursorRefData *)bitmap->m_refData)
36
37 // Cursor
38 class WXDLLEXPORT wxCursor: public wxBitmap
39 {
40 DECLARE_DYNAMIC_CLASS(wxCursor)
41
42 public:
43 wxCursor(void);
44
45 // Copy constructors
46 inline wxCursor(const wxCursor& cursor) { Ref(cursor); }
47
48 wxCursor(const char bits[], int width, int height, int hotSpotX = -1, int hotSpotY = -1,
49 const char maskBits[] = NULL);
50 wxCursor(const wxString& name, long flags = wxBITMAP_TYPE_CUR_RESOURCE,
51 int hotSpotX = 0, int hotSpotY = 0);
52 wxCursor(int cursor_type);
53 ~wxCursor(void);
54
55 virtual bool Ok(void) const { return (m_refData != NULL && M_CURSORDATA->m_hCursor) ; }
56
57 wxCursor& operator = (const wxCursor& cursor) { if (*this == cursor) return (*this); Ref(cursor); return *this; }
58 bool operator == (const wxCursor& cursor) const { return m_refData == cursor.m_refData; }
59 bool operator != (const wxCursor& cursor) const { return m_refData != cursor.m_refData; }
60
61 void SetHCURSOR(WXHCURSOR cursor);
62 inline WXHCURSOR GetHCURSOR(void) const { return (M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0); }
63
64 bool FreeResource(bool force = FALSE);
65 };
66
67 #endif
68 // _WX_CURSOR_H_