]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/cursor.h
Applied patch for wxComboBox and wxListBox to
[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 wxCursorRefData : public wxCursorRefDataBase
38 {
39 public:
40 wxCursorRefData();
41 virtual ~wxCursorRefData() { Free(); }
42
43 virtual void Free();
44
45 // for compatibility
46 public:
47 bool m_destroyCursor;
48 };
49
50 // Cursor
51 class WXDLLEXPORT wxCursor : public wxCursorBase
52 {
53 public:
54 wxCursor();
55
56 // Copy constructors
57 wxCursor(const wxCursor& cursor) { Ref(cursor); }
58
59 wxCursor(const char bits[], int width, int height,
60 int hotSpotX = -1, int hotSpotY = -1,
61 const char maskBits[] = NULL);
62 wxCursor(const wxString& name,
63 long flags = wxBITMAP_TYPE_CUR_RESOURCE,
64 int hotSpotX = 0, int hotSpotY = 0);
65 wxCursor(int cursor_type);
66 virtual ~wxCursor();
67
68 wxCursor& operator = (const wxCursor& cursor) { if (*this == cursor) return (*this); Ref(cursor); return *this; }
69 bool operator == (const wxCursor& cursor) const { return m_refData == cursor.m_refData; }
70 bool operator != (const wxCursor& cursor) const { return m_refData != cursor.m_refData; }
71
72 void SetHCURSOR(WXHCURSOR cursor) { SetHandle((WXHANDLE)cursor); }
73 WXHCURSOR GetHCURSOR() const { return (WXHCURSOR)GetHandle(); }
74
75 protected:
76 virtual wxGDIImageRefData *CreateData() const { return new wxCursorRefData; }
77
78 private:
79 DECLARE_DYNAMIC_CLASS(wxCursor)
80 };
81
82 #endif
83 // _WX_CURSOR_H_