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