X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/11e2dfd37dcac4e8c155807de8e1ba222c3e83fb..d7c37bdf337d7ca687263520de432eee4a3722db:/samples/dragimag/dragimag.h diff --git a/samples/dragimag/dragimag.h b/samples/dragimag/dragimag.h index bba436184e..391495d5a7 100644 --- a/samples/dragimag/dragimag.h +++ b/samples/dragimag/dragimag.h @@ -4,7 +4,6 @@ // Author: Julian Smart // Modified by: // Created: 28/2/2000 -// RCS-ID: $Id$ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -46,6 +45,7 @@ class MyApp: public wxApp public: MyApp(); virtual bool OnInit(); + virtual int OnExit(); //// Operations @@ -122,12 +122,12 @@ class DragShape: public wxObject { public: DragShape(const wxBitmap& bitmap); - ~DragShape(); + ~DragShape(){}; //// Operations bool HitTest(const wxPoint& pt) const; - bool Draw(wxDC& dc, int op = wxCOPY); + bool Draw(wxDC& dc, bool highlight = false); //// Accessors @@ -152,5 +152,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_