cursor support for xpm and d&d integration

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@19473 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2003-03-04 12:04:55 +00:00
parent bd3f6acd4d
commit 5872b92e95
2 changed files with 34 additions and 10 deletions

View File

@@ -29,7 +29,11 @@ public:
~wxCursorRefData(); ~wxCursorRefData();
protected: protected:
WXHCURSOR m_hCursor; WXHCURSOR m_hCursor;
bool m_disposeHandle;
bool m_releaseHandle;
bool m_isColorCursor ;
long m_themeCursor ;
}; };
#define M_CURSORDATA ((wxCursorRefData *)m_refData) #define M_CURSORDATA ((wxCursorRefData *)m_refData)
@@ -51,13 +55,17 @@ public:
wxCursor(const char bits[], int width, int height, int hotSpotX = -1, int hotSpotY = -1, wxCursor(const char bits[], int width, int height, int hotSpotX = -1, int hotSpotY = -1,
const char maskBits[] = NULL); const char maskBits[] = NULL);
wxCursor(const wxImage & image) ;
wxCursor(const char **bits) ;
wxCursor(char **bits) ;
wxCursor(const wxString& name, long flags = wxBITMAP_TYPE_MACCURSOR_RESOURCE, wxCursor(const wxString& name, long flags = wxBITMAP_TYPE_MACCURSOR_RESOURCE,
int hotSpotX = 0, int hotSpotY = 0); int hotSpotX = 0, int hotSpotY = 0);
wxCursor(int cursor_type); wxCursor(int cursor_type);
~wxCursor(); ~wxCursor();
virtual bool Ok() const { return (m_refData != NULL && M_CURSORDATA->m_hCursor != NULL ) ; } bool CreateFromXpm(const char **bits) ;
virtual bool Ok() const { return (m_refData != NULL && ( M_CURSORDATA->m_hCursor != NULL || M_CURSORDATA->m_themeCursor != -1 ) ) ; }
inline wxCursor& operator = (const wxCursor& cursor) { if (*this == cursor) return (*this); Ref(cursor); return *this; } 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; }
@@ -67,6 +75,8 @@ public:
void SetHCURSOR(WXHCURSOR cursor); void SetHCURSOR(WXHCURSOR cursor);
inline WXHCURSOR GetHCURSOR() const { return (M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0); } inline WXHCURSOR GetHCURSOR() const { return (M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0); }
private :
void CreateFromImage(const wxImage & image) ;
}; };
extern WXDLLEXPORT void wxSetCursor(const wxCursor& cursor); extern WXDLLEXPORT void wxSetCursor(const wxCursor& cursor);

View File

@@ -43,7 +43,7 @@ class WXDLLEXPORT wxDropSource;
// the icon 'name' from an XPM file under GTK, but will expand to something // the icon 'name' from an XPM file under GTK, but will expand to something
// else under MSW. If you don't use it, you will have to use #ifdef in the // else under MSW. If you don't use it, you will have to use #ifdef in the
// application code. // application code.
#define wxDROP_ICON(name) wxICON(name) #define wxDROP_ICON(X) wxCursor( (const char**) X##_xpm )
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// wxDropTarget // wxDropTarget
@@ -74,19 +74,32 @@ class WXDLLEXPORT wxDropTarget: public wxDropTargetBase
class WXDLLEXPORT wxDropSource: public wxDropSourceBase class WXDLLEXPORT wxDropSource: public wxDropSourceBase
{ {
public: public:
// only left in for binary compatibility
/* constructor. set data later with SetData() */ /* constructor. set data later with SetData() */
wxDropSource( wxWindow *win ,
const wxIcon &copy ,
const wxIcon &move ,
const wxIcon &none );
// only left in for binary compatibility
/* constructor for setting one data object */
wxDropSource( wxDataObject& data,
wxWindow *win,
const wxIcon &copy ,
const wxIcon &move ,
const wxIcon &none );
wxDropSource( wxWindow *win = (wxWindow *)NULL, wxDropSource( wxWindow *win = (wxWindow *)NULL,
const wxIcon &copy = wxNullIcon, const wxCursor &cursorCopy = wxNullCursor,
const wxIcon &move = wxNullIcon, const wxCursor &cursorMove = wxNullCursor,
const wxIcon &none = wxNullIcon); const wxCursor &cursorStop = wxNullCursor);
/* constructor for setting one data object */ /* constructor for setting one data object */
wxDropSource( wxDataObject& data, wxDropSource( wxDataObject& data,
wxWindow *win, wxWindow *win,
const wxIcon &copy = wxNullIcon, const wxCursor &cursorCopy = wxNullCursor,
const wxIcon &move = wxNullIcon, const wxCursor &cursorMove = wxNullCursor,
const wxIcon &none = wxNullIcon); const wxCursor &cursorStop = wxNullCursor);
~wxDropSource(); ~wxDropSource();
@@ -96,6 +109,7 @@ public:
wxWindow* GetWindow() { return m_window ; } wxWindow* GetWindow() { return m_window ; }
void SetCurrentDrag( void* drag ) { m_currentDrag = drag ; } void SetCurrentDrag( void* drag ) { m_currentDrag = drag ; }
void* GetCurrentDrag() { return m_currentDrag ; } void* GetCurrentDrag() { return m_currentDrag ; }
bool MacInstallDefaultCursor(wxDragResult effect) ;
protected : protected :
wxWindow *m_window; wxWindow *m_window;
void* m_currentDrag ; void* m_currentDrag ;