File indexing completed on 2024-05-12 04:19:50

0001 // vim: set tabstop=4 shiftwidth=4 expandtab:
0002 /*
0003 Gwenview: an image viewer
0004 Copyright 2008 Aurélien Gâteau <agateau@kde.org>
0005 Copyright 2008 Ilya Konkov <eruart@gmail.com>
0006 
0007 This program is free software; you can redistribute it and/or
0008 modify it under the terms of the GNU General Public License
0009 as published by the Free Software Foundation; either version 2
0010 of the License, or (at your option) any later version.
0011 
0012 This program is distributed in the hope that it will be useful,
0013 but WITHOUT ANY WARRANTY; without even the implied warranty of
0014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0015 GNU General Public License for more details.
0016 
0017 You should have received a copy of the GNU General Public License
0018 along with this program; if not, write to the Free Software
0019 Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA.
0020 
0021 */
0022 #ifndef THUMBNAILBARVIEW_H
0023 #define THUMBNAILBARVIEW_H
0024 
0025 #include <lib/gwenviewlib_export.h>
0026 
0027 // Qt
0028 #include <QAbstractItemDelegate>
0029 
0030 // KF
0031 
0032 // Local
0033 #include <lib/thumbnailview/thumbnailview.h>
0034 
0035 namespace Gwenview
0036 {
0037 struct ThumbnailBarItemDelegatePrivate;
0038 
0039 class GWENVIEWLIB_EXPORT ThumbnailBarItemDelegate : public QAbstractItemDelegate
0040 {
0041     Q_OBJECT
0042 public:
0043     ThumbnailBarItemDelegate(ThumbnailView *);
0044     ~ThumbnailBarItemDelegate() override;
0045 
0046     void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
0047     QSize sizeHint(const QStyleOptionViewItem & /*option*/, const QModelIndex & /*index*/) const override;
0048 
0049 protected:
0050     bool eventFilter(QObject *, QEvent *) override;
0051 
0052 private Q_SLOTS:
0053     void toggleSelection();
0054 
0055 private:
0056     ThumbnailBarItemDelegatePrivate *const d;
0057     friend struct ThumbnailBarItemDelegatePrivate;
0058 };
0059 
0060 struct ThumbnailBarViewPrivate;
0061 class GWENVIEWLIB_EXPORT ThumbnailBarView : public ThumbnailView
0062 {
0063     Q_OBJECT
0064 public:
0065     ThumbnailBarView(QWidget * = nullptr);
0066     ~ThumbnailBarView() override;
0067 
0068     Qt::Orientation orientation() const;
0069     void setOrientation(Qt::Orientation);
0070 
0071     int rowCount() const;
0072     void setRowCount(int);
0073 
0074 protected:
0075     void resizeEvent(QResizeEvent *event) override;
0076     void wheelEvent(QWheelEvent *event) override;
0077     void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) override;
0078 
0079 private Q_SLOTS:
0080     void slotFrameChanged(int);
0081 
0082 private:
0083     ThumbnailBarViewPrivate *const d;
0084 };
0085 
0086 } // namespace
0087 
0088 #endif /* THUMBNAILBARVIEW_H */