File indexing completed on 2025-01-19 03:50:37

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2009-02-06
0007  * Description : thumbnail bar for items - the delegate
0008  *
0009  * SPDX-FileCopyrightText: 2010-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
0010  * SPDX-FileCopyrightText: 2010-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #ifndef DIGIKAM_ITEM_THUMBNAIL_DELEGATE_H
0017 #define DIGIKAM_ITEM_THUMBNAIL_DELEGATE_H
0018 
0019 // Qt includes
0020 
0021 #include <QListView>
0022 
0023 // Local includes
0024 
0025 #include "itemdelegate.h"
0026 
0027 namespace Digikam
0028 {
0029 
0030 class ItemCategoryDrawer;
0031 class ItemThumbnailDelegatePrivate;
0032 
0033 class ItemThumbnailDelegate : public ItemDelegate
0034 {
0035     Q_OBJECT
0036 
0037 public:
0038 
0039     explicit ItemThumbnailDelegate(ItemCategorizedView* const parent);
0040     ~ItemThumbnailDelegate()                            override;
0041 
0042     void setFlow(QListView::Flow flow);
0043 
0044     /** Returns the minimum or maximum viewport size in the limiting dimension,
0045      *  width or height, depending on current flow.
0046      */
0047     int maximumSize()                             const;
0048     int minimumSize()                             const;
0049 
0050     void setDefaultViewOptions(const QStyleOptionViewItem& option) override;
0051     bool acceptsActivation(const QPoint& pos,
0052                            const QRect& visualRect,
0053                            const QModelIndex& index,
0054                            QRect* activationRect) const override;
0055 
0056 protected:
0057 
0058     void updateContentWidth()                           override;
0059     void updateRects()                                  override;
0060 
0061 private:
0062 
0063     Q_DECLARE_PRIVATE(ItemThumbnailDelegate)
0064 };
0065 
0066 } // namespace Digikam
0067 
0068 #endif // DIGIKAM_ITEM_THUMBNAIL_DELEGATE_H