]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/cursor.h
tree control and dc::drawlines bug
[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 and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __CURSORH__
13 #define __CURSORH__
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 inline wxCursor(const wxCursor* cursor) { /* UnRef(); */ if (cursor) Ref(*cursor); }
48
49 wxCursor(const char bits[], int width, int height, int hotSpotX = -1, int hotSpotY = -1,
50 const char maskBits[] = NULL);
51 wxCursor(const wxString& name, long flags = wxBITMAP_TYPE_CUR_RESOURCE,
52 int hotSpotX = 0, int hotSpotY = 0);
53 wxCursor(int cursor_type);
54 ~wxCursor(void);
55
56 virtual bool Ok(void) const { return (m_refData != NULL && M_CURSORDATA->m_hCursor) ; }
57
58 inline wxCursor& operator = (const wxCursor& cursor) { if (*this == cursor) return (*this); Ref(cursor); return *this; }
59 inline bool operator == (const wxCursor& cursor) { return m_refData == cursor.m_refData; }
60 inline bool operator != (const wxCursor& cursor) { return m_refData != cursor.m_refData; }
61
62 void SetHCURSOR(WXHCURSOR cursor);
63 inline WXHCURSOR GetHCURSOR(void) const { return (M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0); }
64
65 bool FreeResource(bool force = FALSE);
66 };
67
68 #endif
69 // __CURSORH__