]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QLyXKeySym.h
enable Font cache only for MacOSX and inline width() for other platform.
[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 class QKeyEvent;
22
23 /**
24  * Qt-specific key press.
25  *
26  * This is some really sick stuff.
27  */
28 class QLyXKeySym : public LyXKeySym {
29 public:
30         QLyXKeySym();
31
32         virtual ~QLyXKeySym() {}
33
34         /// delayed constructor
35         void set(QKeyEvent * ev);
36
37         /// set from a LyX symbolic name
38         virtual void init(std::string const & symbolname);
39
40         /// Is this a valid key?
41         virtual bool isOK() const;
42
43         /// Is this a modifier key only?
44         virtual bool isModifier() const;
45
46         /// return the LyX symbolic name
47         virtual std::string getSymbolName() const;
48
49         /// Is this normal insertable text ? (last ditch attempt only)
50         virtual bool isText() const;
51
52         /**
53          * Return the value of the keysym into the UCS-4 encoding.
54          * This converts the LyXKeySym to a 32-bit encoded character.
55          */
56         virtual size_t getUCSEncoded() const;
57
58         /// Return a human-readable version of a key+modifier pair.
59         virtual std::string const print(key_modifier::state mod) const;
60
61         ///
62         QString const qprint(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 #endif // QLYXKEYSYM_H