]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/cursor.h
Removed obsolete -WE flags from WIN32 BC++ makefiles
[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 #include <wx/image.h>
16
17 #ifdef __GNUG__
18 #pragma interface "cursor.h"
19 #endif
20
21 // compatible (even if incorrect) behaviour by default: derive wxCursor from
22 // wxBitmap
23 #ifndef wxICON_IS_BITMAP
24 #define wxICON_IS_BITMAP 1
25 #endif
26
27 #if wxICON_IS_BITMAP
28 #include "wx/bitmap.h"
29
30 #define wxCursorRefDataBase wxBitmapRefData
31 #define wxCursorBase wxBitmap
32 #else
33 #include "wx/msw/gdiimage.h"
34
35 #define wxCursorRefDataBase wxGDIImageRefData
36 #define wxCursorBase wxGDIImage
37 #endif
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_