File indexing completed on 2024-04-28 04:21:22

0001 /* SPDX-FileCopyrightText: 2003-2010 Jesper K. Pedersen <blackie@kde.org>
0002 
0003    SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 #ifndef GRIDRESIZEINTERACTION_H
0006 #define GRIDRESIZEINTERACTION_H
0007 #include "MouseInteraction.h"
0008 #include "ThumbnailComponent.h"
0009 
0010 #include <QMouseEvent>
0011 
0012 namespace ThumbnailView
0013 {
0014 class ThumbnailWidget;
0015 
0016 class GridResizeInteraction : public MouseInteraction, private ThumbnailComponent
0017 {
0018 public:
0019     explicit GridResizeInteraction(ThumbnailFactory *factory);
0020     bool mousePressEvent(QMouseEvent *) override;
0021     bool mouseMoveEvent(QMouseEvent *) override;
0022     bool mouseReleaseEvent(QMouseEvent *) override;
0023     bool isResizingGrid() override;
0024     void enterGridResizingMode();
0025     void leaveGridResizingMode();
0026 
0027 private:
0028     void setCellSize(int size);
0029 
0030     /**
0031      * The position the mouse was pressed down, in view port coordinates
0032      */
0033     QPoint m_mousePressPos;
0034 
0035     /**
0036      * This variable contains the size of a cell prior to the beginning of
0037      * resizing the grid.
0038      */
0039     int m_origWidth;
0040 
0041     bool m_resizing;
0042     int m_currentRow;
0043 };
0044 }
0045 
0046 #endif /* GRIDRESIZEINTERACTION_H */
0047 
0048 // vi:expandtab:tabstop=4 shiftwidth=4: