]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QLyXKeySym.h
getting rid of qt4 convenience classes:
[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 local ISO encoding.
54          * This converts the LyXKeySym to a 8-bit encoded character.
55          * This relies on user to use the right encoding.
56          */
57         virtual char getISOEncoded(std::string const & encoding) const;
58
59         /// Return a human-readable version of a key+modifier pair.
60         virtual std::string const print(key_modifier::state mod) const;
61
62         ///
63         QString const qprint(key_modifier::state mod) const;
64
65         ///
66         int key() const {
67                 return key_;
68         }
69 private:
70         /// the Qt sym value
71         int key_;
72         /// the event string value
73         QString text_;
74 };
75
76 #endif // QLYXKEYSYM_H