1 /* This file is part of the KDE libraries
2 Copyright (C) 2001,2002 Ellis Whitehead <ellis@kde.org>
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.
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.
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.
20 #ifndef _KGLOBALACCEL_X11_H
21 #define _KGLOBALACCEL_X11_H
25 class GlobalShortcutsRegistry
;
29 * The KGlobalAccel private class handles grabbing of global keys,
30 * and notification of when these keys are pressed.
32 class KGlobalAccelImpl
: public QWidget
37 KGlobalAccelImpl( GlobalShortcutsRegistry
*owner
);
41 * This function registers or unregisters a certain key for global capture,
42 * depending on \b grab.
44 * Before destruction, every grabbed key will be released, so this
45 * object does not need to do any tracking.
47 * \param key the Qt keycode to grab or release.
48 * \param grab true to grab they key, false to release the key.
50 * \return true if successful, otherwise false.
52 bool grabKey(int key
, bool grab
);
54 /// Enable/disable all shortcuts. There will not be any grabbed shortcuts at this point.
55 void setEnabled(bool);
59 * Filters X11 events ev for key bindings in the accelerator dictionary.
60 * If a match is found the activated activated is emitted and the function
61 * returns true. Return false if the event is not processed.
63 * This is public for compatibility only. You do not need to call it.
65 virtual bool x11Event( XEvent
* );
66 void x11MappingNotify();
67 bool x11KeyPress( const XEvent
*pEvent
);
69 GlobalShortcutsRegistry
*m_owner
;
72 #endif // _KGLOBALACCEL_X11_H