]> git.lyx.org Git - features.git/blob - src/frontends/qt4/QKeySymbol.h
rename LyXKeySym into KeySymbol
[features.git] / src / frontends / qt4 / QKeySymbol.h
1 // -*- C++ -*-
2 /**
3  * \file QKeySymbol.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Asger and Jürgen
8  * \author John Levon
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef QLYXKEYSYM_H
14 #define QLYXKEYSYM_H
15
16 #include "frontends/KeySymbol.h"
17
18 #include <QString>
19 #include <QKeyEvent>
20
21
22 class QKeyEvent;
23
24 namespace lyx {
25
26 /**
27  * Qt-specific key press.
28  *
29  * This is some really sick stuff.
30  */
31 class QKeySymbol : public KeySymbol {
32 public:
33         QKeySymbol();
34
35         virtual ~QKeySymbol() {}
36
37         /// .
38         /// inlined out because of profiling results under linux when
39         /// opening a document.
40         inline bool operator==(KeySymbol const& ks) const;
41
42         /// delayed constructor
43         void set(QKeyEvent * ev);
44
45         /// set from a LyX symbolic name
46         virtual void init(std::string const & symbolname);
47
48         /// Is this a valid key?
49         virtual bool isOK() const;
50
51         /// Is this a modifier key only?
52         virtual bool isModifier() const;
53
54         /// return the LyX symbolic name
55         virtual std::string getSymbolName() const;
56
57         /// Is this normal insertable text ? (last ditch attempt only)
58         virtual bool isText() const;
59
60         /**
61          * Return the value of the keysym into the UCS-4 encoding.
62          * This converts the KeySymbol to a 32-bit encoded character.
63          */
64         virtual char_type getUCSEncoded() const;
65
66         /**
67          * Return a human-readable version of a key+modifier pair.
68          * This will be the GUI version (translated and with special
69          * characters for Mac OS X) when \c forgui is true.
70          */
71         virtual docstring const print(key_modifier::state mod, bool forgui) const;
72
73         ///
74         int key() const {
75                 return key_;
76         }
77 private:
78         /// the Qt sym value
79         int key_;
80         /// the event string value
81         QString text_;
82 };
83
84
85 } // namespace lyx
86
87 #endif // QLYXKEYSYM_H