SpaceballEvent.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (c) 2010 Thomas Anderson <ta@nextgenengineering>            *
00003  *                                                                         *
00004  *   This file is part of the FreeCAD CAx development system.              *
00005  *                                                                         *
00006  *   This library is free software; you can redistribute it and/or         *
00007  *   modify it under the terms of the GNU Library General Public           *
00008  *   License as published by the Free Software Foundation; either          *
00009  *   version 2 of the License, or (at your option) any later version.      *
00010  *                                                                         *
00011  *   This library  is distributed in the hope that it will be useful,      *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU Library General Public License for more details.                  *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Library General Public     *
00017  *   License along with this library; see the file COPYING.LIB. If not,    *
00018  *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
00019  *   Suite 330, Boston, MA  02111-1307, USA                                *
00020  *                                                                         *
00021  ***************************************************************************/
00022 
00023 #include "PreCompiled.h"
00024 #include "SpaceballEvent.h"
00025 
00026 using namespace Spaceball;
00027 
00028 int MotionEvent::MotionEventType = -1;
00029 int ButtonEvent::ButtonEventType = -1;
00030 
00031 MotionEvent::MotionEvent() : QInputEvent(static_cast<QEvent::Type>(MotionEventType)),
00032     xTrans(0), yTrans(0), zTrans(0), xRot(0), yRot(0), zRot(0)
00033 {
00034 }
00035 
00036 void MotionEvent::translations(int &xTransOut, int &yTransOut, int &zTransOut)
00037 {
00038     xTransOut = xTrans;
00039     yTransOut = yTrans;
00040     zTransOut = zTrans;
00041 }
00042 
00043 void MotionEvent::setTranslations(const int &xTransIn, const int &yTransIn, const int &zTransIn)
00044 {
00045     xTrans = xTransIn;
00046     yTrans = yTransIn;
00047     zTrans = zTransIn;
00048 }
00049 
00050 void MotionEvent::rotations(int &xRotOut, int &yRotOut, int &zRotOut)
00051 {
00052     xRotOut = xRot;
00053     yRotOut = yRot;
00054     zRotOut = zRot;
00055 }
00056 
00057 void MotionEvent::setRotations(const int &xRotIn, const int &yRotIn, const int &zRotIn)
00058 {
00059     xRot = xRotIn;
00060     yRot = yRotIn;
00061     zRot = zRotIn;
00062 }
00063 
00064 
00065 ButtonEvent::ButtonEvent() : QInputEvent(static_cast<QEvent::Type>(ButtonEventType)),
00066     buttonState(BUTTON_NONE), button(0), handled(false)
00067 {
00068 }
00069 
00070 ButtonEvent::ButtonEvent(const ButtonEvent& in) : QInputEvent(static_cast<QEvent::Type>(ButtonEventType))
00071 {
00072     buttonState = in.buttonState;
00073     button = in.button;
00074     handled = in.handled;
00075 }
00076 
00077 ButtonStateType ButtonEvent::buttonStatus()
00078 {
00079     return buttonState;
00080 }
00081 
00082 void ButtonEvent::setButtonStatus(const ButtonStateType &buttonStatusIn)
00083 {
00084     buttonState = buttonStatusIn;
00085 }
00086 
00087 int ButtonEvent::buttonNumber()
00088 {
00089     return button;
00090 }
00091 
00092 void ButtonEvent::setButtonNumber(const int &buttonNumberIn)
00093 {
00094     button = buttonNumberIn;
00095 }

Generated on Wed Nov 23 19:00:40 2011 for FreeCAD by  doxygen 1.6.1