VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/include/QIHotKeyEdit.h@ 2835

Last change on this file since 2835 was 2802, checked in by vboxsync, 18 years ago

Fixed the host key name display in the X11 GUI

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.6 KB
Line 
1/** @file
2 *
3 * VBox frontends: Qt GUI ("VirtualBox"):
4 * InnoTek Qt extensions: QIHotKeyEdit class declaration
5 */
6
7/*
8 * Copyright (C) 2006 InnoTek Systemberatung GmbH
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.virtualbox.org. This file is free software;
12 * you can redistribute it and/or modify it under the terms of the GNU
13 * General Public License as published by the Free Software Foundation,
14 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
15 * distribution. VirtualBox OSE is distributed in the hope that it will
16 * be useful, but WITHOUT ANY WARRANTY of any kind.
17 *
18 * If you received this file as part of a commercial VirtualBox
19 * distribution, then only the terms of your commercial VirtualBox
20 * license agreement apply instead of the previous paragraph.
21 */
22
23#ifndef __QIHotKeyEdit_h__
24#define __QIHotKeyEdit_h__
25
26#include <qlabel.h>
27#if defined(Q_WS_X11)
28#include <qmap.h>
29#endif
30#if defined(Q_WS_MAC)
31#include <Carbon/Carbon.h>
32#endif
33
34
35class QIHotKeyEdit : public QLabel
36{
37 Q_OBJECT
38
39public:
40
41 QIHotKeyEdit( QWidget * parent, const char * name = 0 );
42 virtual ~QIHotKeyEdit();
43
44 void setKey( int keyval );
45 int key() const { return keyval; }
46
47 QString symbolicName() const { return symbname; }
48
49 QSize sizeHint() const;
50 QSize minimumSizeHint() const;
51
52#if defined(Q_WS_X11)
53 static void languageChange(void);
54#endif
55 static QString keyName (int key);
56 static bool isValidKey (int k);
57
58public slots:
59
60 void clear();
61
62protected:
63
64#if defined(Q_WS_WIN32)
65 bool winEvent( MSG *msg );
66#elif defined(Q_WS_X11)
67 bool x11Event( XEvent *event );
68#elif defined(Q_WS_MAC)
69 static pascal OSStatus darwinEventHandlerProc( EventHandlerCallRef inHandlerCallRef,
70 EventRef inEvent, void *inUserData );
71 bool darwinKeyboardEvent( EventRef inEvent );
72#endif
73
74 void focusInEvent( QFocusEvent * );
75 void focusOutEvent( QFocusEvent * );
76
77 void drawContents( QPainter * p );
78
79private:
80
81 void updateText();
82
83 int keyval;
84 QString symbname;
85
86 QColorGroup true_acg;
87
88#if defined(Q_WS_X11)
89 static QMap<QString, QString> keyNames;
90#endif
91
92#if defined(Q_WS_MAC)
93 /** Event handler reference. NULL if the handler isn't installed. */
94 EventHandlerRef m_darwinEventHandlerRef;
95 /** The current modifier key mask. Used to figure out which modifier
96 * key was pressed when we get a kEventRawKeyModifiersChanged event. */
97 UInt32 m_darwinKeyModifiers;
98#endif
99
100 static const char *NoneSymbName;
101};
102
103#endif // __QIHotKeyEdit_h__
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