Warning: That file was not part of the compilation database. It may have many parsing errors.
1 | /* This file is part of the KDE libraries |
---|---|
2 | Copyright (C) 2006 Marijn Kruisselbrink <m.kruisselbrink@student.tue.nl> |
3 | |
4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public |
6 | License as published by the Free Software Foundation; either |
7 | version 2 of the License, or (at your option) any later version. |
8 | |
9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. |
13 | |
14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 | Boston, MA 02110-1301, USA. |
18 | */ |
19 | |
20 | #ifndef _KGLOBALACCEL_MAC_H |
21 | #define _KGLOBALACCEL_MAC_H |
22 | |
23 | #include <QWidget> |
24 | |
25 | #include "kshortcut.h" |
26 | /* including kglobalaccel.h here because Carbon.h includes AssertMacros.h which |
27 | defines check(assertion) as nothing and breaks compilation */ |
28 | #include "kglobalaccel.h" |
29 | |
30 | #include <Carbon/Carbon.h> |
31 | |
32 | template <class Key, class T> class QMap; |
33 | template <class T> class QList; |
34 | |
35 | class GlobalShortcutsRegistry; |
36 | class KGlobalAccelImpl: public QWidget |
37 | { |
38 | Q_OBJECT |
39 | public: |
40 | KGlobalAccelImpl(GlobalShortcutsRegistry* owner); |
41 | ~KGlobalAccelImpl(); |
42 | |
43 | public: |
44 | /** |
45 | * This function registers or unregisters a certain key for global capture, |
46 | * depending on \b grab. |
47 | * |
48 | * Before destruction, every grabbed key will be released, so this |
49 | * object does not need to do any tracking. |
50 | * |
51 | * \param key the Qt keycode to grab or release. |
52 | * \param grab true to grab they key, false to release the key. |
53 | * |
54 | * \return true if successful, otherwise false. |
55 | */ |
56 | bool grabKey(int key, bool grab); |
57 | |
58 | /// Enable/disable all shortcuts. There will not be any grabbed shortcuts at this point. |
59 | void setEnabled(bool); |
60 | |
61 | void keyboardLayoutChanged(); |
62 | private: |
63 | friend OSStatus hotKeyEventHandler(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void * inUserData); |
64 | /// Called by the carbon event handler when a key is pressed. |
65 | bool keyPressed(int key); |
66 | |
67 | GlobalShortcutsRegistry* m_owner; |
68 | EventTargetRef m_eventTarget; |
69 | EventHandlerUPP m_eventHandler; |
70 | EventTypeSpec m_eventType[2]; |
71 | EventHandlerRef m_curHandler; |
72 | QMap<int, QList<EventHotKeyRef> >* refs; |
73 | }; |
74 | |
75 | #endif // _KGLOBALACCEL_MAC_H |
76 |
Warning: That file was not part of the compilation database. It may have many parsing errors.