2003-08-23 00:17:00 +00:00
|
|
|
// -*- C++ -*-
|
2002-05-26 17:33:14 +00:00
|
|
|
/**
|
2007-11-12 22:15:51 +00:00
|
|
|
* \file KeyModifier.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
|
|
|
*/
|
|
|
|
|
2007-10-02 21:51:54 +00:00
|
|
|
#ifndef KEYMODIFIER_H
|
|
|
|
#define KEYMODIFIER_H
|
2002-05-26 17:33:14 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
2002-05-26 17:33:14 +00:00
|
|
|
/// modifier key states
|
2006-09-16 18:11:38 +00:00
|
|
|
|
2007-10-02 21:51:54 +00:00
|
|
|
enum KeyModifier {
|
2007-11-12 22:15:51 +00:00
|
|
|
NoModifier = 0, //< no modifiers held
|
2007-10-02 21:51:54 +00:00
|
|
|
ControlModifier = 1, //< control button held
|
2007-11-12 22:15:51 +00:00
|
|
|
AltModifier = 2, //< alt/meta key held
|
2007-11-18 00:39:15 +00:00
|
|
|
ShiftModifier = 4 //< shift key held
|
2006-09-16 18:11:38 +00:00
|
|
|
};
|
2002-05-26 17:33:14 +00:00
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2007-10-02 21:51:54 +00:00
|
|
|
inline KeyModifier operator|(KeyModifier s1, KeyModifier s2)
|
2002-05-26 17:33:14 +00:00
|
|
|
{
|
2006-10-21 00:16:43 +00:00
|
|
|
int const i1 = static_cast<int>(s1);
|
|
|
|
int const i2 = static_cast<int>(s2);
|
2007-10-02 21:51:54 +00:00
|
|
|
return static_cast<KeyModifier>(i1 | i2);
|
2002-05-26 17:33:14 +00:00
|
|
|
}
|
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2007-10-02 21:51:54 +00:00
|
|
|
inline void operator|=(KeyModifier & s1, KeyModifier s2)
|
2002-05-26 17:33:14 +00:00
|
|
|
{
|
2007-10-02 21:51:54 +00:00
|
|
|
s1 = static_cast<KeyModifier>(s1 | s2);
|
2002-05-26 17:33:14 +00:00
|
|
|
}
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
2007-11-12 22:15:51 +00:00
|
|
|
#endif // KEYMODIFIER_H
|