]>
Commit | Line | Data |
---|---|---|
d14a1e28 RD |
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 | ||
ab1f7d2a RD |
27 | MustHaveApp(wxGenericDragImage); |
28 | ||
d14a1e28 RD |
29 | %name (DragImage) class wxGenericDragImage : public wxObject |
30 | { | |
31 | public: | |
32 | ||
33 | wxGenericDragImage(const wxBitmap& image, | |
34 | const wxCursor& cursor = wxNullCursor); | |
35 | ||
36 | %name(DragIcon)wxGenericDragImage(const wxIcon& image, | |
37 | const wxCursor& cursor = wxNullCursor); | |
38 | ||
39 | %name(DragString)wxGenericDragImage(const wxString& str, | |
40 | const wxCursor& cursor = wxNullCursor); | |
41 | ||
dd9f7fea | 42 | %name(DragTreeItem)wxGenericDragImage(const wxPyTreeCtrl& treeCtrl, wxTreeItemId& id); |
d14a1e28 | 43 | |
dd9f7fea | 44 | %name(DragListItem)wxGenericDragImage(const wxPyListCtrl& listCtrl, long id); |
d14a1e28 RD |
45 | |
46 | ~wxGenericDragImage(); | |
47 | ||
48 | // For efficiency, tell wxGenericDragImage to use a bitmap that's already | |
49 | // created (e.g. from last drag) | |
50 | void SetBackingBitmap(wxBitmap* bitmap); | |
51 | ||
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, | |
a72f4631 | 55 | bool fullScreen = false, wxRect* rect = NULL); |
d14a1e28 RD |
56 | |
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); | |
62 | ||
63 | ||
64 | // End drag | |
65 | bool EndDrag(); | |
66 | ||
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); | |
70 | ||
71 | ||
72 | // Show the image | |
73 | bool Show(); | |
74 | ||
75 | // Hide the image | |
76 | bool Hide(); | |
77 | ||
78 | ||
79 | // TODO, make the rest of these overridable | |
80 | ||
81 | // Override this if you are using a virtual image (drawing your own image) | |
82 | virtual wxRect GetImageRect(const wxPoint& pos) const; | |
83 | ||
84 | // Override this if you are using a virtual image (drawing your own image) | |
85 | virtual bool DoDrawImage(wxDC& dc, const wxPoint& pos) const; | |
86 | ||
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; | |
94 | ||
95 | // Erase and redraw simultaneously if possible | |
96 | virtual bool RedrawImage(const wxPoint& oldPos, const wxPoint& newPos, bool eraseOld, bool drawNew); | |
97 | }; | |
98 | ||
99 | ||
100 | //--------------------------------------------------------------------------- | |
101 | %init %{ | |
102 | wxPyPtrTypeMap_Add("wxDragImage", "wxGenericDragImage"); | |
103 | %} | |
104 | //--------------------------------------------------------------------------- |