]>
Commit | Line | Data |
---|---|---|
e9576ca5 SC |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: dnd.cpp | |
3 | // Purpose: wxDropTarget, wxDropSource, wxDataObject implementation | |
4 | // Author: AUTHOR | |
5 | // Modified by: | |
6 | // Created: ??/??/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 1998 AUTHOR | |
9 | // Licence: wxWindows licence | |
10 | /////////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifdef __GNUG__ | |
13 | #pragma implementation "dnd.h" | |
14 | #endif | |
15 | ||
16 | #include "wx/dnd.h" | |
17 | #include "wx/window.h" | |
18 | #include "wx/app.h" | |
19 | #include "wx/gdicmn.h" | |
20 | ||
2f1ae414 SC |
21 | #if wxUSE_DRAG_AND_DROP |
22 | ||
e9576ca5 SC |
23 | // ---------------------------------------------------------------------------- |
24 | // global | |
25 | // ---------------------------------------------------------------------------- | |
26 | ||
27 | // ---------------------------------------------------------------------------- | |
28 | // wxDropTarget | |
29 | // ---------------------------------------------------------------------------- | |
30 | ||
31 | wxDropTarget::wxDropTarget() | |
32 | { | |
33 | }; | |
34 | ||
35 | wxDropTarget::~wxDropTarget() | |
36 | { | |
37 | }; | |
38 | ||
39 | // ---------------------------------------------------------------------------- | |
40 | // wxTextDropTarget | |
41 | // ---------------------------------------------------------------------------- | |
42 | ||
43 | bool wxTextDropTarget::OnDrop( long x, long y, const void *pData ) | |
44 | { | |
45 | OnDropText( x, y, (const char*)pData ); | |
46 | return TRUE; | |
47 | }; | |
48 | ||
49 | bool wxTextDropTarget::OnDropText( long x, long y, const char *psz ) | |
50 | { | |
51 | printf( "Got dropped text: %s.\n", psz ); | |
52 | printf( "At x: %d, y: %d.\n", (int)x, (int)y ); | |
53 | return TRUE; | |
54 | }; | |
55 | ||
56 | size_t wxTextDropTarget::GetFormatCount() const | |
57 | { | |
58 | return 1; | |
59 | } | |
60 | ||
61 | wxDataFormat wxTextDropTarget::GetFormat(size_t WXUNUSED(n)) const | |
62 | { | |
63 | return wxDF_TEXT; | |
64 | } | |
65 | ||
66 | // ---------------------------------------------------------------------------- | |
67 | // wxFileDropTarget | |
68 | // ---------------------------------------------------------------------------- | |
69 | ||
70 | bool wxFileDropTarget::OnDropFiles( long x, long y, size_t nFiles, const char * const WXUNUSED(aszFiles)[] ) | |
71 | { | |
72 | printf( "Got %d dropped files.\n", (int)nFiles ); | |
73 | printf( "At x: %d, y: %d.\n", (int)x, (int)y ); | |
74 | return TRUE; | |
75 | } | |
76 | ||
77 | bool wxFileDropTarget::OnDrop(long x, long y, const void *WXUNUSED(pData) ) | |
78 | { | |
79 | char *str = "/this/is/a/path.txt"; | |
80 | ||
81 | return OnDropFiles(x, y, 1, &str ); | |
82 | } | |
83 | ||
84 | size_t wxFileDropTarget::GetFormatCount() const | |
85 | { | |
86 | return 1; | |
87 | } | |
88 | ||
89 | wxDataFormat wxFileDropTarget::GetFormat(size_t WXUNUSED(n)) const | |
90 | { | |
91 | return wxDF_FILENAME; | |
92 | } | |
93 | ||
94 | //------------------------------------------------------------------------- | |
95 | // wxDropSource | |
96 | //------------------------------------------------------------------------- | |
97 | ||
98 | //----------------------------------------------------------------------------- | |
99 | // drag request | |
100 | ||
101 | wxDropSource::wxDropSource( wxWindow *win ) | |
102 | { | |
103 | // TODO | |
104 | // m_window = win; | |
105 | m_data = NULL; | |
106 | ||
107 | // m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY ); | |
108 | // m_goaheadCursor = wxCursor( wxCURSOR_HAND ); | |
109 | }; | |
110 | ||
111 | wxDropSource::wxDropSource( wxDataObject &data, wxWindow *win ) | |
112 | { | |
113 | // TODO | |
114 | // m_window = win; | |
115 | m_data = &data; | |
116 | ||
117 | // m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY ); | |
118 | // m_goaheadCursor = wxCursor( wxCURSOR_HAND ); | |
119 | }; | |
120 | ||
121 | void wxDropSource::SetData( wxDataObject &data ) | |
122 | { | |
123 | m_data = &data; | |
124 | }; | |
125 | ||
126 | wxDropSource::~wxDropSource(void) | |
127 | { | |
128 | }; | |
129 | ||
130 | wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) ) | |
131 | { | |
132 | // TODO | |
133 | return wxDragError; | |
134 | }; | |
135 | ||
03e11df5 | 136 | #endif |