]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/cursor.h
Moved the cleanup code to an EVT_WINDOW_DESTROY handler.
[wxWidgets.git] / include / wx / msw / cursor.h
CommitLineData
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 14
4ccf704a 15#include "wx/image.h"
bff4ec63 16
2bda0e17 17#ifdef __GNUG__
6d167489 18 #pragma interface "cursor.h"
2bda0e17
KB
19#endif
20
6d167489
VZ
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"
2bda0e17 34
6d167489
VZ
35 #define wxCursorRefDataBase wxGDIImageRefData
36 #define wxCursorBase wxGDIImage
37#endif
38
39class WXDLLEXPORT wxCursorRefData : public wxCursorRefDataBase
2bda0e17 40{
2bda0e17 41public:
6d167489
VZ
42 wxCursorRefData();
43 virtual ~wxCursorRefData() { Free(); }
2bda0e17 44
6d167489 45 virtual void Free();
2bda0e17 46
6d167489
VZ
47 // for compatibility
48public:
49 bool m_destroyCursor;
50};
2bda0e17
KB
51
52// Cursor
6d167489 53class WXDLLEXPORT wxCursor : public wxCursorBase
2bda0e17 54{
2bda0e17 55public:
6d167489 56 wxCursor();
2bda0e17 57
6d167489
VZ
58 // Copy constructors
59 wxCursor(const wxCursor& cursor) { Ref(cursor); }
bff4ec63 60 wxCursor(const wxImage & image) ;
6d167489
VZ
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();
2bda0e17 69
6d167489
VZ
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; }
2bda0e17 73
6d167489
VZ
74 void SetHCURSOR(WXHCURSOR cursor) { SetHandle((WXHANDLE)cursor); }
75 WXHCURSOR GetHCURSOR() const { return (WXHCURSOR)GetHandle(); }
2bda0e17 76
6d167489
VZ
77protected:
78 virtual wxGDIImageRefData *CreateData() const { return new wxCursorRefData; }
2bda0e17 79
6d167489
VZ
80private:
81 DECLARE_DYNAMIC_CLASS(wxCursor)
2bda0e17
KB
82};
83
84#endif
bbcdf8bc 85 // _WX_CURSOR_H_