]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/cursor.h
Applied patch [ 597700 ] Fix proposal for wxJoystick under MSW
[wxWidgets.git] / include / wx / msw / cursor.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/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 // compatible (even if incorrect) behaviour by default: derive wxCursor from
20 // wxBitmap
21 #ifndef wxICON_IS_BITMAP
22 #define wxICON_IS_BITMAP 1
23 #endif
24
25 #if wxICON_IS_BITMAP
26 #include "wx/bitmap.h"
27
28 #define wxCursorRefDataBase wxBitmapRefData
29 #define wxCursorBase wxBitmap
30 #else
31 #include "wx/msw/gdiimage.h"
32
33 #define wxCursorRefDataBase wxGDIImageRefData
34 #define wxCursorBase wxGDIImage
35 #endif
36
37 class WXDLLEXPORT wxImage;
38
39 class WXDLLEXPORT wxCursorRefData : public wxCursorRefDataBase
40 {
41 public:
42 wxCursorRefData();
43 virtual ~wxCursorRefData() { Free(); }
44
45 virtual void Free();
46
47 // for compatibility
48 public:
49 bool m_destroyCursor;
50 };
51
52 // Cursor
53 class WXDLLEXPORT wxCursor : public wxCursorBase
54 {
55 public:
56 wxCursor();
57
58 // Copy constructors
59 wxCursor(const wxCursor& cursor) { Ref(cursor); }
60 wxCursor(const wxImage & image) ;
61 wxCursor(const char bits[], int width, int height,
62 int hotSpotX = -1, int hotSpotY = -1,
63 const char maskBits[] = NULL);
64 wxCursor(const wxString& name,
65 long flags = wxBITMAP_TYPE_CUR_RESOURCE,
66 int hotSpotX = 0, int hotSpotY = 0);
67 wxCursor(int cursor_type);
68 virtual ~wxCursor();
69
70 wxCursor& operator = (const wxCursor& cursor) { if (*this == cursor) return (*this); Ref(cursor); return *this; }
71 bool operator == (const wxCursor& cursor) const { return m_refData == cursor.m_refData; }
72 bool operator != (const wxCursor& cursor) const { return m_refData != cursor.m_refData; }
73
74 void SetHCURSOR(WXHCURSOR cursor) { SetHandle((WXHANDLE)cursor); }
75 WXHCURSOR GetHCURSOR() const { return (WXHCURSOR)GetHandle(); }
76
77 protected:
78 virtual wxGDIImageRefData *CreateData() const { return new wxCursorRefData; }
79
80 private:
81 DECLARE_DYNAMIC_CLASS(wxCursor)
82 };
83
84 #endif
85 // _WX_CURSOR_H_