VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox4/include/QIHotKeyEdit.h@ 11532

Last change on this file since 11532 was 9820, checked in by vboxsync, 17 years ago

Fe/Qt4: GlobalInputSettings ported to qt4, fixed tab-order for GlobalGeneralSettings.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.1 KB
Line 
1/** @file
2 *
3 * VBox frontends: Qt GUI ("VirtualBox"):
4 * VirtualBox Qt extensions: QIHotKeyEdit class declaration
5 */
6
7/*
8 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
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 (GPL) as published by the Free Software
14 * Foundation, in version 2 as it comes in the "COPYING" file of the
15 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17 *
18 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
19 * Clara, CA 95054 USA or visit http://www.sun.com if you need
20 * additional information or have any questions.
21 */
22
23#ifndef __QIHotKeyEdit_h__
24#define __QIHotKeyEdit_h__
25
26#include <QLabel>
27#if defined (Q_WS_X11)
28#include <QMap>
29#endif
30#if defined (Q_WS_MAC)
31#include <Carbon/Carbon.h>
32#endif
33
34#if defined (Q_WS_PM)
35/* Extra virtual keys returned by QIHotKeyEdit::virtualKey() */
36#define VK_LSHIFT VK_USERFIRST + 0
37#define VK_LCTRL VK_USERFIRST + 1
38#define VK_LWIN VK_USERFIRST + 2
39#define VK_RWIN VK_USERFIRST + 3
40#define VK_WINMENU VK_USERFIRST + 4
41#define VK_FORWARD VK_USERFIRST + 5
42#define VK_BACKWARD VK_USERFIRST + 6
43#endif
44
45class QIHotKeyEdit : public QLabel
46{
47 Q_OBJECT
48
49public:
50
51 QIHotKeyEdit (QWidget *aParent);
52 virtual ~QIHotKeyEdit();
53
54 void setKey (int aKeyVal);
55 int key() const { return mKeyVal; }
56
57 QString symbolicName() const { return mSymbName; }
58
59 QSize sizeHint() const;
60 QSize minimumSizeHint() const;
61
62#if defined (Q_WS_PM)
63 static int virtualKey (QMSG *aMsg);
64#endif
65
66#if defined (Q_WS_PM) || defined (Q_WS_X11)
67 static void retranslateUi();
68#endif
69 static QString keyName (int aKeyVal);
70 static bool isValidKey (int aKeyVal);
71
72public slots:
73
74 void clear();
75
76protected:
77
78#if defined (Q_WS_WIN32)
79 bool winEvent (MSG *msg);
80#elif defined (Q_WS_PM)
81 bool pmEvent (QMSG *aMsg);
82#elif defined (Q_WS_X11)
83 bool x11Event (XEvent *event);
84#elif defined (Q_WS_MAC)
85 static pascal OSStatus darwinEventHandlerProc (EventHandlerCallRef inHandlerCallRef,
86 EventRef inEvent, void *inUserData);
87 bool darwinKeyboardEvent (EventRef inEvent);
88#endif
89
90 void focusInEvent (QFocusEvent *);
91 void focusOutEvent (QFocusEvent *);
92
93 void paintEvent (QPaintEvent *);
94
95private:
96
97 void updateText();
98
99 int mKeyVal;
100 QString mSymbName;
101
102#if defined (Q_WS_PM)
103 static QMap <int, QString> sKeyNames;
104#elif defined (Q_WS_X11)
105 static QMap <QString, QString> sKeyNames;
106#endif
107
108#if defined (Q_WS_MAC)
109 /** Event handler reference. NULL if the handler isn't installed. */
110 EventHandlerRef mDarwinEventHandlerRef;
111 /** The current modifier key mask. Used to figure out which modifier
112 * key was pressed when we get a kEventRawKeyModifiersChanged event. */
113 UInt32 mDarwinKeyModifiers;
114#endif
115
116 static const char *kNoneSymbName;
117};
118
119#endif // __QIHotKeyEdit_h__
120
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