]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_dragimg.i
reSWIGged
[wxWidgets.git] / wxPython / src / _dragimg.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: _dragimg.i
3 // Purpose: SWIG defs for wxDragImage
4 //
5 // Author: Robin Dunn
6 //
7 // Created: 18-June-1999
8 // RCS-ID: $Id$
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13 // Not a %module
14
15
16 //---------------------------------------------------------------------------
17 %newgroup
18
19 %{
20 #include <wx/generic/dragimgg.h>
21 %}
22
23 //---------------------------------------------------------------------------
24
25
26
27 MustHaveApp(wxGenericDragImage);
28
29 %rename (DragImage) wxGenericDragImage;
30 class wxGenericDragImage : public wxObject
31 {
32 public:
33
34 wxGenericDragImage(const wxBitmap& image,
35 const wxCursor& cursor = wxNullCursor);
36
37 %RenameCtor(DragIcon, wxGenericDragImage(const wxIcon& image,
38 const wxCursor& cursor = wxNullCursor));
39
40 %RenameCtor(DragString, wxGenericDragImage(const wxString& str,
41 const wxCursor& cursor = wxNullCursor));
42
43 %RenameCtor(DragTreeItem, wxGenericDragImage(const wxPyTreeCtrl& treeCtrl, wxTreeItemId& id));
44
45 %RenameCtor(DragListItem, wxGenericDragImage(const wxPyListCtrl& listCtrl, long id));
46
47 ~wxGenericDragImage();
48
49 // For efficiency, tell wxGenericDragImage to use a bitmap that's already
50 // created (e.g. from last drag)
51 void SetBackingBitmap(wxBitmap* bitmap);
52
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);
57
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));
63
64
65 // End drag
66 bool EndDrag();
67
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);
71
72
73 // Show the image
74 bool Show();
75
76 // Hide the image
77 bool Hide();
78
79
80 // TODO, make the rest of these overridable
81
82 // Override this if you are using a virtual image (drawing your own image)
83 virtual wxRect GetImageRect(const wxPoint& pos) const;
84
85 // Override this if you are using a virtual image (drawing your own image)
86 virtual bool DoDrawImage(wxDC& dc, const wxPoint& pos) const;
87
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;
95
96 // Erase and redraw simultaneously if possible
97 virtual bool RedrawImage(const wxPoint& oldPos, const wxPoint& newPos, bool eraseOld, bool drawNew);
98
99 %property(ImageRect, GetImageRect, doc="See `GetImageRect`");
100 };
101
102
103 //---------------------------------------------------------------------------
104 %init %{
105 wxPyPtrTypeMap_Add("wxDragImage", "wxGenericDragImage");
106 %}
107 //---------------------------------------------------------------------------