X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/925e9792d32e353233985f53a4845f154e455a58..69a05ef6d65a4450f9e929a22bbf96ddcde916f3:/samples/dragimag/dragimag.h diff --git a/samples/dragimag/dragimag.h b/samples/dragimag/dragimag.h index cdc1baa912..e70fc5faf5 100644 --- a/samples/dragimag/dragimag.h +++ b/samples/dragimag/dragimag.h @@ -128,7 +128,7 @@ public: //// Operations bool HitTest(const wxPoint& pt) const; - bool Draw(wxDC& dc, int op = wxCOPY); + bool Draw(wxDC& dc, bool highlight = false); //// Accessors @@ -153,5 +153,39 @@ protected: bool m_show; }; +// MyDragImage +// A derived class is required since we're overriding UpdateBackingFromWindow, +// for compatibility with Mac OS X (Core Graphics) which does not support blitting +// from a window. + +class MyDragImage: public wxDragImage +{ +public: + MyDragImage(MyCanvas* canvas): m_canvas(canvas) {} + + MyDragImage(MyCanvas* canvas, const wxBitmap& image, const wxCursor& cursor = wxNullCursor): + wxDragImage(image, cursor), m_canvas(canvas) + { + } + + MyDragImage(MyCanvas* canvas, const wxIcon& image, const wxCursor& cursor = wxNullCursor): + wxDragImage(image, cursor), m_canvas(canvas) + { + } + + MyDragImage(MyCanvas* canvas, const wxString& str, const wxCursor& cursor = wxNullCursor): + wxDragImage(str, cursor), m_canvas(canvas) + { + } + + // On some platforms, notably Mac OS X with Core Graphics, we can't blit from + // a window, so we need to draw the background explicitly. + virtual bool UpdateBackingFromWindow(wxDC& windowDC, wxMemoryDC& destDC, const wxRect& sourceRect, + const wxRect& destRect) const; + +protected: + MyCanvas* m_canvas; +}; + #endif // _WX_DRAGIMAGSAMPLE_