File indexing completed on 2024-04-28 16:44:48

0001 /*
0002     SPDX-License-Identifier: GPL-2.0-only
0003     SPDX-FileCopyrightText: 2003 Mike Pilone <mpilone@slac.com>
0004     SPDX-FileCopyrightText: 2003 Lubos Lunak <l.lunak@kde.org>
0005     SPDX-FileCopyrightText: 2009 Michael Jansen <kde@michael-jansen.biz>
0006  */
0007 
0008 #ifndef GESTURE_RECORDER_H
0009 #define GESTURE_RECORDER_H
0010 
0011 #include "triggers/gestures.h"
0012 
0013 #include <QFrame>
0014 
0015 class QMouseEvent;
0016 
0017 /**
0018  * This widget tracks mouse movements when the left mouse button has been
0019  * pressed while the cursor was over the widget.
0020  * The events are sent to a Stroke. When the mouse button is released the Stroke
0021  * is instructed to process the data; the processed data will then be emitted in
0022  * a "recorded" signal.
0023  */
0024 
0025 class GestureRecorder : public QFrame
0026 {
0027     Q_OBJECT
0028 
0029 public:
0030     GestureRecorder(QWidget *parent, const char *name = "FIXXXXXMMEEEEEEEEEEEEE");
0031     ~GestureRecorder() override;
0032 
0033 protected:
0034     void mousePressEvent(QMouseEvent *) override;
0035     void mouseReleaseEvent(QMouseEvent *) override;
0036     void mouseMoveEvent(QMouseEvent *) override;
0037     void paintEvent(QPaintEvent *) override;
0038 
0039 Q_SIGNALS:
0040 
0041     void recorded(const KHotKeys::StrokePoints &data);
0042 
0043 private:
0044     bool _mouseButtonDown;
0045     KHotKeys::Stroke stroke;
0046 };
0047 
0048 #endif