]>
Commit | Line | Data |
---|---|---|
2bda0e17 | 1 | ///////////////////////////////////////////////////////////////////////////// |
6d167489 | 2 | // Name: wx/msw/cursor.h |
2bda0e17 KB |
3 | // Purpose: wxCursor class |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
bbcdf8bc | 8 | // Copyright: (c) Julian Smart |
6d167489 | 9 | // Licence: wxWindows licence |
2bda0e17 KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
bbcdf8bc JS |
12 | #ifndef _WX_CURSOR_H_ |
13 | #define _WX_CURSOR_H_ | |
2bda0e17 KB |
14 | |
15 | #ifdef __GNUG__ | |
6d167489 | 16 | #pragma interface "cursor.h" |
2bda0e17 KB |
17 | #endif |
18 | ||
6d167489 VZ |
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" | |
2bda0e17 | 32 | |
6d167489 VZ |
33 | #define wxCursorRefDataBase wxGDIImageRefData |
34 | #define wxCursorBase wxGDIImage | |
35 | #endif | |
36 | ||
37 | class WXDLLEXPORT wxCursorRefData : public wxCursorRefDataBase | |
2bda0e17 | 38 | { |
2bda0e17 | 39 | public: |
6d167489 VZ |
40 | wxCursorRefData(); |
41 | virtual ~wxCursorRefData() { Free(); } | |
2bda0e17 | 42 | |
6d167489 | 43 | virtual void Free(); |
2bda0e17 | 44 | |
6d167489 VZ |
45 | // for compatibility |
46 | public: | |
47 | bool m_destroyCursor; | |
48 | }; | |
2bda0e17 KB |
49 | |
50 | // Cursor | |
6d167489 | 51 | class WXDLLEXPORT wxCursor : public wxCursorBase |
2bda0e17 | 52 | { |
2bda0e17 | 53 | public: |
6d167489 | 54 | wxCursor(); |
2bda0e17 | 55 | |
6d167489 VZ |
56 | // Copy constructors |
57 | wxCursor(const wxCursor& cursor) { Ref(cursor); } | |
2bda0e17 | 58 | |
6d167489 VZ |
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(); | |
2bda0e17 | 67 | |
6d167489 VZ |
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; } | |
2bda0e17 | 71 | |
6d167489 VZ |
72 | void SetHCURSOR(WXHCURSOR cursor) { SetHandle((WXHANDLE)cursor); } |
73 | WXHCURSOR GetHCURSOR() const { return (WXHCURSOR)GetHandle(); } | |
2bda0e17 | 74 | |
6d167489 VZ |
75 | protected: |
76 | virtual wxGDIImageRefData *CreateData() const { return new wxCursorRefData; } | |
2bda0e17 | 77 | |
6d167489 VZ |
78 | private: |
79 | DECLARE_DYNAMIC_CLASS(wxCursor) | |
2bda0e17 KB |
80 | }; |
81 | ||
82 | #endif | |
bbcdf8bc | 83 | // _WX_CURSOR_H_ |