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