File indexing completed on 2024-04-21 15:24:03

0001 // This file is part of Washi Pad
0002 // SPDX-FileCopyrightText: 2018 Kevin Ottens <ervin@kde.org>
0003 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 
0005 #pragma once
0006 
0007 #include "stroke.h"
0008 
0009 class QTabletEvent;
0010 
0011 class Event
0012 {
0013     Q_GADGET
0014     Q_PROPERTY(float x MEMBER x)
0015     Q_PROPERTY(float y MEMBER y)
0016     Q_PROPERTY(float pressure MEMBER pressure)
0017     Q_PROPERTY(Pointer pointer MEMBER pointer)
0018 public:
0019     enum class Pointer
0020     {
0021         Pen,
0022         Eraser,
0023     };
0024     Q_ENUM(Pointer)
0025 
0026     float x = 0.0f;
0027     float y = 0.0f;
0028     float pressure = 0.0f;
0029     Pointer pointer = Pointer::Pen;
0030 };
0031 
0032 class TabletEvent: Event
0033 {
0034 public:
0035     static Event create(QTabletEvent* event);
0036 };
0037 
0038 class MouseEvent: Event
0039 {
0040 public:
0041     static Event create(const float x, const float y, const int button);
0042 };