AntiMicroX
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 
24 class JoyButtonSlot;
25 
32 class 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:
64  QString lastErrorString;
65 };
66 
67 #endif // BASEEVENTHANDLER_H
BaseEventHandler::sendMouseSpringEvent
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
BaseEventHandler::getName
virtual QString getName()=0
BaseEventHandler::BaseEventHandler
BaseEventHandler(QObject *parent=nullptr)
Definition: baseeventhandler.cpp:25
BaseEventHandler::sendMouseButtonEvent
virtual void sendMouseButtonEvent(JoyButtonSlot *slot, bool pressed)=0
joybuttonslot.h
BaseEventHandler::init
virtual bool init()=0
JoyButtonSlot
Represents action which can be performed after pressing button.
Definition: joybuttonslot.h:37
BaseEventHandler::sendMouseAbsEvent
virtual void sendMouseAbsEvent(int xDis, int yDis, int screen)
Move cursor to selected absolute location (x, y) on selected display.
Definition: baseeventhandler.cpp:46
BaseEventHandler::getErrorString
QString getErrorString()
Definition: baseeventhandler.cpp:32
BaseEventHandler
Base class for input event handlers.
Definition: baseeventhandler.h:32
BaseEventHandler::cleanup
virtual bool cleanup()=0
BaseEventHandler::sendKeyboardEvent
virtual void sendKeyboardEvent(JoyButtonSlot *slot, bool pressed)=0
baseeventhandler.h
BaseEventHandler::lastErrorString
QString lastErrorString
Definition: baseeventhandler.h:64
BaseEventHandler::~BaseEventHandler
virtual ~BaseEventHandler()
Definition: baseeventhandler.cpp:30
BaseEventHandler::getIdentifier
virtual QString getIdentifier()=0
BaseEventHandler::sendMouseEvent
virtual void sendMouseEvent(int xDis, int yDis)=0
Move cursor to selected relative location (deltax delaty)
BaseEventHandler::sendTextEntryEvent
virtual void sendTextEntryEvent(QString maintext)
Definition: baseeventhandler.cpp:68
BaseEventHandler::printPostMessages
virtual void printPostMessages()
Do nothing by default. Allow child classes to specify text to output to a text stream.
Definition: baseeventhandler.cpp:38