]> git.lyx.org Git - lyx.git/blob - src/frontends/key_state.h
Handle Qt-style file filters like
[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 /// modifier key states
18 namespace key_modifier {
19         enum state {
20                 none    = 0, //< no modifiers held
21                 ctrl    = 1, //< control button held
22                 alt     = 2, //< alt/meta key held
23                 shift   = 4  //< shift key held
24         };
25
26
27 inline state operator|(state const & s1, state const & s2)
28 {
29         int const i1(static_cast<int>(s1));
30         int const i2(static_cast<int>(s2));
31         return static_cast<state>(i1 | i2);
32 }
33
34
35 inline void operator|=(state & s1, state s2)
36 {
37         s1 = static_cast<state>(s1 | s2);
38 }
39
40 } // namespace key_modifier
41
42 #endif // KEY_STATE_H