]> git.lyx.org Git - lyx.git/blob - src/frontends/key_state.h
fix scrolling bug: 3320 and 3652, maybe not perfect
[lyx.git] / src / frontends / key_state.h
1 // -*- C++ -*-
2 /**
3  * \file key_state.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 KEY_STATE_H
15 #define KEY_STATE_H
16
17 namespace lyx {
18
19 /// modifier key states
20 namespace key_modifier {
21
22 enum state {
23         none  = 0, //< no modifiers held
24         ctrl  = 1, //< control button held
25         alt   = 2, //< alt/meta key held
26         shift = 4  //< shift key held
27 };
28
29
30 inline state operator|(state const & s1, state const & s2)
31 {
32         int const i1 = static_cast<int>(s1);
33         int const i2 = static_cast<int>(s2);
34         return static_cast<state>(i1 | i2);
35 }
36
37
38 inline void operator|=(state & s1, state s2)
39 {
40         s1 = static_cast<state>(s1 | s2);
41 }
42
43 } // namespace key_modifier
44
45
46 } // namespace lyx
47
48 #endif // KEY_STATE_H