kitemlistrubberband.h 1.08 KB
Newer Older
1 2 3 4 5
/*
 * SPDX-FileCopyrightText: 2011 Peter Penz <peter.penz19@gmail.com>
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */
6 7 8 9

#ifndef KITEMLISTRUBBERBAND_H
#define KITEMLISTRUBBERBAND_H

10
#include "dolphin_export.h"
Roman Inflianskas's avatar
Roman Inflianskas committed
11

12 13 14 15 16 17
#include <QObject>
#include <QPointF>

/**
 * @brief Manages the rubberband when selecting items.
 */
18
class DOLPHIN_EXPORT KItemListRubberBand : public QObject
19 20
{
    Q_OBJECT
Steffen Hartleib's avatar
Steffen Hartleib committed
21
    Q_PROPERTY(QPointF endPosition MEMBER m_endPos READ endPosition WRITE setEndPosition)
22 23

public:
Kevin Funk's avatar
Kevin Funk committed
24
    explicit KItemListRubberBand(QObject* parent = nullptr);
25
    ~KItemListRubberBand() override;
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49

    void setStartPosition(const QPointF& pos);
    QPointF startPosition() const;

    void setEndPosition(const QPointF& pos);
    QPointF endPosition() const;

    void setActive(bool active);
    bool isActive() const;

signals:
    void activationChanged(bool active);
    void startPositionChanged(const QPointF& current, const QPointF& previous);
    void endPositionChanged(const QPointF& current, const QPointF& previous);

private:
    bool m_active;
    QPointF m_startPos;
    QPointF m_endPos;
};

#endif