KGlobalAccel

kglobalaccel_interface.h
1 /*
2  This file is part of the KDE libraries
3  SPDX-FileCopyrightText: 2001, 2002 Ellis Whitehead <[email protected]>
4  SPDX-FileCopyrightText: 2015 Martin Gräßlin <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8 
9 #ifndef KGLOBALACCEL_INTERFACE_H
10 #define KGLOBALACCEL_INTERFACE_H
11 
12 #include <QObject>
13 
14 #include "kf5globalaccelprivate_export.h"
15 
17 
18 #define KGlobalAccelInterface_iid "org.kde.kglobalaccel5.KGlobalAccelInterface"
19 
20 /**
21  * Abstract interface for plugins to implement
22  */
23 class KGLOBALACCELPRIVATE_EXPORT KGlobalAccelInterface : public QObject
24 {
25  Q_OBJECT
26 
27 public:
28  explicit KGlobalAccelInterface(QObject *parent);
29  virtual ~KGlobalAccelInterface();
30 
31 public:
32  /**
33  * This function registers or unregisters a certain key for global capture,
34  * depending on \b grab.
35  *
36  * Before destruction, every grabbed key will be released, so this
37  * object does not need to do any tracking.
38  *
39  * \param key the Qt keycode to grab or release.
40  * \param grab true to grab they key, false to release the key.
41  *
42  * \return true if successful, otherwise false.
43  */
44  virtual bool grabKey(int key, bool grab) = 0;
45 
46  /*
47  * Enable/disable all shortcuts. There will not be any grabbed shortcuts at this point.
48  */
49  virtual void setEnabled(bool) = 0;
50 
51  /**
52  * Allows implementing plugins to synchronize with the windowing system.
53  * Default implementation does nothing.
54  **/
55  virtual void syncWindowingSystem();
56 
57  void setRegistry(GlobalShortcutsRegistry *registry);
58 
59 protected:
60  /**
61  * called by the implementation to inform us about key presses
62  * @returns @c true if the key was handled
63  **/
64  bool keyPressed(int keyQt);
65  void grabKeys();
66  void ungrabKeys();
67 
68 private:
69  class Private;
71 };
72 
73 Q_DECLARE_INTERFACE(KGlobalAccelInterface, KGlobalAccelInterface_iid)
74 
75 #endif
Global Shortcut Registry.
Abstract interface for plugins to implement.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon May 17 2021 22:53:55 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.