]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: cursor.h | |
3 | // Purpose: wxCursor class | |
4 | // Author: David Webster | |
5 | // Modified by: | |
6 | // Created: 10/13/99 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) David Webster | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_CURSOR_H_ | |
13 | #define _WX_CURSOR_H_ | |
14 | ||
15 | #include "wx/bitmap.h" | |
16 | ||
17 | class WXDLLEXPORT wxCursorRefData: public wxGDIImageRefData | |
18 | { | |
19 | public: | |
20 | wxCursorRefData(); | |
21 | ~wxCursorRefData() { Free(); } | |
22 | virtual void Free(void); | |
23 | bool m_bDestroyCursor; | |
24 | }; // end of CLASS wxCursorRefData | |
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 | { | |
32 | public: | |
33 | wxCursor(); | |
34 | ||
35 | // Copy constructors | |
36 | wxCursor(const wxCursor& rCursor) { Ref(rCursor); } | |
37 | wxCursor(const wxImage& rImage); | |
38 | ||
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() { } | |
53 | ||
54 | inline wxCursor& operator = (const wxCursor& rCursor) | |
55 | { | |
56 | if (*this == rCursor) | |
57 | return (*this); | |
58 | Ref(rCursor); | |
59 | return *this; | |
60 | } | |
61 | inline bool operator == (const wxCursor& rCursor) { return m_refData == rCursor.m_refData; } | |
62 | inline bool operator != (const wxCursor& rCursor) { return m_refData != rCursor.m_refData; } | |
63 | ||
64 | inline WXHCURSOR GetHCURSOR(void) const { return (M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0); } | |
65 | inline void SetHCURSOR(WXHCURSOR hCursor) { SetHandle((WXHANDLE)hCursor); } | |
66 | ||
67 | protected: | |
68 | inline virtual wxGDIImageRefData* CreateData(void) const { return (new wxCursorRefData); } | |
69 | ||
70 | private: | |
71 | DECLARE_DYNAMIC_CLASS(wxCursor) | |
72 | }; // end of CLASS wxCursor | |
73 | ||
74 | #endif | |
75 | // _WX_CURSOR_H_ |