1999-01-01 16:05:26 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: cursor.h
|
|
|
|
// Purpose: wxCursor class
|
2003-02-28 21:54:04 +00:00
|
|
|
// Author: Stefan Csomor
|
1999-01-01 16:05:26 +00:00
|
|
|
// Modified by:
|
2003-02-28 21:54:04 +00:00
|
|
|
// Created: 1998-01-01
|
1999-01-01 16:05:26 +00:00
|
|
|
// RCS-ID: $Id$
|
2003-02-28 21:54:04 +00:00
|
|
|
// Copyright: (c) Stefan Csomor
|
2003-02-28 23:36:37 +00:00
|
|
|
// Licence: wxWindows licence
|
1999-01-01 16:05:26 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_CURSOR_H_
|
|
|
|
#define _WX_CURSOR_H_
|
|
|
|
|
2003-08-09 12:38:21 +00:00
|
|
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
1999-01-01 16:05:26 +00:00
|
|
|
#pragma interface "cursor.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/bitmap.h"
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxCursorRefData: public wxBitmapRefData
|
|
|
|
{
|
2002-05-08 13:30:26 +00:00
|
|
|
DECLARE_NO_COPY_CLASS(wxCursorRefData)
|
|
|
|
|
1999-01-01 16:05:26 +00:00
|
|
|
friend class WXDLLEXPORT wxBitmap;
|
|
|
|
friend class WXDLLEXPORT wxCursor;
|
|
|
|
public:
|
|
|
|
wxCursorRefData();
|
|
|
|
~wxCursorRefData();
|
|
|
|
|
|
|
|
protected:
|
2003-02-28 23:36:37 +00:00
|
|
|
WXHCURSOR m_hCursor;
|
|
|
|
bool m_disposeHandle;
|
|
|
|
bool m_releaseHandle;
|
2003-01-13 19:17:53 +00:00
|
|
|
bool m_isColorCursor ;
|
2003-02-28 23:36:37 +00:00
|
|
|
long m_themeCursor ;
|
1999-01-01 16:05:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define M_CURSORDATA ((wxCursorRefData *)m_refData)
|
|
|
|
#define M_CURSORHANDLERDATA ((wxCursorRefData *)bitmap->m_refData)
|
|
|
|
|
|
|
|
// Cursor
|
|
|
|
class WXDLLEXPORT wxCursor: public wxBitmap
|
|
|
|
{
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxCursor)
|
|
|
|
|
|
|
|
public:
|
|
|
|
wxCursor();
|
|
|
|
|
|
|
|
// Copy constructors
|
2002-05-08 13:30:26 +00:00
|
|
|
wxCursor(const wxCursor& cursor)
|
|
|
|
: wxBitmap()
|
|
|
|
{ Ref(cursor); }
|
1999-01-01 16:05:26 +00:00
|
|
|
|
|
|
|
wxCursor(const char bits[], int width, int height, int hotSpotX = -1, int hotSpotY = -1,
|
|
|
|
const char maskBits[] = NULL);
|
|
|
|
|
2003-01-13 19:17:53 +00:00
|
|
|
wxCursor(const wxImage & image) ;
|
2003-03-02 22:38:30 +00:00
|
|
|
wxCursor(const char **bits) ;
|
|
|
|
wxCursor(char **bits) ;
|
2003-02-28 23:36:37 +00:00
|
|
|
wxCursor(const wxString& name, long flags = wxBITMAP_TYPE_MACCURSOR_RESOURCE,
|
2003-03-02 22:38:30 +00:00
|
|
|
int hotSpotX = 0, int hotSpotY = 0);
|
1999-01-01 16:05:26 +00:00
|
|
|
|
|
|
|
wxCursor(int cursor_type);
|
|
|
|
~wxCursor();
|
|
|
|
|
2003-03-02 22:38:30 +00:00
|
|
|
bool CreateFromXpm(const char **bits) ;
|
2003-01-13 19:17:53 +00:00
|
|
|
virtual bool Ok() const { return (m_refData != NULL && ( M_CURSORDATA->m_hCursor != NULL || M_CURSORDATA->m_themeCursor != -1 ) ) ; }
|
1999-01-01 16:05:26 +00:00
|
|
|
|
|
|
|
inline wxCursor& operator = (const wxCursor& cursor) { if (*this == cursor) return (*this); Ref(cursor); return *this; }
|
|
|
|
inline bool operator == (const wxCursor& cursor) { return m_refData == cursor.m_refData; }
|
|
|
|
inline bool operator != (const wxCursor& cursor) { return m_refData != cursor.m_refData; }
|
|
|
|
|
2003-02-28 23:36:37 +00:00
|
|
|
void MacInstall() const ;
|
1999-11-05 09:16:09 +00:00
|
|
|
|
1999-01-01 16:05:26 +00:00
|
|
|
void SetHCURSOR(WXHCURSOR cursor);
|
|
|
|
inline WXHCURSOR GetHCURSOR() const { return (M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0); }
|
2003-01-13 19:17:53 +00:00
|
|
|
private :
|
2003-01-16 06:53:32 +00:00
|
|
|
void CreateFromImage(const wxImage & image) ;
|
1999-01-01 16:05:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern WXDLLEXPORT void wxSetCursor(const wxCursor& cursor);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
// _WX_CURSOR_H_
|