SpaceballEvent.h

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 #ifndef SPACEBALLEVENT_H
00024 #define SPACEBALLEVENT_H
00025 
00026 #include <QInputEvent>
00027 namespace Spaceball
00028 {
00029     enum ButtonStateType {BUTTON_NONE = 0, BUTTON_PRESSED, BUTTON_RELEASED};
00030 
00031     class MotionEvent : public QInputEvent
00032     {
00033     public:
00034         MotionEvent();
00035         void translations(int &xTransOut, int &yTransOut, int &zTransOut);
00036         void setTranslations(const int &xTransIn, const int &yTransIn, const int &zTransIn);
00037         int translationX(){return xTrans;}
00038         int translationY(){return yTrans;}
00039         int translationZ(){return zTrans;}
00040 
00041         void rotations(int &xRotOut, int &yRotOut, int &zRotOut);
00042         void setRotations(const int &xRotIn, const int &yRotIn, const int &zRotIn);
00043         int rotationX(){return xRot;}
00044         int rotationY(){return yRot;}
00045         int rotationZ(){return zRot;}
00046 
00047         static int MotionEventType;
00048 
00049     private:
00050         int xTrans;
00051         int yTrans;
00052         int zTrans;
00053         int xRot;
00054         int yRot;
00055         int zRot;
00056     };
00057 
00058     class ButtonEvent : public QInputEvent
00059     {
00060     public:
00061         ButtonEvent();
00062         ButtonEvent(const ButtonEvent& in);
00063         ButtonStateType buttonStatus();
00064         void setButtonStatus(const ButtonStateType &buttonStatusIn);
00065         int buttonNumber();
00066         void setButtonNumber(const int &buttonNumberIn);
00067         bool isHandled(){return handled;}
00068         void setHandled(bool in){handled = in;}
00069 
00070         static int ButtonEventType;
00071 
00072     private:
00073         ButtonStateType buttonState;
00074         int button;
00075         bool handled;
00076     };
00077 }
00078 #endif // SPACEBALLEVENT_H

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