Warning, file /office/calligra/libs/flake/KoInputDevice.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 * Copyright (c) 2006 Adrian Page <adrian@pagenet.plus.com> 0003 * Copyright (c) 2007 Thomas Zander <zander@kde.org> 0004 0005 This library is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU Library General Public 0007 License as published by the Free Software Foundation; either 0008 version 2 of the License, or (at your option) any later version. 0009 0010 This library is distributed in the hope that it will be useful, 0011 but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0013 Library General Public License for more details. 0014 0015 You should have received a copy of the GNU Library General Public License 0016 along with this library; see the file COPYING.LIB. If not, write to 0017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0018 Boston, MA 02110-1301, USA. 0019 */ 0020 0021 #ifndef KO_INPUT_DEVICE_H_ 0022 #define KO_INPUT_DEVICE_H_ 0023 0024 #include "flake_export.h" 0025 0026 #include <QHash> 0027 #include <QTabletEvent> 0028 #include <QDebug> 0029 0030 /** 0031 * This class represents an input device. 0032 * A user can manipulate flake-shapes using a large variety of input devices. This ranges from 0033 * a mouse to a paintbrush-like tool connected to a tablet. */ 0034 class FLAKE_EXPORT KoInputDevice 0035 { 0036 public: 0037 /** 0038 * Copy constructor. 0039 */ 0040 KoInputDevice(const KoInputDevice &other); 0041 0042 /** 0043 * Constructor for a tablet. 0044 * Create a new input device with one of the many types that the tablet can have. 0045 * @param device the device as found on a QTabletEvent 0046 * @param pointer the pointer as found on a QTabletEvent 0047 * @param uniqueTabletId the uniqueId as found on a QTabletEvent 0048 */ 0049 explicit KoInputDevice(QTabletEvent::TabletDevice device, QTabletEvent::PointerType pointer, qint64 uniqueTabletId = -1); 0050 0051 /** 0052 * Constructor for the mouse as input device. 0053 */ 0054 KoInputDevice(); 0055 0056 ~KoInputDevice(); 0057 0058 /** 0059 * Return the tablet device used 0060 */ 0061 QTabletEvent::TabletDevice device() const; 0062 0063 /** 0064 * Return the pointer used 0065 */ 0066 QTabletEvent::PointerType pointer() const; 0067 0068 /** 0069 * Return the unique tablet id as registered by QTabletEvents. 0070 */ 0071 qint64 uniqueTabletId() const; 0072 0073 /** 0074 * Return if this is a mouse device. 0075 */ 0076 bool isMouse() const; 0077 0078 /// equal 0079 bool operator==(const KoInputDevice&) const; 0080 /// not equal 0081 bool operator!=(const KoInputDevice&) const; 0082 /// assignment 0083 KoInputDevice & operator=(const KoInputDevice &); 0084 0085 static KoInputDevice invalid(); ///< invalid input device 0086 static KoInputDevice mouse(); ///< Standard mouse 0087 static KoInputDevice stylus(); ///< Wacom style/pen 0088 static KoInputDevice eraser(); ///< Wacom eraser 0089 0090 0091 private: 0092 class Private; 0093 Private * const d; 0094 }; 0095 0096 Q_DECLARE_METATYPE(KoInputDevice) 0097 0098 FLAKE_EXPORT QDebug operator<<(QDebug debug, const KoInputDevice &device); 0099 0100 inline uint qHash(const KoInputDevice &key) 0101 { 0102 return qHash(QString(":%1:%2:%3:%4") 0103 .arg(key.device()) 0104 .arg(key.pointer()) 0105 .arg(key.uniqueTabletId()) 0106 .arg(key.isMouse())); 0107 } 0108 0109 #endif 0110