VirtualBox

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

Last change on this file since 75401 was 74211, checked in by vboxsync, 6 years ago

DnD/HostService: Renaming, documentation.

  • 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-2018 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_HostService_DnD_dndmanager_h
18#define ___VBox_HostService_DnD_dndmanager_h
19
20#include <VBox/GuestHost/DragAndDrop.h>
21#include <VBox/HostServices/Service.h>
22#include <VBox/HostServices/DragAndDropSvc.h>
23
24#include <iprt/cpp/ministring.h>
25#include <iprt/cpp/list.h>
26
27typedef DECLCALLBACK(int) FNDNDPROGRESS(uint32_t uState, uint32_t uPercentage, int rc, void *pvUser);
28typedef FNDNDPROGRESS *PFNDNDPROGRESS;
29
30/**
31 * DnD message class. This class forms the base of all other more specialized
32 * message classes.
33 */
34class DnDMessage : public HGCM::Message
35{
36public:
37
38 DnDMessage(void)
39 {
40 }
41
42 DnDMessage(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM aParms[])
43 : Message(uMsg, cParms, aParms) { }
44
45 virtual ~DnDMessage(void) { }
46};
47
48/**
49 * DnD message class for generic messages which didn't need any special
50 * handling.
51 */
52class DnDGenericMessage: public DnDMessage
53{
54public:
55 DnDGenericMessage(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
56 : DnDMessage(uMsg, cParms, paParms) { }
57};
58
59/**
60 * DnD message class for informing the guest to cancel any current (and pending) activities.
61 */
62class DnDHGCancelMessage: public DnDMessage
63{
64public:
65
66 DnDHGCancelMessage(void)
67 {
68 int rc2 = initData(DragAndDropSvc::HOST_DND_HG_EVT_CANCEL,
69 0 /* cParms */, 0 /* aParms */);
70 AssertRC(rc2);
71 }
72};
73
74/**
75 * DnD manager. Manage creation and queuing of messages for the various DnD
76 * messages types.
77 */
78class DnDManager
79{
80public:
81
82 DnDManager(PFNDNDPROGRESS pfnProgressCallback, void *pvProgressUser)
83 : m_pfnProgressCallback(pfnProgressCallback)
84 , m_pvProgressUser(pvProgressUser)
85 {}
86
87 virtual ~DnDManager(void)
88 {
89 Reset();
90 }
91
92 int AddMsg(DnDMessage *pMessage, bool fAppend = true);
93 int AddMsg(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[], bool fAppend = true);
94
95 int GetNextMsgInfo(uint32_t *puType, uint32_t *pcParms);
96 int GetNextMsg(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
97
98 void Reset(void);
99
100protected:
101
102 /** DnD message queue (FIFO). */
103 RTCList<DnDMessage *> m_queueMsg;
104 /** Pointer to host progress callback. Optional, can be NULL. */
105 PFNDNDPROGRESS m_pfnProgressCallback;
106 /** Pointer to progress callback user context. Can be NULL if not used. */
107 void *m_pvProgressUser;
108};
109#endif /* ___VBox_HostService_DnD_dndmanager_h */
110
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