File indexing completed on 2025-04-27 03:58:26

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2006-01-20
0007  * Description : action categorized view
0008  *
0009  * SPDX-FileCopyrightText: 2006-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #ifndef DIGIKAM_ACTION_CATEGORIZED_VIEW_H
0016 #define DIGIKAM_ACTION_CATEGORIZED_VIEW_H
0017 
0018 // Local includes
0019 
0020 #include "digikam_export.h"
0021 #include "dcategorizedview.h"
0022 
0023 class QWidget;
0024 class QEvent;
0025 class QScrollBar;
0026 class QMouseEvent;
0027 class QPropertyAnimation;
0028 
0029 namespace Digikam
0030 {
0031 
0032 class DIGIKAM_EXPORT ActionCategorizedView : public DCategorizedView
0033 {
0034     Q_OBJECT
0035 
0036 public:
0037 
0038     explicit ActionCategorizedView(QWidget* const parent = nullptr, bool autoScroll = false);
0039     ~ActionCategorizedView()            override;
0040 
0041     void setupIconMode();
0042     void adjustGridSize();
0043 
0044 protected:
0045 
0046     int  autoScrollDuration(float relativeDifference, QPropertyAnimation* animation);
0047     void autoScroll(float relativePos, QScrollBar* scrollBar, QPropertyAnimation* animation);
0048     void mouseMoveEvent(QMouseEvent* e) override;
0049     void leaveEvent(QEvent* e)          override;
0050 
0051 protected:
0052 
0053     QPropertyAnimation* m_verticalScrollAnimation;
0054     QPropertyAnimation* m_horizontalScrollAnimation;
0055     bool                m_autoScroll;
0056 };
0057 
0058 } // namespace Digikam
0059 
0060 #endif // DIGIKAM_ACTION_CATEGORIZED_VIEW_H