MouseImpl.h revision 677833bc953b6cb418c701facbdcf4aa18d6c44e
0N/A/** @file
2362N/A *
0N/A * VirtualBox COM class implementation
0N/A */
0N/A
0N/A/*
2362N/A * Copyright (C) 2006 InnoTek Systemberatung GmbH
0N/A *
2362N/A * This file is part of VirtualBox Open Source Edition (OSE), as
0N/A * available from http://www.virtualbox.org. This file is free software;
0N/A * you can redistribute it and/or modify it under the terms of the GNU
0N/A * General Public License as published by the Free Software Foundation,
0N/A * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
0N/A * distribution. VirtualBox OSE is distributed in the hope that it will
0N/A * be useful, but WITHOUT ANY WARRANTY of any kind.
0N/A *
0N/A * If you received this file as part of a commercial VirtualBox
0N/A * distribution, then only the terms of your commercial VirtualBox
0N/A * license agreement apply instead of the previous paragraph.
0N/A */
2362N/A
2362N/A#ifndef ____H_MOUSEIMPL
2362N/A#define ____H_MOUSEIMPL
0N/A
0N/A#include "VirtualBoxBase.h"
0N/A#include "ConsoleEvents.h"
0N/A#include "ConsoleImpl.h"
0N/A#include <VBox/pdm.h>
0N/A
0N/A/** Simple mouse event class. */
0N/Aclass MouseEvent
0N/A{
0N/Apublic:
0N/A MouseEvent() : dx(0), dy(0), dz(0), state(-1) {}
0N/A MouseEvent(int _dx, int _dy, int _dz, int _state) :
0N/A dx(_dx), dy(_dy), dz(_dz), state(_state) {}
0N/A bool isValid()
0N/A {
0N/A return state != -1;
0N/A }
0N/A // not logical to be int but that's how it's defined in QEMU
0N/A /** @todo r=bird: and what is the logical declaration then? We'll be using int32_t btw. */
0N/A int dx, dy, dz;
0N/A int state;
0N/A};
0N/A// template instantiation
0N/Atypedef ConsoleEventBuffer<MouseEvent> MouseEventBuffer;
0N/A
0N/Aclass ATL_NO_VTABLE Mouse :
0N/A public VirtualBoxSupportErrorInfoImpl <Mouse, IMouse>,
0N/A public VirtualBoxSupportTranslation <Mouse>,
0N/A public VirtualBoxBase,
0N/A public IMouse
0N/A{
0N/Apublic:
28N/A
28N/A DECLARE_NOT_AGGREGATABLE(Mouse)
28N/A
0N/A DECLARE_PROTECT_FINAL_CONSTRUCT()
0N/A
0N/A BEGIN_COM_MAP(Mouse)
0N/A COM_INTERFACE_ENTRY(ISupportErrorInfo)
0N/A COM_INTERFACE_ENTRY(IMouse)
0N/A END_COM_MAP()
0N/A
0N/A NS_DECL_ISUPPORTS
0N/A
0N/A HRESULT FinalConstruct();
0N/A void FinalRelease();
0N/A
0N/A // public methods only for internal purposes
0N/A HRESULT init(Console *parent);
0N/A void uninit();
0N/A
0N/A // IMouse properties
0N/A STDMETHOD(COMGETTER(AbsoluteSupported)) (BOOL *absoluteSupported);
0N/A STDMETHOD(COMGETTER(NeedsHostCursor)) (BOOL *needsHostCursor);
0N/A
0N/A // IMouse methods
0N/A STDMETHOD(PutMouseEvent)(LONG dx, LONG dy, LONG dz,
0N/A LONG buttonState);
0N/A STDMETHOD(PutMouseEventAbsolute)(LONG x, LONG y, LONG dz,
0N/A LONG buttonState);
0N/A
0N/A // for VirtualBoxSupportErrorInfoImpl
0N/A static const wchar_t *getComponentName() { return L"Mouse"; }
0N/A
0N/A static const PDMDRVREG DrvReg;
0N/A
0N/Aprivate:
0N/A
0N/A static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
0N/A static DECLCALLBACK(int) drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle);
0N/A static DECLCALLBACK(void) drvDestruct(PPDMDRVINS pDrvIns);
0N/A
0N/A ComObjPtr <Console, ComWeakRef> mParent;
0N/A /** Pointer to the associated mouse driver. */
0N/A struct DRVMAINMOUSE *mpDrv;
0N/A
0N/A LONG uHostCaps;
0N/A};
0N/A
0N/A#endif // ____H_MOUSEIMPL
0N/A