KGlobalAccel

kglobalaccel_mac.h
1 /*
2  This file is part of the KDE libraries
3  SPDX-FileCopyrightText: 2006 Marijn Kruisselbrink <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #ifndef _KGLOBALACCEL_MAC_H
9 #define _KGLOBALACCEL_MAC_H
10 
11 #include <QWidget>
12 
13 /* including kglobalaccel.h here because Carbon.h includes AssertMacros.h which
14  defines check(assertion) as nothing and breaks compilation */
15 #include "kglobalaccel.h"
16 
17 #include <Carbon/Carbon.h>
18 
19 template<class Key, class T>
20 class QMap;
21 template<class T>
22 class QList;
23 
25 class KGlobalAccelImpl : public QWidget
26 {
27  Q_OBJECT
28 public:
31 
32 public:
33  /**
34  * This function registers or unregisters a certain key for global capture,
35  * depending on \b grab.
36  *
37  * Before destruction, every grabbed key will be released, so this
38  * object does not need to do any tracking.
39  *
40  * \param key the Qt keycode to grab or release.
41  * \param grab true to grab they key, false to release the key.
42  *
43  * \return true if successful, otherwise false.
44  */
45  bool grabKey(int key, bool grab);
46 
47  /// Enable/disable all shortcuts. There will not be any grabbed shortcuts at this point.
48  void setEnabled(bool);
49 
50  void keyboardLayoutChanged();
51 
52 private:
53  friend OSStatus hotKeyEventHandler(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void *inUserData);
54  /// Called by the carbon event handler when a key is pressed.
55  bool keyPressed(int key);
56 
57  GlobalShortcutsRegistry *m_owner;
58  EventTargetRef m_eventTarget;
59  EventHandlerUPP m_eventHandler;
60  EventTypeSpec m_eventType[2];
61  EventHandlerRef m_curHandler;
63 };
64 
65 #endif // _KGLOBALACCEL_MAC_H
void setEnabled(bool)
Enable/disable all shortcuts. There will not be any grabbed shortcuts at this point.
Global Shortcut Registry.
QPixmap grab(const QRect &rectangle)
Q_OBJECTQ_OBJECT
bool grabKey(int key, bool grab)
This function registers or unregisters a certain key for global capture, depending on grab...
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Dec 6 2021 22:48:22 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.