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