1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG defs for wxDragImage
7 // Created: 18-June-1999
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
16 //---------------------------------------------------------------------------
20 #include <wx/generic/dragimgg.h>
23 //---------------------------------------------------------------------------
27 %name (DragImage) class wxGenericDragImage : public wxObject
31 wxGenericDragImage(const wxBitmap& image,
32 const wxCursor& cursor = wxNullCursor);
34 %name(DragIcon)wxGenericDragImage(const wxIcon& image,
35 const wxCursor& cursor = wxNullCursor);
37 %name(DragString)wxGenericDragImage(const wxString& str,
38 const wxCursor& cursor = wxNullCursor);
40 %name(DragTreeItem)wxGenericDragImage(const wxPyTreeCtrl& treeCtrl, wxTreeItemId& id);
42 %name(DragListItem)wxGenericDragImage(const wxPyListCtrl& listCtrl, long id);
44 ~wxGenericDragImage();
46 // For efficiency, tell wxGenericDragImage to use a bitmap that's already
47 // created (e.g. from last drag)
48 void SetBackingBitmap(wxBitmap* bitmap);
50 // Begin drag. hotspot is the location of the drag position relative to the upper-left
51 // corner of the image.
52 bool BeginDrag(const wxPoint& hotspot, wxWindow* window,
53 bool fullScreen = False, wxRect* rect = NULL);
55 // Begin drag. hotspot is the location of the drag position relative to the upper-left
56 // corner of the image. This is full screen only. fullScreenRect gives the
57 // position of the window on the screen, to restrict the drag to.
58 %name(BeginDragBounded) bool BeginDrag(const wxPoint& hotspot, wxWindow* window,
59 wxWindow* boundingWindow);
65 // Move the image: call from OnMouseMove. Pt is in window client coordinates if window
66 // is non-NULL, or in screen coordinates if NULL.
67 bool Move(const wxPoint& pt);
77 // TODO, make the rest of these overridable
79 // Override this if you are using a virtual image (drawing your own image)
80 virtual wxRect GetImageRect(const wxPoint& pos) const;
82 // Override this if you are using a virtual image (drawing your own image)
83 virtual bool DoDrawImage(wxDC& dc, const wxPoint& pos) const;
85 // Override this if you wish to draw the window contents to the backing bitmap
86 // yourself. This can be desirable if you wish to avoid flicker by not having to
87 // redraw the window itself before dragging in order to be graphic-minus-dragged-objects.
88 // Instead, paint the drag image's backing bitmap to be correct, and leave the window
89 // to be updated only when dragging the objects away (thus giving a smoother appearance).
90 virtual bool UpdateBackingFromWindow(wxDC& windowDC, wxMemoryDC& destDC,
91 const wxRect& sourceRect, const wxRect& destRect) const;
93 // Erase and redraw simultaneously if possible
94 virtual bool RedrawImage(const wxPoint& oldPos, const wxPoint& newPos, bool eraseOld, bool drawNew);
98 //---------------------------------------------------------------------------
100 wxPyPtrTypeMap_Add("wxDragImage", "wxGenericDragImage");
102 //---------------------------------------------------------------------------