]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/ole/dropsrc.h
1. wxPostEvent added and documented
[wxWidgets.git] / include / wx / msw / ole / dropsrc.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: ole/dropsrc.h
3 // Purpose: declaration of the wxDropSource class
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 06.03.98
7 // RCS-ID: $Id$
8 // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_OLEDROPSRC_H
13 #define _WX_OLEDROPSRC_H
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #if !wxUSE_DRAG_AND_DROP
20 #error "You should #define wxUSE_DRAG_AND_DROP to 1 to compile this file!"
21 #endif //WX_DRAG_DROP
22
23 // ----------------------------------------------------------------------------
24 // forward declarations
25 // ----------------------------------------------------------------------------
26
27 class wxIDropSource;
28 class WXDLLEXPORT wxDataObject;
29 class WXDLLEXPORT wxWindow;
30
31 // ----------------------------------------------------------------------------
32 // constants
33 // ----------------------------------------------------------------------------
34
35 enum wxDragResult
36 {
37 wxDragError, // error prevented the d&d operation from completing
38 wxDragNone, // drag target didn't accept the data
39 wxDragCopy, // the data was successfully copied
40 wxDragMove, // the data was successfully moved
41 wxDragCancel // the operation was cancelled by user (not an error)
42 };
43
44 // ----------------------------------------------------------------------------
45 // wxDropSource is used to start the drag-&-drop operation on associated
46 // wxDataObject object. It's responsible for giving UI feedback while dragging.
47 // ----------------------------------------------------------------------------
48
49 class WXDLLEXPORT wxDropSource
50 {
51 public:
52 // ctors: if you use default ctor you must call SetData() later!
53 // NB: the "wxWindow *win" parameter is unused and is here only for wxGTK
54 // compatibility, as well as both icon parameters
55 wxDropSource(wxWindow *win = NULL,
56 const wxIcon &go = wxNullIcon,
57 const wxIcon &stop = wxNullIcon );
58 wxDropSource(wxDataObject& data,
59 wxWindow *win = NULL,
60 const wxIcon &go = wxNullIcon,
61 const wxIcon &stop = wxNullIcon );
62
63 void SetData(wxDataObject& data);
64
65 virtual ~wxDropSource();
66
67 // do it (call this in response to a mouse button press, for example)
68 // params: if bAllowMove is false, data can be only copied
69 wxDragResult DoDragDrop(bool bAllowMove = FALSE);
70
71 // overridable: you may give some custom UI feedback during d&d operation
72 // in this function (it's called on each mouse move, so it shouldn't be too
73 // slow). Just return false if you want default feedback.
74 virtual bool GiveFeedback(wxDragResult effect, bool bScrolling);
75
76 protected:
77 void Init();
78
79 wxDataObject *m_pData; // pointer to associated data object
80
81 private:
82 wxIDropSource *m_pIDropSource; // the pointer to COM interface
83 };
84
85 #endif //_WX_OLEDROPSRC_H