]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QLyXKeySym.C
incomplete key mapping stuff. Introduces some breakage.
[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 #include "debug.h"
19  
20 QLyXKeySym::QLyXKeySym()
21         : LyXKeySym(), key_(0), shift_(false)
22 {
23 }
24  
25  
26 void QLyXKeySym::set(int key, bool shift)
27 {
28         key_ = key;
29         shift_ = shift;
30 }
31  
32
33 void QLyXKeySym::init(string const & symbolname)
34 {
35         key_ = string_to_qkey(symbolname);
36 }
37
38  
39 bool QLyXKeySym::isOK() const
40 {
41         // FIXME
42         return key_ != 0;
43 }
44  
45
46 bool QLyXKeySym::isModifier() const
47 {
48         return q_is_modifier(key_);
49 }
50
51  
52 string QLyXKeySym::getSymbolName() const
53 {
54         return qkey_to_string(key_, shift_);
55 }
56
57  
58 char QLyXKeySym::getISOEncoded() const
59 {
60         /* Even though we could try to use QKeyEvent->text(),
61          * it won't work, because it returns something other
62          * than 'Z' for things like C-S-z. Do not ask me why,
63          * just more Qt bullshit.       
64          */
65         return qkey_to_char(key_, shift_);
66 }
67  
68
69 bool QLyXKeySym::operator==(LyXKeySym const & k) const
70 {
71         QLyXKeySym const & o = static_cast<QLyXKeySym const &>(k);
72         return o.key_ == key_;
73 }