VirtualBox

source: vbox/trunk/src/VBox/Main/include/KeyboardImpl.h@ 22277

Last change on this file since 22277 was 22277, checked in by vboxsync, 15 years ago

PDMDRVREG change (big changeset).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.1 KB
Line 
1/* $Id: KeyboardImpl.h 22277 2009-08-16 21:12:50Z vboxsync $ */
2
3/** @file
4 *
5 * VirtualBox COM class implementation
6 */
7
8/*
9 * Copyright (C) 2006-2008 Sun Microsystems, Inc.
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.virtualbox.org. This file is free software;
13 * you can redistribute it and/or modify it under the terms of the GNU
14 * General Public License (GPL) as published by the Free Software
15 * Foundation, in version 2 as it comes in the "COPYING" file of the
16 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 *
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
20 * Clara, CA 95054 USA or visit http://www.sun.com if you need
21 * additional information or have any questions.
22 */
23
24#ifndef ____H_KEYBOARDIMPL
25#define ____H_KEYBOARDIMPL
26
27#include "VirtualBoxBase.h"
28#include "ConsoleEvents.h"
29
30#include <VBox/pdmdrv.h>
31
32/** Simple keyboard event class. */
33class KeyboardEvent
34{
35public:
36 KeyboardEvent() : scan(-1) {}
37 KeyboardEvent(int _scan) : scan(_scan) {}
38 bool isValid()
39 {
40 return (scan & ~0x80) && !(scan & ~0xFF);
41 }
42 int scan;
43};
44// template instantiation
45typedef ConsoleEventBuffer<KeyboardEvent> KeyboardEventBuffer;
46
47class Console;
48
49class ATL_NO_VTABLE Keyboard :
50 public VirtualBoxBase,
51 public VirtualBoxSupportErrorInfoImpl<Keyboard, IKeyboard>,
52 public VirtualBoxSupportTranslation<Keyboard>,
53 VBOX_SCRIPTABLE_IMPL(IKeyboard)
54{
55
56public:
57
58 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (Keyboard)
59
60 DECLARE_NOT_AGGREGATABLE(Keyboard)
61
62 DECLARE_PROTECT_FINAL_CONSTRUCT()
63
64 BEGIN_COM_MAP(Keyboard)
65 COM_INTERFACE_ENTRY(ISupportErrorInfo)
66 COM_INTERFACE_ENTRY(IKeyboard)
67 COM_INTERFACE_ENTRY(IDispatch)
68 END_COM_MAP()
69
70 NS_DECL_ISUPPORTS
71
72 DECLARE_EMPTY_CTOR_DTOR (Keyboard)
73
74 HRESULT FinalConstruct();
75 void FinalRelease();
76
77 // public initializer/uninitializer for internal purposes only
78 HRESULT init (Console *aParent);
79 void uninit();
80
81 STDMETHOD(PutScancode)(LONG scancode);
82 STDMETHOD(PutScancodes)(ComSafeArrayIn (LONG, scancodes),
83 ULONG *codesStored);
84 STDMETHOD(PutCAD)();
85
86 // for VirtualBoxSupportErrorInfoImpl
87 static const wchar_t *getComponentName() { return L"Keyboard"; }
88
89 static const PDMDRVREG DrvReg;
90
91 Console *getParent() const
92 {
93 return mParent;
94 }
95
96private:
97
98 static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
99 static DECLCALLBACK(int) drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags);
100 static DECLCALLBACK(void) drvDestruct(PPDMDRVINS pDrvIns);
101
102 const ComObjPtr<Console, ComWeakRef> mParent;
103 /** Pointer to the associated keyboard driver. */
104 struct DRVMAINKEYBOARD *mpDrv;
105 /** Pointer to the device instance for the VMM Device. */
106 PPDMDEVINS mpVMMDev;
107 /** Set after the first attempt to find the VMM Device. */
108 bool mfVMMDevInited;
109};
110
111#endif // ____H_KEYBOARDIMPL
112/* vi: set tabstop=4 shiftwidth=4 expandtab: */
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