VirtualBox

source: vbox/trunk/src/VBox/Main/include/MouseImpl.h@ 4753

Last change on this file since 4753 was 4071, checked in by vboxsync, 17 years ago

Biggest check-in ever. New source code headers for all (C) innotek files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.8 KB
Line 
1/** @file
2 *
3 * VirtualBox COM class implementation
4 */
5
6/*
7 * Copyright (C) 2006-2007 innotek GmbH
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License as published by the Free Software Foundation,
13 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14 * distribution. VirtualBox OSE is distributed in the hope that it will
15 * be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef ____H_MOUSEIMPL
19#define ____H_MOUSEIMPL
20
21#include "VirtualBoxBase.h"
22#include "ConsoleEvents.h"
23#include "ConsoleImpl.h"
24#include <VBox/pdmdrv.h>
25
26/** Simple mouse event class. */
27class MouseEvent
28{
29public:
30 MouseEvent() : dx(0), dy(0), dz(0), state(-1) {}
31 MouseEvent(int _dx, int _dy, int _dz, int _state) :
32 dx(_dx), dy(_dy), dz(_dz), state(_state) {}
33 bool isValid()
34 {
35 return state != -1;
36 }
37 // not logical to be int but that's how it's defined in QEMU
38 /** @todo r=bird: and what is the logical declaration then? We'll be using int32_t btw. */
39 int dx, dy, dz;
40 int state;
41};
42// template instantiation
43typedef ConsoleEventBuffer<MouseEvent> MouseEventBuffer;
44
45class ATL_NO_VTABLE Mouse :
46 public VirtualBoxSupportErrorInfoImpl <Mouse, IMouse>,
47 public VirtualBoxSupportTranslation <Mouse>,
48 public VirtualBoxBase,
49 public IMouse
50{
51public:
52
53 DECLARE_NOT_AGGREGATABLE(Mouse)
54
55 DECLARE_PROTECT_FINAL_CONSTRUCT()
56
57 BEGIN_COM_MAP(Mouse)
58 COM_INTERFACE_ENTRY(ISupportErrorInfo)
59 COM_INTERFACE_ENTRY(IMouse)
60 END_COM_MAP()
61
62 NS_DECL_ISUPPORTS
63
64 HRESULT FinalConstruct();
65 void FinalRelease();
66
67 // public methods only for internal purposes
68 HRESULT init(Console *parent);
69 void uninit();
70
71 // IMouse properties
72 STDMETHOD(COMGETTER(AbsoluteSupported)) (BOOL *absoluteSupported);
73 STDMETHOD(COMGETTER(NeedsHostCursor)) (BOOL *needsHostCursor);
74
75 // IMouse methods
76 STDMETHOD(PutMouseEvent)(LONG dx, LONG dy, LONG dz,
77 LONG buttonState);
78 STDMETHOD(PutMouseEventAbsolute)(LONG x, LONG y, LONG dz,
79 LONG buttonState);
80
81 // for VirtualBoxSupportErrorInfoImpl
82 static const wchar_t *getComponentName() { return L"Mouse"; }
83
84 static const PDMDRVREG DrvReg;
85
86private:
87
88 static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
89 static DECLCALLBACK(int) drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle);
90 static DECLCALLBACK(void) drvDestruct(PPDMDRVINS pDrvIns);
91
92 ComObjPtr <Console, ComWeakRef> mParent;
93 /** Pointer to the associated mouse driver. */
94 struct DRVMAINMOUSE *mpDrv;
95
96 LONG uHostCaps;
97};
98
99#endif // ____H_MOUSEIMPL
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