2009-02-05 14:21:47 +00:00
|
|
|
/* This file is (c) 2008-2009 Konstantin Isakov <ikm@users.berlios.de>
|
2009-02-01 00:08:08 +00:00
|
|
|
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
|
|
|
|
|
|
|
|
#ifndef __KEYBOARDSTATE_HH_INCLUDED__
|
|
|
|
#define __KEYBOARDSTATE_HH_INCLUDED__
|
|
|
|
|
|
|
|
/// Since Qt doesn't provide a way to test for keyboard modifiers state
|
|
|
|
/// when the app isn't in focus, we have to implement this separately for
|
|
|
|
/// each platform.
|
|
|
|
class KeyboardState
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2009-02-05 17:09:34 +00:00
|
|
|
enum Modifier
|
2009-02-01 00:08:08 +00:00
|
|
|
{
|
|
|
|
Alt = 1,
|
|
|
|
Ctrl = 2,
|
|
|
|
Shift = 4,
|
2009-02-05 16:56:57 +00:00
|
|
|
Win = 8, // Ironically, Linux only, since it's no use under Windows
|
|
|
|
LeftAlt = 16, // Those Left-Right are Windows-only, at least for now
|
|
|
|
RightAlt = 32,
|
|
|
|
LeftCtrl = 64,
|
|
|
|
RightCtrl = 128,
|
|
|
|
LeftShift = 256,
|
|
|
|
RightShift = 512
|
2009-02-05 17:09:34 +00:00
|
|
|
};
|
2009-02-01 00:08:08 +00:00
|
|
|
|
|
|
|
/// Returns true if all Modifiers present within the given mask are pressed
|
|
|
|
/// right now.
|
|
|
|
bool checkModifiersPressed( int mask );
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|