chalk

kis_event.h
1/*
2 * Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18#ifndef KIS_EVENT_H_
19#define KIS_EVENT_H_
20
21#include <tqevent.h>
22
23#include "kis_point.h"
24#include "kis_input_device.h"
25
26class KisEvent {
27public:
28 enum enumEventType {
29 UnknownEvent,
30 MoveEvent,
31 ButtonPressEvent,
32 ButtonReleaseEvent,
33 DoubleClickEvent
34 };
35
36 KisEvent() : m_type(UnknownEvent), m_device(KisInputDevice::unknown()) {}
37 KisEvent(enumEventType type, KisInputDevice device, const KisPoint& pos, const KisPoint& globalPos, double pressure, double xTilt, double yTilt, TQt::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) {}
38
39 enumEventType type() const { return m_type; }
40 KisInputDevice device() const { return m_device; }
41 KisPoint pos() const { return m_pos; }
42 double x() const { return m_pos.x(); }
43 double y() const { return m_pos.y(); }
44 KisPoint globalPos() const { return m_globalPos; }
45 double pressure() const { return m_pressure; }
46 double xTilt() const { return m_xTilt; }
47 double yTilt() const { return m_yTilt; }
48 TQt::ButtonState state() const { return m_state; }
49
50protected:
51 enumEventType m_type;
52 KisInputDevice m_device;
53 KisPoint m_pos;
54 KisPoint m_globalPos;
55 double m_pressure;
56 double m_xTilt;
57 double m_yTilt;
58 TQt::ButtonState m_state;
59};
60
61#endif // KIS_EVENT_H_
62