File indexing completed on 2024-12-01 11:19:47

0001 // clang-format off
0002 /*
0003  *  This file is part of KDiff3.
0004  *
0005  * SPDX-FileCopyrightText: 2002-2011 Joachim Eibl, joachim.eibl at gmx.de
0006  * SPDX-FileCopyrightText: 2018-2020 Michael Reeves reeves.87@gmail.com
0007  * SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 // clang-format on
0010 #ifndef OVERVIEW_H
0011 #define OVERVIEW_H
0012 
0013 #include "LineRef.h"       // for LineRef
0014 
0015 #include <memory>
0016 
0017 #include <QString>         // for QString
0018 #include <QPixmap>
0019 #include <QWidget>
0020 
0021 class Diff3LineList;
0022 class Options;
0023 
0024 enum class e_OverviewMode
0025 {
0026     eOMNormal,
0027     eOMAvsB,
0028     eOMAvsC,
0029     eOMBvsC
0030 };
0031 
0032 class Overview : public QWidget
0033 {
0034     Q_OBJECT
0035   public:
0036     Overview();
0037 
0038     void init(Diff3LineList* pDiff3LineList);
0039     void reset();
0040     void setRange(LineRef firstLine, qint32 pageHeight);
0041     void setPaintingAllowed(bool bAllowPainting);
0042 
0043     e_OverviewMode getOverviewMode();
0044 
0045   public Q_SLOTS:
0046     void setOverviewMode(e_OverviewMode eOverviewMode);
0047     void setFirstLine(LineRef firstLine);
0048     void slotRedraw();
0049   Q_SIGNALS:
0050     void setLine(LineRef);
0051 
0052   private:
0053     const Diff3LineList* m_pDiff3LineList;
0054     LineRef m_firstLine;
0055     qint32 m_pageHeight;
0056     QPixmap m_pixmap;
0057     e_OverviewMode mOverviewMode;
0058     LineType m_nofLines;
0059 
0060     void paintEvent(QPaintEvent* e) override;
0061     void mousePressEvent(QMouseEvent* e) override;
0062     void mouseMoveEvent(QMouseEvent* e) override;
0063     void drawColumn(QPainter& p, e_OverviewMode eOverviewMode, qint32 x, qint32 w, qint32 h, qint32 nofLines);
0064 };
0065 
0066 #endif // !OVERVIEW_H