| 1 | /* |
| 2 | SPDX-FileCopyrightText: 2007 Peter Penz <peter.penz@gmx.at> |
| 3 | SPDX-FileCopyrightText: 2019 Méven Car <meven.car@kdemail.net> |
| 4 | |
| 5 | SPDX-License-Identifier: LGPL-2.0-only |
| 6 | */ |
| 7 | |
| 8 | #ifndef KDIROPERATORICONVIEW_P_H |
| 9 | #define KDIROPERATORICONVIEW_P_H |
| 10 | |
| 11 | #include <KDirOperator> |
| 12 | #include <QListView> |
| 13 | |
| 14 | /*! |
| 15 | * Default icon view for KDirOperator using |
| 16 | * custom view options. |
| 17 | * |
| 18 | * \internal |
| 19 | */ |
| 20 | class KDirOperatorIconView : public QListView |
| 21 | { |
| 22 | Q_OBJECT |
| 23 | public: |
| 24 | KDirOperatorIconView(KDirOperator *dirOperator, |
| 25 | QWidget *parent = nullptr, |
| 26 | QStyleOptionViewItem::Position decorationPosition = QStyleOptionViewItem::Position::Top); |
| 27 | ~KDirOperatorIconView() override; |
| 28 | void setDecorationPosition(QStyleOptionViewItem::Position decorationPosition); |
| 29 | |
| 30 | protected: |
| 31 | void initViewItemOption(QStyleOptionViewItem *option) const override; |
| 32 | void dragEnterEvent(QDragEnterEvent *event) override; |
| 33 | void mousePressEvent(QMouseEvent *event) override; |
| 34 | void mouseMoveEvent(QMouseEvent *event) override; |
| 35 | void mouseReleaseEvent(QMouseEvent *event) override; |
| 36 | void wheelEvent(QWheelEvent *event) override; |
| 37 | void resizeEvent(QResizeEvent *event) override; |
| 38 | |
| 39 | protected |
| 40 | Q_SLOT : void updateLayout(); |
| 41 | |
| 42 | private: |
| 43 | QStyleOptionViewItem::Position decorationPosition; |
| 44 | bool m_isEmblemClicked; |
| 45 | KDirOperator *m_dirOperator; |
| 46 | }; |
| 47 | |
| 48 | #endif // KDIROPERATORICONVIEW_P_H |
| 49 | |