| #pragma once |
| |
| #ifndef DVSCROLLWIDGET_H |
| #define DVSCROLLWIDGET_H |
| |
| |
| #include "tcommon.h" |
| |
| |
| #include <QFrame> |
| #include <QEasingCurve> |
| |
| #undef DVAPI |
| #undef DVVAR |
| #ifdef TOONZQT_EXPORTS |
| #define DVAPI DV_EXPORT_API |
| #define DVVAR DV_EXPORT_VAR |
| #else |
| #define DVAPI DV_IMPORT_API |
| #define DVVAR DV_IMPORT_VAR |
| #endif |
| |
| |
| |
| |
| |
| class FreeLayout; |
| class QPropertyAnimation; |
| class QPushButton; |
| class QTimer; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| class DVAPI DvScrollWidget final : public QFrame { |
| Q_OBJECT |
| |
| QWidget *m_content; |
| QPushButton *m_scrollBackward, *m_scrollForward; |
| |
| QPropertyAnimation *m_animation; |
| QEasingCurve m_clickEase, m_holdEase; |
| QTimer *m_backwardTimer, *m_forwardTimer; |
| |
| int m_mousePos; |
| |
| bool m_horizontal, m_pressed, m_heldRelease, m_heldClick; |
| |
| public: |
| DvScrollWidget(QWidget *parent = 0, Qt::Orientation = Qt::Horizontal); |
| ~DvScrollWidget() {} |
| |
| |
| |
| |
| |
| void setWidget(QWidget *widget); |
| |
| |
| |
| |
| void setOrientation(Qt::Orientation orientation); |
| Qt::Orientation getOrientation() const; |
| |
| void setEasing(QEasingCurve clickEase, QEasingCurve holdPressEase); |
| |
| void scroll(int dx, int duration = 0, |
| QEasingCurve easing = QEasingCurve(QEasingCurve::OutCubic)); |
| void scrollTo(int pos, int duration = 0, |
| QEasingCurve easing = QEasingCurve(QEasingCurve::OutCubic)); |
| |
| public slots: |
| |
| void scrollBackward(); |
| void scrollForward(); |
| |
| protected: |
| void resizeEvent(QResizeEvent *re) override; |
| void mousePressEvent(QMouseEvent *me) override; |
| void mouseMoveEvent(QMouseEvent *me) override; |
| void mouseReleaseEvent(QMouseEvent *me) override; |
| void showEvent(QShowEvent *se) override; |
| |
| protected slots: |
| |
| void updateButtonsVisibility(); |
| |
| void holdBackward(); |
| void holdForward(); |
| |
| void releaseBackward(); |
| void releaseForward(); |
| }; |
| |
| #endif // DVSCROLLWIDGET_H |