#include "wx/mac/private.h"
-IMPLEMENT_DYNAMIC_CLASS(wxCursor, wxBitmap)
+IMPLEMENT_DYNAMIC_CLASS(wxCursor, wxGDIObject)
-class WXDLLEXPORT wxCursorRefData: public wxBitmapRefData
+class WXDLLEXPORT wxCursorRefData: public wxGDIRefData
{
- DECLARE_NO_COPY_CLASS(wxCursorRefData)
-
- friend class wxBitmap;
- friend class wxCursor;
-
public:
wxCursorRefData();
+ wxCursorRefData(const wxCursorRefData& cursor);
virtual ~wxCursorRefData();
+ virtual bool IsOk() const
+ {
+ if ( m_hCursor != NULL )
+ return true;
+#if !wxMAC_USE_COCOA
+ if ( m_themeCursor != -1 )
+ return true;
+#endif
+
+ return false;
+ }
+
protected:
#if wxMAC_USE_COCOA
WX_NSCursor m_hCursor;
bool m_isColorCursor;
long m_themeCursor;
#endif
+
+ friend class wxCursor;
+
+ DECLARE_NO_ASSIGN_CLASS(wxCursorRefData)
};
#define M_CURSORDATA wx_static_cast(wxCursorRefData*, m_refData)
wxCursorRefData::wxCursorRefData()
{
- SetWidth( 16 );
- SetHeight( 16 );
m_hCursor = NULL;
#if wxMAC_USE_COCOA
#else
#endif
}
+wxCursorRefData::wxCursorRefData(const wxCursorRefData& cursor)
+{
+ // FIXME: need to copy the cursor
+ m_hCursor = NULL;
+
+#if wxMAC_USE_COCOA
+ wxUnusedVar(cursor);
+#else
+ m_disposeHandle = false;
+ m_releaseHandle = false;
+ m_isColorCursor = cursor.m_isColorCursor;
+ m_themeCursor = cursor.m_themeCursor;
+#endif
+}
+
wxCursorRefData::~wxCursorRefData()
{
#if wxMAC_USE_COCOA
#endif
}
-wxCursor::wxCursor(const char **bits)
+wxCursor::wxCursor(const char* const* bits)
{
(void) CreateFromXpm(bits);
}
-wxCursor::wxCursor(char **bits)
+wxGDIRefData *wxCursor::CreateGDIRefData() const
{
- (void) CreateFromXpm((const char **)bits);
+ return new wxCursorRefData;
}
-bool wxCursor::CreateFromXpm(const char **bits)
+wxGDIRefData *wxCursor::CloneGDIRefData(const wxGDIRefData *data) const
+{
+ return new wxCursorRefData(*wx_static_cast(const wxCursorRefData *, data));
+}
+
+bool wxCursor::CreateFromXpm(const char* const* bits)
{
#if wxUSE_IMAGE
wxCHECK_MSG( bits != NULL, false, wxT("invalid cursor data") );
return (M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0);
}
-bool wxCursor::IsOk() const
-{
-#if wxMAC_USE_COCOA
- return GetHCURSOR() != NULL;
-#else
- return (m_refData != NULL && ( M_CURSORDATA->m_hCursor != NULL || M_CURSORDATA->m_themeCursor != -1 ) ) ;
-#endif
-}
-
#if !wxMAC_USE_COCOA
short GetCTabIndex( CTabHandle colors , RGBColor *col )
{
}
// Global cursor setting
+wxCursor gGlobalCursor;
void wxSetCursor(const wxCursor& cursor)
{
cursor.MacInstall() ;
+ gGlobalCursor = cursor;
}