1 // -*- C++ -*-
2 /**
3  * \file CustomizedWidgets.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Bo Peng
8  * \author Edwin Leuven
9  * \author Jürgen Spitzmüller
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13 
14 #ifndef CUSTOMIZEDWIDGETS_H
15 #define CUSTOMIZEDWIDGETS_H
16 
17 #include <QLabel>
18 #include "KeySequence.h"
19 
20 class QEvent;
21 class QKeyEvent;
22 
23 namespace lyx {
24 namespace frontend {
25 
26 /**
27  * A widget for inputting shortcuts
28  */
29 class ShortcutWidget : public QLabel {
30 	Q_OBJECT
31 public:
32 	ShortcutWidget(QWidget * parent);
33 	void reset();
34 	KeySequence const getKeySequence() const;
35 	void setKeySequence(lyx::KeySequence const & s);
36 	void removeFromSequence();
37 protected Q_SLOTS:
38 	bool event(QEvent* e);
39 	void keyPressEvent(QKeyEvent * e);
40 private:
41 	void appendToSequence(QKeyEvent * e);
42 	KeySequence keysequence_;
43 	bool has_cursor_;
44 };
45 
46 } // namespace frontend
47 } // namespace lyx
48 
49 #endif // CUSTOMIZEDWIDGETS_H
50