~ubuntu-branches/ubuntu/raring/virtualbox-ose/raring

« back to all changes in this revision

Viewing changes to src/VBox/Frontends/VirtualBox/src/extensions/QIHotKeyEdit.h

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2011-01-30 23:27:25 UTC
  • mfrom: (0.3.12 upstream)
  • Revision ID: james.westby@ubuntu.com-20110130232725-2ouajjd2ggdet0zd
Tags: 4.0.2-dfsg-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Add Apport hook.
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Drop *-source packages.
* Drop ubuntu-01-fix-build-gcc45.patch, fixed upstream.
* Drop ubuntu-02-as-needed.patch, added to the Debian package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 */
6
6
 
7
7
/*
8
 
 * Copyright (C) 2006-2007 Oracle Corporation
 
8
 * Copyright (C) 2006-2011 Oracle Corporation
9
9
 *
10
10
 * This file is part of VirtualBox Open Source Edition (OSE), as
11
11
 * available from http://www.virtualbox.org. This file is free software;
19
19
#ifndef ___QIHotKeyEdit_h___
20
20
#define ___QIHotKeyEdit_h___
21
21
 
 
22
/* Global includes */
22
23
#include <QLabel>
23
24
 
24
25
#ifdef Q_WS_X11
25
26
# include <QMap>
26
 
#endif
27
 
 
28
 
#ifdef Q_WS_PM
29
 
/* Extra virtual keys returned by QIHotKeyEdit::virtualKey() */
30
 
# define VK_LSHIFT   VK_USERFIRST + 0
31
 
# define VK_LCTRL    VK_USERFIRST + 1
32
 
# define VK_LWIN     VK_USERFIRST + 2
33
 
# define VK_RWIN     VK_USERFIRST + 3
34
 
# define VK_WINMENU  VK_USERFIRST + 4
35
 
# define VK_FORWARD  VK_USERFIRST + 5
36
 
# define VK_BACKWARD VK_USERFIRST + 6
37
 
#endif
 
27
#endif /* Q_WS_X11 */
38
28
 
39
29
class QIHotKeyEdit : public QLabel
40
30
{
42
32
 
43
33
public:
44
34
 
45
 
    QIHotKeyEdit (QWidget *aParent);
 
35
    QIHotKeyEdit(QWidget *pParent);
46
36
    virtual ~QIHotKeyEdit();
47
37
 
48
 
    void setKey (int aKeyVal);
49
 
    int key() const { return mKeyVal; }
 
38
    void setKey(int iKeyVal);
 
39
    int key() const { return m_iKeyVal; }
50
40
 
51
 
    QString symbolicName() const { return mSymbName; }
 
41
    QString symbolicName() const { return m_strSymbName; }
52
42
 
53
43
    QSize sizeHint() const;
54
44
    QSize minimumSizeHint() const;
55
45
 
56
 
#ifdef Q_WS_PM
57
 
    static int virtualKey (QMSG *aMsg);
58
 
#endif
59
 
 
60
 
#if defined (Q_WS_PM) || defined (Q_WS_X11)
 
46
    static QString keyName(int iKeyVal);
 
47
    static bool isValidKey(int iKeyVal);
 
48
#ifdef Q_WS_X11
61
49
    static void retranslateUi();
62
 
#endif
63
 
    static QString keyName (int aKeyVal);
64
 
    static bool isValidKey (int aKeyVal);
 
50
#endif /* Q_WS_X11 */
65
51
 
66
52
public slots:
67
53
 
70
56
protected:
71
57
 
72
58
#if defined (Q_WS_WIN32)
73
 
    bool winEvent (MSG *aMsg, long *aResult);
74
 
#elif defined (Q_WS_PM)
75
 
    bool pmEvent (QMSG *aMsg);
 
59
    bool winEvent(MSG *pMsg, long *pResult);
76
60
#elif defined (Q_WS_X11)
77
 
    bool x11Event (XEvent *event);
 
61
    bool x11Event(XEvent *pEvent);
78
62
#elif defined (Q_WS_MAC)
79
 
    static bool darwinEventHandlerProc (const void *pvCocoaEvent, const void *pvCarbonEvent, void *pvUser);
80
 
    bool darwinKeyboardEvent (const void *pvCocoaEvent, EventRef inEvent);
 
63
    static bool darwinEventHandlerProc(const void *pvCocoaEvent, const void *pvCarbonEvent, void *pvUser);
 
64
    bool darwinKeyboardEvent(const void *pvCocoaEvent, EventRef inEvent);
81
65
#endif
82
66
 
83
 
    void focusInEvent (QFocusEvent *);
84
 
    void focusOutEvent (QFocusEvent *);
85
 
 
86
 
    void paintEvent (QPaintEvent *);
 
67
    void focusInEvent(QFocusEvent *pEvent);
 
68
    void focusOutEvent(QFocusEvent *pEvent);
 
69
    void paintEvent(QPaintEvent *pEvent);
87
70
 
88
71
private:
89
72
 
90
73
    void updateText();
91
74
 
92
 
    int mKeyVal;
93
 
    QString mSymbName;
 
75
    int m_iKeyVal;
 
76
    QString m_strSymbName;
94
77
 
95
 
#if defined (Q_WS_PM)
96
 
    static QMap <int, QString> sKeyNames;
97
 
#elif defined (Q_WS_X11)
98
 
    static QMap <QString, QString> sKeyNames;
99
 
#endif
 
78
#ifdef Q_WS_X11
 
79
    static QMap<QString, QString> s_keyNames;
 
80
#endif /* Q_WS_X11 */
100
81
 
101
82
#ifdef Q_WS_MAC
102
 
    /** The current modifier key mask. Used to figure out which modifier
103
 
     *  key was pressed when we get a kEventRawKeyModifiersChanged event. */
104
 
    uint32_t mDarwinKeyModifiers;
105
 
#endif
 
83
    /* The current modifier key mask. Used to figure out which modifier
 
84
     * key was pressed when we get a kEventRawKeyModifiersChanged event. */
 
85
    uint32_t m_uDarwinKeyModifiers;
 
86
#endif /* Q_WS_MAC */
106
87
 
107
 
    static const char *kNoneSymbName;
 
88
    static const char *m_spNoneSymbName;
108
89
};
109
90
 
110
91
#endif // !___QIHotKeyEdit_h___