libs/flake

KoPointerEvent.h

Go to the documentation of this file.
00001 /* This file is part of the KDE project
00002 
00003    Copyright (C) 2006 Thorsten Zachmann <zachmann@kde.org>
00004    Copyright (C) 2006 Casper Boemann Rasmussen <cbr@boemann.dk>
00005    Copyright (C) 2006-2007 Thomas Zander <zander@kde.org>
00006 
00007    This library is free software; you can redistribute it and/or
00008    modify it under the terms of the GNU Library General Public
00009    License as published by the Free Software Foundation; either
00010    version 2 of the License, or (at your option) any later version.
00011 
00012    This library is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015    Library General Public License for more details.
00016 
00017    You should have received a copy of the GNU Library General Public License
00018    along with this library; see the file COPYING.LIB.  If not, write to
00019    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020  * Boston, MA 02110-1301, USA.
00021 */
00022 
00023 #ifndef KOPOINTEREVENT_H
00024 #define KOPOINTEREVENT_H
00025 
00026 #include <QInputEvent>
00027 
00028 class QTabletEvent;
00029 class QMouseEvent;
00030 class QWheelEvent;
00031 class KoDeviceEvent;
00032 
00033 #include "flake_export.h"
00034 
00042 class FLAKE_EXPORT KoPointerEvent
00043 {
00044 public:
00051     KoPointerEvent(QMouseEvent *ev, const QPointF &pnt);
00052 
00059     KoPointerEvent(QTabletEvent *ev, const QPointF &pnt);
00060 
00067     KoPointerEvent(QWheelEvent *ev, const QPointF &pnt);
00068 
00069     KoPointerEvent(KoDeviceEvent * ev, int x, int y, int z = 0, int rx = 0, int ry = 0, int rz = 0);
00070 
00071     ~KoPointerEvent();
00072 
00078     inline void accept() {
00079         m_event->accept();
00080     }
00081 
00087     inline void ignore() {
00088         m_event->ignore();
00089     }
00090 
00095     Qt::KeyboardModifiers modifiers() const {
00096         return m_event->modifiers();
00097     }
00098 
00100     inline bool isAccepted() const {
00101         return m_event->isAccepted();
00102     }
00103 
00105     inline bool spontaneous() const {
00106         return m_event->spontaneous();
00107     }
00108 
00110     Qt::MouseButton button() const;
00111 
00113     Qt::MouseButtons buttons() const;
00114 
00116     const QPoint & globalPos();
00117 
00119     const QPoint & pos() const;
00120 
00126     qreal pressure() const;
00127 
00129     qreal rotation() const;
00130 
00138     qreal tangentialPressure() const;
00139 
00144     int x() const;
00145 
00152     int xTilt() const;
00153 
00158     int y() const;
00159 
00166     int yTilt() const;
00167 
00173     int z() const;
00174 
00180     int delta() const;
00181 
00186     int rotationX() const;
00187 
00192     int rotationY() const;
00193 
00198     int rotationZ() const;
00199 
00203     Qt::Orientation orientation() const;
00204 
00206     const QPointF point;
00207 
00208 protected:
00209     friend class KoToolProxy;
00211     void setTabletButton(Qt::MouseButton button);
00212 private:
00213     // for the d-pointer police; we want to make accessors to the event inline, so this one stays here.
00214     QInputEvent * m_event;
00215 
00216     class Private;
00217     Private * const d;
00218 };
00219 
00220 #endif
00221