Rabbit Remote Control 0.1.0-bate8
Loading...
Searching...
No Matches
InputDevice.h
1// Author: Kang Lin <kl222@126.com>
2
3#ifndef CINPUTDEVICE_H
4#define CINPUTDEVICE_H
5
6#pragma once
7#include "service_export.h"
8#include <QPoint>
9#include <QSharedPointer>
10
11class SERVICE_EXPORT CInputDevice
12{
13public:
14 static QSharedPointer<CInputDevice> GenerateObject();
15
16 enum MouseButton
17 {
18 LeftButton = 0x01,
19 RightButton = 0x02,
20 MiddleButton = 0x04,
21 LWheelButton = 0x08,
22 RWheelButton = 0x10,
23 UWheelButton = 0x20,
24 DWheelButton = 0x40
25 };
26 Q_ENUM(MouseButton)
27 Q_DECLARE_FLAGS(MouseButtons, MouseButton)
28 Q_FLAG(MouseButtons)
29 virtual int KeyEvent(quint32 keysym, quint32 keycode, bool down = true) = 0;
30 virtual int MouseEvent(MouseButtons buttons, QPoint pos) = 0;
31 virtual int MouseEvent(MouseButtons buttons, int x, int y) = 0;
32
33protected:
34 MouseButtons m_LastButtons;
35 QPoint m_LastPostion;
36
37 explicit CInputDevice(){}
38};
39
40// 在类外部声明操作符(通常放在头文件末尾)
41Q_DECLARE_OPERATORS_FOR_FLAGS(CInputDevice::MouseButtons)
42#endif // CINPUTDEVICE_H