FreeCAD

Форк
0
/
SpaceballEvent.cpp 
142 строки · 4.1 Кб
1
/***************************************************************************
2
 *   Copyright (c) 2010 Thomas Anderson <ta@nextgenengineering>            *
3
 *                                                                         *
4
 *   This file is part of the FreeCAD CAx development system.              *
5
 *                                                                         *
6
 *   This library is free software; you can redistribute it and/or         *
7
 *   modify it under the terms of the GNU Library General Public           *
8
 *   License as published by the Free Software Foundation; either          *
9
 *   version 2 of the License, or (at your option) any later version.      *
10
 *                                                                         *
11
 *   This library  is distributed in the hope that it will be useful,      *
12
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
13
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
14
 *   GNU Library General Public License for more details.                  *
15
 *                                                                         *
16
 *   You should have received a copy of the GNU Library General Public     *
17
 *   License along with this library; see the file COPYING.LIB. If not,    *
18
 *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
19
 *   Suite 330, Boston, MA  02111-1307, USA                                *
20
 *                                                                         *
21
 ***************************************************************************/
22

23
#include "PreCompiled.h"
24

25
#include "SpaceballEvent.h"
26

27

28
using namespace Spaceball;
29

30
int MotionEvent::MotionEventType = -1;
31
int ButtonEvent::ButtonEventType = -1;
32

33
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
34
EventBase::EventBase(QEvent::Type event) : QInputEvent(static_cast<QEvent::Type>(event))
35
#else
36
EventBase::EventBase(QEvent::Type event) : QInputEvent(static_cast<QEvent::Type>(event), QPointingDevice::primaryPointingDevice())
37
#endif
38
{
39

40
}
41

42
MotionEvent::MotionEvent() : EventBase(static_cast<QEvent::Type>(MotionEventType))
43
{
44
}
45

46
MotionEvent::MotionEvent(const MotionEvent& in) : EventBase(static_cast<QEvent::Type>(MotionEventType))
47
{
48
    xTrans  = in.xTrans;
49
    yTrans  = in.yTrans;
50
    zTrans  = in.zTrans;
51
    xRot    = in.xRot;
52
    yRot    = in.yRot;
53
    zRot    = in.zRot;
54
    handled = in.handled;
55
}
56

57
MotionEvent& MotionEvent::operator= (const MotionEvent& in)
58
{
59
    if (this == &in)
60
        return *this;
61

62
    xTrans  = in.xTrans;
63
    yTrans  = in.yTrans;
64
    zTrans  = in.zTrans;
65
    xRot    = in.xRot;
66
    yRot    = in.yRot;
67
    zRot    = in.zRot;
68
    handled = in.handled;
69
    return *this;
70
}
71

72
void MotionEvent::translations(int &xTransOut, int &yTransOut, int &zTransOut)
73
{
74
    xTransOut = xTrans;
75
    yTransOut = yTrans;
76
    zTransOut = zTrans;
77
}
78

79
void MotionEvent::setTranslations(const int &xTransIn, const int &yTransIn, const int &zTransIn)
80
{
81
    xTrans = xTransIn;
82
    yTrans = yTransIn;
83
    zTrans = zTransIn;
84
}
85

86
void MotionEvent::rotations(int &xRotOut, int &yRotOut, int &zRotOut)
87
{
88
    xRotOut = xRot;
89
    yRotOut = yRot;
90
    zRotOut = zRot;
91
}
92

93
void MotionEvent::setRotations(const int &xRotIn, const int &yRotIn, const int &zRotIn)
94
{
95
    xRot = xRotIn;
96
    yRot = yRotIn;
97
    zRot = zRotIn;
98
}
99

100

101
ButtonEvent::ButtonEvent() : EventBase(static_cast<QEvent::Type>(ButtonEventType)),
102
    buttonState(BUTTON_NONE), button(0)
103
{
104
}
105

106
ButtonEvent::ButtonEvent(const ButtonEvent& in) : EventBase(static_cast<QEvent::Type>(ButtonEventType))
107
{
108
    buttonState = in.buttonState;
109
    button = in.button;
110
    handled = in.handled;
111
}
112

113
ButtonEvent& ButtonEvent::operator= (const ButtonEvent& in)
114
{
115
    if (this == &in)
116
        return *this;
117

118
    buttonState = in.buttonState;
119
    button = in.button;
120
    handled = in.handled;
121
    return *this;
122
}
123

124
ButtonStateType ButtonEvent::buttonStatus()
125
{
126
    return buttonState;
127
}
128

129
void ButtonEvent::setButtonStatus(const ButtonStateType &buttonStatusIn)
130
{
131
    buttonState = buttonStatusIn;
132
}
133

134
int ButtonEvent::buttonNumber()
135
{
136
    return button;
137
}
138

139
void ButtonEvent::setButtonNumber(const int &buttonNumberIn)
140
{
141
    button = buttonNumberIn;
142
}
143

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.