kshortcutdialog.h

00001 /* This file is part of the KDE libraries
00002     Copyright (C) 2002,2003 Ellis Whitehead <ellis@kde.org>
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License as published by the Free Software Foundation; either
00007     version 2 of the License, or (at your option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public License
00015     along with this library; see the file COPYING.LIB.  If not, write to
00016     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017     Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef _KSHORTCUTDIALOG_H_
00021 #define _KSHORTCUTDIALOG_H_
00022 
00023 #include "kdialogbase.h"
00024 #include "kshortcut.h"
00025 
00026 class QVBox;
00027 class KPushButton;
00028 class KShortcutDialogSimple;
00029 class KShortcutDialogAdvanced;
00030 
00041 class KDEUI_EXPORT KShortcutDialog : public KDialogBase
00042 {
00043     Q_OBJECT
00044 public:
00045     KShortcutDialog( const KShortcut& shortcut, bool bQtShortcut, QWidget* parent = 0, const char* name = 0 );
00046     ~KShortcutDialog();
00047 
00048     void setShortcut( const KShortcut & shortcut );
00049     const KShortcut& shortcut() const { return m_shortcut; }
00050 
00051 private:
00052     // true if qt shortcut, false if native shortcut
00053     bool m_bQtShortcut;
00054 
00055     KShortcut m_shortcut;
00056     bool m_bGrab;
00057     KPushButton* m_ptxtCurrent;
00058     uint m_iSeq;
00059     uint m_iKey;
00060     bool m_bRecording;
00061     uint m_mod;
00062     KShortcutDialogSimple *m_simple;
00063     KShortcutDialogAdvanced *m_adv;
00064     QVBox *m_stack;
00065     
00066     void updateShortcutDisplay();
00067     //void displayMods();
00068     void keyPressed( KKey key );
00069     void updateDetails();
00070 
00071     #ifdef Q_WS_X11
00072     virtual bool x11Event( XEvent *pEvent );
00073     //void x11EventKeyPress( XEvent *pEvent );
00074     void x11KeyPressEvent( XEvent* pEvent );
00075     void x11KeyReleaseEvent( XEvent* pEvent );
00076     #endif
00077     #ifdef Q_WS_WIN
00078     virtual void keyPressEvent( QKeyEvent * e );
00079     virtual bool event(QEvent * e);
00080     #endif
00081 
00082 protected slots:
00083     void slotDetails();
00084     void slotSelectPrimary();
00085     void slotSelectAlternate();
00086     void slotClearShortcut();
00087     void slotClearPrimary();
00088     void slotClearAlternate();
00089     void slotMultiKeyMode( bool bOn );
00090 
00091 private:
00092         class KShortcutDialogPrivate* d;
00093         static bool s_showMore;
00094 };
00095 
00096 #endif // _KSHORTCUTDIALOG_H_
KDE Home | KDE Accessibility Home | Description of Access Keys