VirtualBox

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

Last change on this file since 76573 was 76570, checked in by vboxsync, 6 years ago

HostServices: Use VBOX_INCLUDED_SRC_ as header guard prefix with scm.

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