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 MustHaveApp(wxGenericDragImage);
29 %name (DragImage) class wxGenericDragImage : public wxObject
33 wxGenericDragImage(const wxBitmap& image,
34 const wxCursor& cursor = wxNullCursor);
36 %name(DragIcon)wxGenericDragImage(const wxIcon& image,
37 const wxCursor& cursor = wxNullCursor);
39 %name(DragString)wxGenericDragImage(const wxString& str,
40 const wxCursor& cursor = wxNullCursor);
42 %name(DragTreeItem)wxGenericDragImage(const wxPyTreeCtrl& treeCtrl, wxTreeItemId& id);
44 %name(DragListItem)wxGenericDragImage(const wxPyListCtrl& listCtrl, long id);
46 ~wxGenericDragImage();
48 // For efficiency, tell wxGenericDragImage to use a bitmap that's already
49 // created (e.g. from last drag)
50 void SetBackingBitmap(wxBitmap* bitmap);
52 // Begin drag. hotspot is the location of the drag position relative to the upper-left
53 // corner of the image.
54 bool BeginDrag(const wxPoint& hotspot, wxWindow* window,
55 bool fullScreen = False, wxRect* rect = NULL);
57 // Begin drag. hotspot is the location of the drag position relative to the upper-left
58 // corner of the image. This is full screen only. fullScreenRect gives the
59 // position of the window on the screen, to restrict the drag to.
60 %name(BeginDragBounded) bool BeginDrag(const wxPoint& hotspot, wxWindow* window,
61 wxWindow* boundingWindow);
67 // Move the image: call from OnMouseMove. Pt is in window client coordinates if window
68 // is non-NULL, or in screen coordinates if NULL.
69 bool Move(const wxPoint& pt);
79 // TODO, make the rest of these overridable
81 // Override this if you are using a virtual image (drawing your own image)
82 virtual wxRect GetImageRect(const wxPoint& pos) const;
84 // Override this if you are using a virtual image (drawing your own image)
85 virtual bool DoDrawImage(wxDC& dc, const wxPoint& pos) const;
87 // Override this if you wish to draw the window contents to the backing bitmap
88 // yourself. This can be desirable if you wish to avoid flicker by not having to
89 // redraw the window itself before dragging in order to be graphic-minus-dragged-objects.
90 // Instead, paint the drag image's backing bitmap to be correct, and leave the window
91 // to be updated only when dragging the objects away (thus giving a smoother appearance).
92 virtual bool UpdateBackingFromWindow(wxDC& windowDC, wxMemoryDC& destDC,
93 const wxRect& sourceRect, const wxRect& destRect) const;
95 // Erase and redraw simultaneously if possible
96 virtual bool RedrawImage(const wxPoint& oldPos, const wxPoint& newPos, bool eraseOld, bool drawNew);
100 //---------------------------------------------------------------------------
102 wxPyPtrTypeMap_Add("wxDragImage", "wxGenericDragImage");
104 //---------------------------------------------------------------------------