Removed dependence on wxClientDC and blitting from a window,

for compatibility with Mac OS X in Core Graphics mode.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41803 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2006-10-09 15:15:13 +00:00
parent 2b741a391c
commit aa7a6a0e5c
2 changed files with 80 additions and 26 deletions

View File

@@ -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_