1 // synthv1widget_wave.h 2 // 3 /**************************************************************************** 4 Copyright (C) 2012-2021, rncbc aka Rui Nuno Capela. All rights reserved. 5 6 This program is free software; you can redistribute it and/or 7 modify it under the terms of the GNU General Public License 8 as published by the Free Software Foundation; either version 2 9 of the License, or (at your option) any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License along 17 with this program; if not, write to the Free Software Foundation, Inc., 18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 20 *****************************************************************************/ 21 22 #ifndef __synthv1widget_wave_h 23 #define __synthv1widget_wave_h 24 25 #include <QFrame> 26 27 28 // Forward decl. 29 class synthv1_wave_lf; 30 31 32 //---------------------------------------------------------------------------- 33 // synthv1widget_wave -- Custom widget 34 35 class synthv1widget_wave : public QFrame 36 { 37 Q_OBJECT 38 39 public: 40 41 // Constructor. 42 synthv1widget_wave(QWidget *pParent = nullptr); 43 // Destructor. 44 ~synthv1widget_wave(); 45 46 // Parameter getters. 47 float waveShape() const; 48 float waveWidth() const; 49 50 public slots: 51 52 // Parameter setters. 53 void setWaveShape(float fWaveShape); 54 void setWaveWidth(float fWaveWidth); 55 56 signals: 57 58 // Parameter change signals. 59 void waveShapeChanged(float fWaveShape); 60 void waveWidthChanged(float fWaveWidth); 61 62 protected: 63 64 // Draw canvas. 65 void paintEvent(QPaintEvent *); 66 67 // Drag/move curve. 68 void dragCurve(const QPoint& pos); 69 70 // Mouse interaction. 71 void mousePressEvent(QMouseEvent *pMouseEvent); 72 void mouseMoveEvent(QMouseEvent *pMouseEvent); 73 void mouseReleaseEvent(QMouseEvent *pMouseEvent); 74 void mouseDoubleClickEvent(QMouseEvent *pMouseEvent); 75 void wheelEvent(QWheelEvent *pWheelEvent); 76 77 private: 78 79 // Instance state. 80 synthv1_wave_lf *m_pWave; 81 82 // Drag state. 83 bool m_bDragging; 84 int m_iDragShape; 85 QPoint m_posDrag; 86 }; 87 88 #endif // __synthv1widget_wave_h 89 90 91 // end of synthv1widget_wave.h 92