#ifndef SSLIDEBAR_H
#define SSLIDEBAR_H

#include <QObject>
#include <QScrollBar>
#include <QEvent>
#include <QAbstractScrollArea>
#include <QTimer>

class SSlideBar : public QScrollBar
{
public:
    enum SLIDEBAR_TYPE
    {
        SLIDE_HORIZONTAL,
        SLIDE_VERTICAL,
    };

    Q_OBJECT
public:
    explicit SSlideBar(QWidget *parent = nullptr);
    explicit SSlideBar(Qt::Orientation, QWidget *parent = nullptr);
    virtual ~SSlideBar();

    void SetSlideType(SLIDEBAR_TYPE nType);

    bool event(QEvent *event) override;

    void triggerAction(SliderAction action);

    void mousePressEvent(QMouseEvent *) override;
    void mouseReleaseEvent(QMouseEvent *) override;
    void mouseMoveEvent(QMouseEvent *) override;

    void wheelEvent(QWheelEvent *) override;

    virtual void MoveScroll();

protected:
    int m_nSlideType;
    bool m_bPressed;
    bool m_bListUp;
    bool m_bListLeft;

    QTimer m_TimerPressed;

public slots:
    void PressedTimer();

signals:
    void SingleDown();
    void SingleUp();

};

#endif // SSLIDEBAR_H
