AntiMicroX
Loading...
Searching...
No Matches
baseeventhandler.h
Go to the documentation of this file.
1/* antimicrox Gamepad to KB+M event mapper
2 * Copyright (C) 2015 Travis Nickles <nickles.travis@gmail.com>
3 * Copyright (C) 2020 Jagoda Górska <juliagoda.pl@protonmail>
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef BASEEVENTHANDLER_H
20#define BASEEVENTHANDLER_H
21
22#include <QObject>
23
24class JoyButtonSlot;
25
32class BaseEventHandler : public QObject
33{
34 Q_OBJECT
35
36 public:
37 explicit BaseEventHandler(QObject *parent = nullptr);
38 virtual ~BaseEventHandler();
39
40 virtual bool init() = 0;
41 virtual bool cleanup() = 0;
42
43 virtual void sendKeyboardEvent(JoyButtonSlot *slot, bool pressed) = 0;
44 virtual void sendMouseButtonEvent(JoyButtonSlot *slot, bool pressed) = 0;
48 virtual void sendMouseEvent(int xDis, int yDis) = 0;
52 virtual void sendMouseAbsEvent(int xDis, int yDis, int screen);
53
54 virtual void sendMouseSpringEvent(int xDis, int yDis, int width, int height);
55
56 virtual void sendTextEntryEvent(QString maintext);
57
58 virtual QString getName() = 0;
59 virtual QString getIdentifier() = 0;
60 virtual void printPostMessages();
61 QString getErrorString();
62
63 protected:
65};
66
67#endif // BASEEVENTHANDLER_H
Base class for input event handlers.
Definition baseeventhandler.h:33
virtual ~BaseEventHandler()
Definition baseeventhandler.cpp:30
virtual void sendMouseButtonEvent(JoyButtonSlot *slot, bool pressed)=0
QString getErrorString()
Definition baseeventhandler.cpp:32
virtual bool init()=0
virtual void sendMouseAbsEvent(int xDis, int yDis, int screen)
Move cursor to selected absolute location (x, y) on selected display.
Definition baseeventhandler.cpp:46
virtual QString getName()=0
virtual void sendMouseSpringEvent(int xDis, int yDis, int width, int height)
Do nothing by default. Useful for child classes to define behavior.
Definition baseeventhandler.cpp:60
virtual void printPostMessages()
Do nothing by default. Allow child classes to specify text to output to a text stream.
Definition baseeventhandler.cpp:38
virtual bool cleanup()=0
QString lastErrorString
Definition baseeventhandler.h:64
virtual void sendTextEntryEvent(QString maintext)
Definition baseeventhandler.cpp:68
virtual QString getIdentifier()=0
virtual void sendMouseEvent(int xDis, int yDis)=0
Move cursor to selected relative location (deltax delaty)
virtual void sendKeyboardEvent(JoyButtonSlot *slot, bool pressed)=0
Represents action which can be performed after pressing button.
Definition joybuttonslot.h:38