AntiMicroX
axisvaluebox.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 AXISVALUEBOX_H
20 #define AXISVALUEBOX_H
21 
22 #include <QWidget>
23 
24 class QResizeEvent;
25 class QPaintEvent;
26 class JoyAxis;
27 
28 class AxisValueBox : public QWidget
29 {
30  Q_OBJECT
31  public:
32  explicit AxisValueBox(QWidget *parent = nullptr);
33 
34  int getDeadZone();
35  int getMaxZone();
36  int getJoyValue();
37  int getThrottle();
38  int getMinAxValue();
39  int getMaxAxValue();
40 
41  protected:
42  virtual void resizeEvent(QResizeEvent *event);
43  virtual void paintEvent(QPaintEvent *event);
44 
45  public slots:
46  void setThrottle(int throttle);
47  void setValue(int value);
48  void setValue(JoyAxis *axis, int value);
49  void setDeadZone(int deadZone);
50  void setDeadZone(JoyAxis *axis, int deadZone);
51  void setMaxZone(int maxZone);
52  void setMaxZone(JoyAxis *axis, int deadZone);
53 
54  private:
57  int m_maxZone;
58  int joyValue;
60  int boxwidth;
61  int boxheight;
62  int lboxstart;
63  int lboxend;
64  int rboxstart;
65  int rboxend;
67  int singleend;
68 };
69 
70 #endif // AXISVALUEBOX_H
AxisValueBox
Definition: axisvaluebox.h:28
AxisValueBox::getMaxZone
int getMaxZone()
Definition: axisvaluebox.cpp:187
JoyAxis
Represents single axis of of joystick (or other input)
Definition: joyaxis.h:40
JoyAxis::NormalThrottle
@ NormalThrottle
Definition: joyaxis.h:52
AxisValueBox::rboxstart
int rboxstart
Definition: axisvaluebox.h:64
AxisValueBox::singleend
int singleend
Definition: axisvaluebox.h:67
globalvariables.h
AxisValueBox::lboxstart
int lboxstart
Definition: axisvaluebox.h:62
JoyAxis::NegativeHalfThrottle
@ NegativeHalfThrottle
Definition: joyaxis.h:50
AxisValueBox::getMinAxValue
int getMinAxValue()
Definition: axisvaluebox.cpp:290
AxisValueBox::m_maxZone
int m_maxZone
Definition: axisvaluebox.h:57
AxisValueBox::getMaxAxValue
int getMaxAxValue()
Definition: axisvaluebox.cpp:288
AxisValueBox::m_throttle
int m_throttle
Definition: axisvaluebox.h:59
AxisValueBox::m_deadZone
int m_deadZone
Definition: axisvaluebox.h:56
JoyAxis::PositiveThrottle
@ PositiveThrottle
Definition: joyaxis.h:53
AxisValueBox::getDeadZone
int getDeadZone()
Definition: axisvaluebox.cpp:163
AxisValueBox::setThrottle
void setThrottle(int throttle)
Definition: axisvaluebox.cpp:49
AxisValueBox::joyValue
int joyValue
Definition: axisvaluebox.h:58
AxisValueBox::getThrottle
int getThrottle()
Definition: axisvaluebox.cpp:191
JoyAxis::PositiveHalfThrottle
@ PositiveHalfThrottle
Definition: joyaxis.h:54
AxisValueBox::paintEvent
virtual void paintEvent(QPaintEvent *event)
Definition: axisvaluebox.cpp:210
AxisValueBox::setValue
void setValue(int value)
Definition: axisvaluebox.cpp:65
AxisValueBox::singlewidth
int singlewidth
Definition: axisvaluebox.h:66
GlobalVariables::JoyAxis::AXISMIN
static const int AXISMIN
Definition: globalvariables.h:117
GlobalVariables::JoyAxis::AXISMAX
static const int AXISMAX
Definition: globalvariables.h:118
JoyAxis::NegativeThrottle
@ NegativeThrottle
Definition: joyaxis.h:51
AxisValueBox::AxisValueBox
AxisValueBox(QWidget *parent=nullptr)
Definition: axisvaluebox.cpp:31
axisvaluebox.h
joyaxis.h
AxisValueBox::rboxend
int rboxend
Definition: axisvaluebox.h:65
AxisValueBox::boxheight
int boxheight
Definition: axisvaluebox.h:61
AxisValueBox::m_axis
JoyAxis * m_axis
Definition: axisvaluebox.h:55
AxisValueBox::boxwidth
int boxwidth
Definition: axisvaluebox.h:60
AxisValueBox::lboxend
int lboxend
Definition: axisvaluebox.h:63
AxisValueBox::setDeadZone
void setDeadZone(int deadZone)
Definition: axisvaluebox.cpp:141
AxisValueBox::getJoyValue
int getJoyValue()
Definition: axisvaluebox.cpp:189
AxisValueBox::resizeEvent
virtual void resizeEvent(QResizeEvent *event)
Definition: axisvaluebox.cpp:193
AxisValueBox::setMaxZone
void setMaxZone(int maxZone)
Definition: axisvaluebox.cpp:165