VirtualBox

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

Last change on this file since 18622 was 14949, checked in by vboxsync, 16 years ago

Appended vim modeline to set tabstop and expand tabs (in the way
suggested by our coding guidelines).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
Line 
1/* $Id: KeyboardImpl.h 14949 2008-12-03 15:17:16Z 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 VirtualBoxBaseNEXT,
51 public VirtualBoxSupportErrorInfoImpl <Keyboard, IKeyboard>,
52 public VirtualBoxSupportTranslation <Keyboard>,
53 public 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 END_COM_MAP()
68
69 NS_DECL_ISUPPORTS
70
71 DECLARE_EMPTY_CTOR_DTOR (Keyboard)
72
73 HRESULT FinalConstruct();
74 void FinalRelease();
75
76 // public initializer/uninitializer for internal purposes only
77 HRESULT init (Console *aParent);
78 void uninit();
79
80 STDMETHOD(PutScancode)(LONG scancode);
81 STDMETHOD(PutScancodes)(ComSafeArrayIn (LONG, scancodes),
82 ULONG *codesStored);
83 STDMETHOD(PutCAD)();
84
85 // for VirtualBoxSupportErrorInfoImpl
86 static const wchar_t *getComponentName() { return L"Keyboard"; }
87
88 static const PDMDRVREG DrvReg;
89
90 Console *getParent() const
91 {
92 return mParent;
93 }
94
95private:
96
97 static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
98 static DECLCALLBACK(int) drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle);
99 static DECLCALLBACK(void) drvDestruct(PPDMDRVINS pDrvIns);
100
101 const ComObjPtr <Console, ComWeakRef> mParent;
102 /** Pointer to the associated keyboard driver. */
103 struct DRVMAINKEYBOARD *mpDrv;
104 /** Pointer to the device instance for the VMM Device. */
105 PPDMDEVINS mpVMMDev;
106 /** Set after the first attempt to find the VMM Device. */
107 bool mfVMMDevInited;
108};
109
110#endif // ____H_KEYBOARDIMPL
111/* 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