2003-08-23 00:17:00 +00:00
|
|
|
// -*- C++ -*-
|
2002-05-26 17:33:14 +00:00
|
|
|
/**
|
|
|
|
* \file key_state.h
|
2002-09-05 15:14:23 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-05-26 17:33:14 +00:00
|
|
|
*
|
|
|
|
* Keyboard modifier state representation.
|
|
|
|
*
|
2002-12-01 22:59:25 +00:00
|
|
|
* \author John Levon
|
2002-09-05 14:10:50 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-05-26 17:33:14 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef KEY_STATE_H
|
|
|
|
#define KEY_STATE_H
|
|
|
|
|
|
|
|
/// modifier key states
|
2002-12-01 22:59:25 +00:00
|
|
|
namespace key_modifier {
|
2002-05-26 17:33:14 +00:00
|
|
|
enum state {
|
|
|
|
none = 0, //< no modifiers held
|
2002-12-01 22:59:25 +00:00
|
|
|
ctrl = 1, //< control button held
|
2002-05-26 17:33:14 +00:00
|
|
|
alt = 2, //< alt/meta key held
|
|
|
|
shift = 4 //< shift key held
|
|
|
|
};
|
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-05-26 17:33:14 +00:00
|
|
|
inline state operator|(state const & s1, state const & s2)
|
|
|
|
{
|
|
|
|
int const i1(static_cast<int>(s1));
|
|
|
|
int const i2(static_cast<int>(s2));
|
|
|
|
return static_cast<state>(i1 | i2);
|
|
|
|
}
|
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-05-26 17:33:14 +00:00
|
|
|
inline void operator|=(state & s1, state s2)
|
|
|
|
{
|
2002-12-01 22:59:25 +00:00
|
|
|
s1 = static_cast<state>(s1 | s2);
|
2002-05-26 17:33:14 +00:00
|
|
|
}
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-05-26 17:33:14 +00:00
|
|
|
} // namespace key_modifier
|
|
|
|
|
|
|
|
#endif // KEY_STATE_H
|