]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/cocoa/cursor.h | |
3 | // Purpose: wxCursor class | |
4 | // Author: David Elliott <dfe@cox.net> | |
5 | // Modified by: | |
6 | // Created: 2002/11/27 | |
7 | // Copyright: (c) David Elliott | |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_COCOA_CURSOR_H_ | |
12 | #define _WX_COCOA_CURSOR_H_ | |
13 | ||
14 | #include "wx/bitmap.h" | |
15 | ||
16 | class WXDLLIMPEXP_CORE wxCursorRefData : public wxGDIRefData | |
17 | { | |
18 | public: | |
19 | wxCursorRefData(); | |
20 | virtual ~wxCursorRefData(); | |
21 | ||
22 | protected: | |
23 | int m_width, m_height; | |
24 | WX_NSCursor m_hCursor; | |
25 | ||
26 | friend class WXDLLIMPEXP_FWD_CORE wxBitmap; | |
27 | friend class WXDLLIMPEXP_FWD_CORE wxCursor; | |
28 | ||
29 | wxDECLARE_NO_COPY_CLASS(wxCursorRefData); | |
30 | }; | |
31 | ||
32 | #define M_CURSORDATA ((wxCursorRefData *)m_refData) | |
33 | #define M_CURSORHANDLERDATA ((wxCursorRefData *)bitmap->m_refData) | |
34 | ||
35 | // Cursor | |
36 | class WXDLLIMPEXP_CORE wxCursor: public wxBitmap | |
37 | { | |
38 | public: | |
39 | wxCursor(); | |
40 | ||
41 | wxCursor(const wxString& name, wxBitmapType type = wxCURSOR_DEFAULT_TYPE, | |
42 | int hotSpotX = 0, int hotSpotY = 0); | |
43 | ||
44 | wxCursor(wxStockCursor id) { InitFromStock(id); } | |
45 | #if WXWIN_COMPATIBILITY_2_8 | |
46 | wxCursor(int id) { InitFromStock((wxStockCursor)id); } | |
47 | #endif | |
48 | virtual ~wxCursor(); | |
49 | ||
50 | // FIXME: operator==() is wrong! | |
51 | bool operator==(const wxCursor& cursor) const { return m_refData == cursor.m_refData; } | |
52 | bool operator!=(const wxCursor& cursor) const { return !(*this == cursor); } | |
53 | ||
54 | WX_NSCursor GetNSCursor() const { return M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0; } | |
55 | ||
56 | private: | |
57 | void InitFromStock(wxStockCursor); | |
58 | DECLARE_DYNAMIC_CLASS(wxCursor) | |
59 | }; | |
60 | ||
61 | extern WXDLLIMPEXP_CORE void wxSetCursor(const wxCursor& cursor); | |
62 | ||
63 | #endif | |
64 | // _WX_COCOA_CURSOR_H_ |