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