-
Notifications
You must be signed in to change notification settings - Fork 0
/
winsys.h
65 lines (51 loc) · 1.43 KB
/
winsys.h
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef WINSYS_H
#define WINSYS_H
#include <QObject>
#include <QLibrary>
#include <QPoint>
#include <xinput.h>
#include <windows.h>
class WinSys : public QObject
{
Q_OBJECT
Q_PROPERTY(Status status READ status NOTIFY statusChanged)
private:
QLibrary m_xinputLib, m_shellLib;
public:
enum Status
{
StatusOK,
StatusXInputLibraryNotFound,
StatusXInputSymbolNotFound,
StatusShell32NotFound,
StatusShell32SymbolNotFound
};
Q_ENUM(Status)
protected:
Status m_status;
private:
explicit WinSys(QObject *parent = nullptr);
public:
static WinSys* instance();
static void sendUnicodeKeyDown(quint16 unicodeKey);
static void sendUnicodeKeyUp();
static void sendVirtualKeyDown(quint16 unicodeKey);
static void sendVirtualKeyUp();
static void sendKeyDown(bool isVirtual, quint16 unicodeKey);
static void sendKeyUp(bool isVirtual);
static void sendMouseWheel(qint32 scroll);
enum class MouseButton
{
Down, Up, None
};
static void sendMouseButton(MouseButton leftButton, MouseButton rightButton);
static void moveMouse(double deltax, double deltay);
static bool isFullScreenMouseCursorHidden();
static quint32 XInputGetState(DWORD controllerIndex, XINPUT_STATE *xinput);
static bool hasAdminRights();
Status status();
void setStatus(Status status);
signals:
void statusChanged();
};
#endif // WINSYS_H