VirtualBox

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

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

API: big medium handling change and lots of assorted other cleanups and fixes

  • 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 23223 2009-09-22 15:50:03Z 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 DECLARE_EMPTY_CTOR_DTOR (Keyboard)
71
72 HRESULT FinalConstruct();
73 void FinalRelease();
74
75 // public initializer/uninitializer for internal purposes only
76 HRESULT init (Console *aParent);
77 void uninit();
78
79 STDMETHOD(PutScancode)(LONG scancode);
80 STDMETHOD(PutScancodes)(ComSafeArrayIn (LONG, scancodes),
81 ULONG *codesStored);
82 STDMETHOD(PutCAD)();
83
84 // for VirtualBoxSupportErrorInfoImpl
85 static const wchar_t *getComponentName() { return L"Keyboard"; }
86
87 static const PDMDRVREG DrvReg;
88
89 Console *getParent() const
90 {
91 return mParent;
92 }
93
94private:
95
96 static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
97 static DECLCALLBACK(int) drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags);
98 static DECLCALLBACK(void) drvDestruct(PPDMDRVINS pDrvIns);
99
100 const ComObjPtr<Console, ComWeakRef> mParent;
101 /** Pointer to the associated keyboard driver. */
102 struct DRVMAINKEYBOARD *mpDrv;
103 /** Pointer to the device instance for the VMM Device. */
104 PPDMDEVINS mpVMMDev;
105 /** Set after the first attempt to find the VMM Device. */
106 bool mfVMMDevInited;
107};
108
109#endif // ____H_KEYBOARDIMPL
110/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use