]> git.lyx.org Git - lyx.git/blob - src/frontends/KeyModifier.h
Require a C++11 compiler
[lyx.git] / src / frontends / KeyModifier.h
1 // -*- C++ -*-
2 /**
3  * \file KeyModifier.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * Keyboard modifier state representation.
8  *
9  * \author John Levon
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #ifndef KEYMODIFIER_H
15 #define KEYMODIFIER_H
16
17 namespace lyx {
18
19 /// modifier key states
20
21 enum KeyModifier {
22         NoModifier       = 0, //< no modifiers held
23         ControlModifier  = 1, //< control button held
24         AltModifier      = 2, //< alt key held
25         ShiftModifier    = 4, //< shift key held
26         MetaModifier     = 8  //< meta key held
27 };
28
29
30 inline KeyModifier operator|(KeyModifier s1, KeyModifier s2)
31 {
32         int const i1 = static_cast<int>(s1);
33         int const i2 = static_cast<int>(s2);
34         return static_cast<KeyModifier>(i1 | i2);
35 }
36
37
38 inline void operator|=(KeyModifier & s1, KeyModifier s2)
39 {
40         s1 = static_cast<KeyModifier>(s1 | s2);
41 }
42
43
44 } // namespace lyx
45
46 #endif // KEYMODIFIER_H