]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QLyXKeySym.h
Convert shortcut strings to unicode (required by Qt/Mac); restore
[lyx.git] / src / frontends / qt4 / QLyXKeySym.h
1 // -*- C++ -*-
2 /**
3  * \file QLyXKeySym.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/LyXKeySym.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 QLyXKeySym : public LyXKeySym {
32 public:
33         QLyXKeySym();
34
35         virtual ~QLyXKeySym() {}
36
37         /// delayed constructor
38         void set(QKeyEvent * ev);
39
40         /// set from a LyX symbolic name
41         virtual void init(std::string const & symbolname);
42
43         /// Is this a valid key?
44         virtual bool isOK() const;
45
46         /// Is this a modifier key only?
47         virtual bool isModifier() const;
48
49         /// return the LyX symbolic name
50         virtual std::string getSymbolName() const;
51
52         /// Is this normal insertable text ? (last ditch attempt only)
53         virtual bool isText() const;
54
55         /**
56          * Return the value of the keysym into the UCS-4 encoding.
57          * This converts the LyXKeySym to a 32-bit encoded character.
58          */
59         virtual size_t getUCSEncoded() const;
60
61         /// Return a human-readable version of a key+modifier pair.
62         virtual docstring const print(key_modifier::state mod) const;
63
64         ///
65         int key() const {
66                 return key_;
67         }
68 private:
69         /// the Qt sym value
70         int key_;
71         /// the event string value
72         QString text_;
73 };
74
75
76 } // namespace lyx
77
78 #endif // QLYXKEYSYM_H