VirtualBox

source: vbox/trunk/src/VBox/HostServices/DragAndDrop/dndmanager.h@ 97436

Last change on this file since 97436 was 96407, checked in by vboxsync, 2 years ago

scm copyright and license note update

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.3 KB
Line 
1/** @file
2 * Drag and Drop manager.
3 */
4
5/*
6 * Copyright (C) 2011-2022 Oracle and/or its affiliates.
7 *
8 * This file is part of VirtualBox base platform packages, as
9 * available from https://www.virtualbox.org.
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation, in version 3 of the
14 * License.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, see <https://www.gnu.org/licenses>.
23 *
24 * SPDX-License-Identifier: GPL-3.0-only
25 */
26
27#ifndef VBOX_INCLUDED_SRC_DragAndDrop_dndmanager_h
28#define VBOX_INCLUDED_SRC_DragAndDrop_dndmanager_h
29#ifndef RT_WITHOUT_PRAGMA_ONCE
30# pragma once
31#endif
32
33#include <VBox/GuestHost/DragAndDrop.h>
34#include <VBox/HostServices/Service.h>
35#include <VBox/HostServices/DragAndDropSvc.h>
36
37#include <iprt/cpp/ministring.h>
38#include <iprt/cpp/list.h>
39
40typedef DECLCALLBACKTYPE(int, FNDNDPROGRESS,(uint32_t uState, uint32_t uPercentage, int rc, void *pvUser));
41typedef FNDNDPROGRESS *PFNDNDPROGRESS;
42
43/**
44 * DnD message class. This class forms the base of all other more specialized
45 * message classes.
46 */
47class DnDMessage : public HGCM::Message
48{
49public:
50
51 DnDMessage(void)
52 {
53 }
54
55 DnDMessage(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM aParms[])
56 : Message(uMsg, cParms, aParms) { }
57
58 virtual ~DnDMessage(void) { }
59};
60
61/**
62 * DnD message class for generic messages which didn't need any special
63 * handling.
64 */
65class DnDGenericMessage: public DnDMessage
66{
67public:
68 DnDGenericMessage(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
69 : DnDMessage(uMsg, cParms, paParms) { }
70};
71
72/**
73 * DnD message class for informing the guest to cancel any current (and pending) activities.
74 */
75class DnDHGCancelMessage: public DnDMessage
76{
77public:
78
79 DnDHGCancelMessage(void)
80 {
81 int rc2 = initData(DragAndDropSvc::HOST_DND_FN_CANCEL,
82 0 /* cParms */, 0 /* aParms */);
83 AssertRC(rc2);
84 }
85};
86
87/**
88 * DnD manager. Manage creation and queuing of messages for the various DnD
89 * messages types.
90 */
91class DnDManager
92{
93public:
94
95 DnDManager(PFNDNDPROGRESS pfnProgressCallback, void *pvProgressUser)
96 : m_pfnProgressCallback(pfnProgressCallback)
97 , m_pvProgressUser(pvProgressUser)
98 {}
99
100 virtual ~DnDManager(void)
101 {
102 Reset();
103 }
104
105 int AddMsg(DnDMessage *pMessage, bool fAppend = true);
106 int AddMsg(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[], bool fAppend = true);
107
108 int GetNextMsgInfo(uint32_t *puType, uint32_t *pcParms);
109 int GetNextMsg(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
110
111 void Reset(void);
112
113protected:
114
115 /** DnD message queue (FIFO). */
116 RTCList<DnDMessage *> m_queueMsg;
117 /** Pointer to host progress callback. Optional, can be NULL. */
118 PFNDNDPROGRESS m_pfnProgressCallback;
119 /** Pointer to progress callback user context. Can be NULL if not used. */
120 void *m_pvProgressUser;
121};
122#endif /* !VBOX_INCLUDED_SRC_DragAndDrop_dndmanager_h */
123
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette