]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QLyXKeySym.C
don't crash when you press Alt Gr etc. :)
[lyx.git] / src / frontends / qt2 / QLyXKeySym.C
1 /**
2  * \file QLyXKeySym.C
3  * Copyright 2002 the LyX Team
4  * Read the file COPYING
5  *
6  * \author Asger and Juergen
7  * \author John Levon <moz@compsoc.man.ac.uk>
8  */
9
10 #include <config.h>
11
12 #ifdef __GNUG__
13 #pragma implementation
14 #endif
15
16 #include "QLyXKeySym.h"
17 #include "qlkey.h"
18  
19 QLyXKeySym::QLyXKeySym()
20         : LyXKeySym(), key_(0), text_("")
21 {
22 }
23  
24  
25 void QLyXKeySym::set(int key, QString const & text)
26 {
27         key_ = key;
28         text_ = text;
29 }
30  
31
32 void QLyXKeySym::init(string const & symbolname)
33 {
34         key_ = string_to_qkey(symbolname);
35 }
36
37  
38 bool QLyXKeySym::isOK() const
39 {
40         // FIXME
41         return key_ != 0;
42 }
43  
44
45 bool QLyXKeySym::isModifier() const
46 {
47         return q_is_modifier(key_);
48 }
49
50  
51 string QLyXKeySym::getSymbolName() const
52 {
53         return qkey_to_string(key_);
54 }
55
56  
57 char QLyXKeySym::getISOEncoded() const
58 {
59         if (!text_.length()) 
60                 return 0;
61         // FIXME
62         return text_.latin1()[0];
63 }
64  
65
66 bool QLyXKeySym::operator==(LyXKeySym const & k) const
67 {
68         QLyXKeySym const & o = static_cast<QLyXKeySym const &>(k);
69         return o.key_ == key_;
70 }