Fix to wxGenericDragImage inefficiency

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7615 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2000-06-20 19:35:11 +00:00
parent f7585687b2
commit 3a3377d7bf
5 changed files with 79 additions and 19 deletions

View File

@@ -97,7 +97,11 @@ public:
// Ctors & dtor
////////////////////////////////////////////////////////////////////////////
wxGenericDragImage();
wxGenericDragImage(const wxCursor& cursor = wxNullCursor, const wxPoint& hotspot = wxPoint(0, 0))
{
Init();
Create(cursor, hotspot);
}
wxGenericDragImage(const wxBitmap& image, const wxCursor& cursor = wxNullCursor, const wxPoint& hotspot = wxPoint(0, 0))
{
Init();
@@ -136,6 +140,9 @@ public:
// Operations
////////////////////////////////////////////////////////////////////////////
// Create a drag image with a virtual image (need to override DoDrawImage, GetImageRect)
bool Create(const wxCursor& cursor = wxNullCursor, const wxPoint& hotspot = wxPoint(0, 0));
// Create a drag image from a bitmap and optional cursor
bool Create(const wxBitmap& image, const wxCursor& cursor = wxNullCursor, const wxPoint& hotspot = wxPoint(0, 0));
@@ -178,10 +185,14 @@ public:
void Init();
wxRect GetImageRect(const wxPoint& pos) const;
// Override this if you are using a virtual image (drawing your own image)
virtual wxRect GetImageRect(const wxPoint& pos) const;
// Override this if you are using a virtual image (drawing your own image)
virtual bool DoDrawImage(wxDC& dc, const wxPoint& pos) const;
// Erase and redraw simultaneously if possible
bool RedrawImage(const wxPoint& oldPos, const wxPoint& newPos, bool eraseOld, bool drawNew);
virtual bool RedrawImage(const wxPoint& oldPos, const wxPoint& newPos, bool eraseOld, bool drawNew);
protected:
wxBitmap m_bitmap;