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