File: keyboardstate.hh

package info (click to toggle)
goldendict 1.5.0~rc2%2Bgit20221126%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 17,376 kB
  • sloc: cpp: 60,569; ansic: 11,511; xml: 529; makefile: 74; sh: 42
file content (33 lines) | stat: -rw-r--r-- 883 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* This file is (c) 2008-2012 Konstantin Isakov <ikm@goldendict.org>
 * 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:

  enum Modifier
  {
    Alt = 1,
    Ctrl = 2,
    Shift = 4,
    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
  };

  /// Returns true if all Modifiers present within the given mask are pressed
  /// right now.
  bool checkModifiersPressed( int mask );
};

#endif