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 |
|
---|
28 | class QIHotKeyEdit : public QLabel
|
---|
29 | {
|
---|
30 | Q_OBJECT
|
---|
31 |
|
---|
32 | public:
|
---|
33 |
|
---|
34 | QIHotKeyEdit( QWidget * parent, const char * name = 0 );
|
---|
35 |
|
---|
36 | void setKey( int keyval );
|
---|
37 | int key() const { return keyval; }
|
---|
38 |
|
---|
39 | QString symbolicName() const { return symbname; }
|
---|
40 |
|
---|
41 | QSize sizeHint() const;
|
---|
42 | QSize minimumSizeHint() const;
|
---|
43 |
|
---|
44 | static QString keyName (int key);
|
---|
45 | static bool isValidKey (int k);
|
---|
46 |
|
---|
47 | public slots:
|
---|
48 |
|
---|
49 | void clear();
|
---|
50 |
|
---|
51 | protected:
|
---|
52 |
|
---|
53 | #if defined(Q_WS_WIN32)
|
---|
54 | bool winEvent( MSG *msg );
|
---|
55 | #elif defined(Q_WS_X11)
|
---|
56 | bool x11Event( XEvent *event );
|
---|
57 | #endif
|
---|
58 |
|
---|
59 | void focusInEvent( QFocusEvent * );
|
---|
60 | void focusOutEvent( QFocusEvent * );
|
---|
61 |
|
---|
62 | void drawContents( QPainter * p );
|
---|
63 |
|
---|
64 | private:
|
---|
65 |
|
---|
66 | void updateText();
|
---|
67 |
|
---|
68 | int keyval;
|
---|
69 | QString symbname;
|
---|
70 |
|
---|
71 | QColorGroup true_acg;
|
---|
72 |
|
---|
73 | static const char *NoneSymbName;
|
---|
74 | };
|
---|
75 |
|
---|
76 | #endif // __QIHotKeyEdit_h__
|
---|