1
/*********************************************************
2
* Copyright (C) 2007 VMware, Inc. All rights reserved.
4
* This program is free software; you can redistribute it and/or modify it
5
* under the terms of the GNU Lesser General Public License as published
6
* by the Free Software Foundation version 2.1 and no later version.
8
* This program is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10
* or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public
11
* License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program; if not, write to the Free Software Foundation, Inc.,
15
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17
*********************************************************/
22
* Base object for DnD. This is the common interface between UI and
23
* cui DnD protocol layer. Both host side and guest side, and also
24
* different platforms, share this same interface.
30
#include <sigc++/connection.h>
35
* LIB_EXPORT definition is not needed on guest.
40
* The interface class on host side for Windows is in dll which needs
41
* LIB_EXPORT definition.
43
# include "libExport.hh"
48
#include "unityCommon.h"
51
class LIB_EXPORT DnDBase
54
virtual ~DnDBase(void) {};
56
/* sigc signals for local UI callbacks. */
57
/* Local UI as DnD source. */
58
sigc::signal<void, const CPClipboard*> dragExitChanged;
59
sigc::signal<void> dndUngrabChanged; /* X11's notion of ungrab. */
60
sigc::signal<void, bool, std::vector<uint8> > fileCopyDoneChanged;
61
sigc::signal<void> sourceDropChanged;
62
sigc::signal<void> sourceCancelChanged;
63
sigc::signal<void, const CPClipboard*, std::string> dragStartChanged;
65
/* Local UI as DnD target. */
66
sigc::signal<void, DND_DROPEFFECT> updateFeedbackChanged;
67
sigc::signal<void, bool, int, int> updateDetWndChanged;
68
sigc::signal<void, bool, uint32, bool> updateUnityDetWndChanged;
69
sigc::signal<void, int32, int32> targetPrivateDropChanged;
71
sigc::signal<void> reset;
72
sigc::signal<void> disable;
73
sigc::signal<void> enable;
74
sigc::signal<void, int, int> updateMouseChanged;
75
sigc::signal<void> moveDetWndToMousePos;
77
/* Guest cancel signals. */
78
sigc::signal<void> ghCancel;
80
/* cui DnD protocol layer API exposed to UI (all platforms). */
82
/* Local UI as DnD source. */
83
virtual void UpdateUnityDetWnd(bool bShow, uint32 unityWndId) {};
84
virtual void DragLeave(int32 x, int32 y) = 0;
85
virtual void SourceCancel(void) = 0;
86
virtual void SourceDrop(DND_DROPEFFECT feedback) = 0;
88
/* Local UI as DnD target. */
89
virtual void DragEnter(const CPClipboard* clip) = 0;
91
virtual void SetMouse(int32 x, int32 y, bool down = true) = 0;
93
virtual void SetFeedback(DND_DROPEFFECT feedback) = 0;
94
virtual void TargetCancel(void) = 0;
95
virtual void TargetDrop(const CPClipboard *clip,
99
const CPClipboard* GetClipboard(void) { return &mClipboard; }
101
virtual bool IsDnDAllowed(void) = 0;
105
* For details about state machine definition, please refer to
106
* https://wiki.eng.vmware.com/ToolsDnDV3FlowChart
109
DNDSTATE_INVALID = 0,
114
DNDSTATE_DRAGGING_INSIDE,
116
DNDSTATE_QUERY_EXITING,
117
DNDSTATE_UNGRABING, // ask mks to ungrab, v2 only
118
DNDSTATE_DRAGGING_OUTSIDE,
119
DNDSTATE_DRAGGING_PRIVATE,
123
DND_DROPEFFECT mFeedback;
124
CPClipboard mClipboard;