]>
Commit | Line | Data |
---|---|---|
0e320a79 DW |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: cursor.h | |
3 | // Purpose: wxCursor class | |
37f214d5 | 4 | // Author: David Webster |
0e320a79 | 5 | // Modified by: |
37f214d5 | 6 | // Created: 10/13/99 |
0e320a79 | 7 | // RCS-ID: $Id$ |
37f214d5 | 8 | // Copyright: (c) David Webster |
65571936 | 9 | // Licence: wxWindows licence |
0e320a79 DW |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_CURSOR_H_ | |
13 | #define _WX_CURSOR_H_ | |
14 | ||
0e320a79 DW |
15 | #include "wx/bitmap.h" |
16 | ||
760a4fb9 | 17 | class WXDLLEXPORT wxCursorRefData: public wxGDIImageRefData |
0e320a79 | 18 | { |
0e320a79 DW |
19 | public: |
20 | wxCursorRefData(); | |
760a4fb9 DW |
21 | ~wxCursorRefData() { Free(); } |
22 | virtual void Free(void); | |
23 | bool m_bDestroyCursor; | |
24 | }; // end of CLASS wxCursorRefData | |
0e320a79 DW |
25 | |
26 | #define M_CURSORDATA ((wxCursorRefData *)m_refData) | |
27 | #define M_CURSORHANDLERDATA ((wxCursorRefData *)bitmap->m_refData) | |
28 | ||
29 | // Cursor | |
30 | class WXDLLEXPORT wxCursor: public wxBitmap | |
31 | { | |
0e320a79 | 32 | public: |
760a4fb9 | 33 | wxCursor(); |
0e320a79 | 34 | |
760a4fb9 DW |
35 | // Copy constructors |
36 | wxCursor(const wxCursor& rCursor) { Ref(rCursor); } | |
37 | wxCursor(const wxImage& rImage); | |
0e320a79 | 38 | |
760a4fb9 DW |
39 | wxCursor( const char acBits[] |
40 | ,int nWidth | |
41 | ,int nHeight | |
42 | ,int nHotSpotX = -1 | |
43 | ,int nHotSpotY = -1 | |
44 | ,const char zMaskBits[] = NULL | |
45 | ); | |
46 | wxCursor( const wxString& rsName | |
47 | ,long lFlags = wxBITMAP_TYPE_CUR_RESOURCE | |
48 | ,int nHotSpotX = 0 | |
49 | ,int nHotSpotY = 0 | |
50 | ); | |
51 | wxCursor(int nCursorType); | |
52 | inline ~wxCursor() { } | |
0e320a79 | 53 | |
760a4fb9 DW |
54 | inline wxCursor& operator = (const wxCursor& rCursor) |
55 | { | |
56 | if (*this == rCursor) | |
57 | return (*this); | |
58 | Ref(rCursor); | |
59 | return *this; | |
60 | } | |
0e70f525 SN |
61 | inline bool operator == (const wxCursor& rCursor) const { return m_refData == rCursor.m_refData; } |
62 | inline bool operator != (const wxCursor& rCursor) const { return m_refData != rCursor.m_refData; } | |
0e320a79 | 63 | |
760a4fb9 DW |
64 | inline WXHCURSOR GetHCURSOR(void) const { return (M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0); } |
65 | inline void SetHCURSOR(WXHCURSOR hCursor) { SetHandle((WXHANDLE)hCursor); } | |
0e320a79 | 66 | |
760a4fb9 DW |
67 | protected: |
68 | inline virtual wxGDIImageRefData* CreateData(void) const { return (new wxCursorRefData); } | |
0e320a79 | 69 | |
760a4fb9 DW |
70 | private: |
71 | DECLARE_DYNAMIC_CLASS(wxCursor) | |
72 | }; // end of CLASS wxCursor | |
0e320a79 DW |
73 | |
74 | #endif | |
75 | // _WX_CURSOR_H_ |