VirtualBox

source: vbox/trunk/src/VBox/Main/include/KeyboardImpl.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.7 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_KEYBOARDIMPL
19#define ____H_KEYBOARDIMPL
20
21#include "VirtualBoxBase.h"
22#include "ConsoleEvents.h"
23#include <VBox/pdmdrv.h>
24
25/** Simple keyboard event class. */
26class KeyboardEvent
27{
28public:
29 KeyboardEvent() : scan(-1) {}
30 KeyboardEvent(int _scan) : scan(_scan) {}
31 bool isValid()
32 {
33 return (scan & ~0x80) && !(scan & ~0xFF);
34 }
35 int scan;
36};
37// template instantiation
38typedef ConsoleEventBuffer<KeyboardEvent> KeyboardEventBuffer;
39
40class Console;
41
42class ATL_NO_VTABLE Keyboard :
43 public VirtualBoxSupportErrorInfoImpl <Keyboard, IKeyboard>,
44 public VirtualBoxSupportTranslation <Keyboard>,
45 public VirtualBoxBase,
46 public IKeyboard
47{
48
49public:
50
51 DECLARE_NOT_AGGREGATABLE(Keyboard)
52
53 DECLARE_PROTECT_FINAL_CONSTRUCT()
54
55 BEGIN_COM_MAP(Keyboard)
56 COM_INTERFACE_ENTRY(ISupportErrorInfo)
57 COM_INTERFACE_ENTRY(IKeyboard)
58 END_COM_MAP()
59
60 NS_DECL_ISUPPORTS
61
62 HRESULT FinalConstruct();
63 void FinalRelease();
64
65 // public methods only for internal purposes
66 HRESULT init (Console *parent);
67 void uninit();
68
69 STDMETHOD(PutScancode)(LONG scancode);
70 STDMETHOD(PutScancodes)(LONG *scancodes,
71 ULONG count,
72 ULONG *codesStored);
73 STDMETHOD(PutCAD)();
74
75 // for VirtualBoxSupportErrorInfoImpl
76 static const wchar_t *getComponentName() { return L"Keyboard"; }
77
78 static const PDMDRVREG DrvReg;
79
80 Console *getParent()
81 {
82 return mParent;
83 }
84
85private:
86
87 static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
88 static DECLCALLBACK(int) drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle);
89 static DECLCALLBACK(void) drvDestruct(PPDMDRVINS pDrvIns);
90
91 ComObjPtr <Console, ComWeakRef> mParent;
92 /** Pointer to the associated keyboard driver. */
93 struct DRVMAINKEYBOARD *mpDrv;
94 /** Pointer to the device instance for the VMM Device. */
95 PPDMDEVINS mpVMMDev;
96 /** Set after the first attempt to find the VMM Device. */
97 bool mfVMMDevInited;
98};
99
100#endif // ____H_KEYBOARDIMPL
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