krita

kis_event.h

00001 /*
00002  *  Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  */
00018 #ifndef KIS_EVENT_H_
00019 #define KIS_EVENT_H_
00020 
00021 #include <qevent.h>
00022 
00023 #include "kis_point.h"
00024 #include "kis_input_device.h"
00025 
00026 class KisEvent {
00027 public:
00028     enum enumEventType {
00029         UnknownEvent,
00030         MoveEvent,
00031         ButtonPressEvent,
00032         ButtonReleaseEvent,
00033         DoubleClickEvent
00034     };
00035 
00036     KisEvent() : m_type(UnknownEvent), m_device(KisInputDevice::unknown()) {}
00037     KisEvent(enumEventType type, KisInputDevice device, const KisPoint& pos, const KisPoint& globalPos, double pressure, double xTilt, double yTilt, Qt::ButtonState state) : m_type(type), m_device(device), m_pos(pos), m_globalPos(globalPos), m_pressure(pressure), m_xTilt(xTilt), m_yTilt(yTilt), m_state(state) {}
00038 
00039     enumEventType type() const { return m_type; }
00040     KisInputDevice device() const { return m_device; }
00041     KisPoint pos() const { return m_pos; }
00042     double x() const { return m_pos.x(); }
00043     double y() const { return m_pos.y(); }
00044     KisPoint globalPos() const { return m_globalPos; }
00045     double pressure() const { return m_pressure; }
00046     double xTilt() const { return m_xTilt; }
00047     double yTilt() const { return m_yTilt; }
00048     Qt::ButtonState state() const { return m_state; }
00049 
00050 protected:
00051     enumEventType m_type;
00052     KisInputDevice m_device;
00053     KisPoint m_pos;
00054     KisPoint m_globalPos;
00055     double m_pressure;
00056     double m_xTilt;
00057     double m_yTilt;
00058     Qt::ButtonState m_state;
00059 };
00060 
00061 #endif // KIS_EVENT_H_
00062 
KDE Home | KDE Accessibility Home | Description of Access Keys