File indexing completed on 2024-04-28 15:30:20

0001 /*
0002     SPDX-FileCopyrightText: 2006 Hamish Rodda <rodda@kde.org>
0003     SPDX-FileCopyrightText: 2007-2008 David Nolden <david.nolden.kdevelop@art-master.de>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef KATECOMPLETIONTREE_H
0009 #define KATECOMPLETIONTREE_H
0010 
0011 #include <QTreeView>
0012 
0013 class KateCompletionWidget;
0014 class KateCompletionModel;
0015 
0016 class QTimer;
0017 
0018 class KateCompletionTree final : public QTreeView
0019 {
0020     Q_OBJECT
0021 
0022 public:
0023     explicit KateCompletionTree(KateCompletionWidget *parent);
0024 
0025     KateCompletionWidget *widget() const;
0026     KateCompletionModel *kateModel() const;
0027 
0028     void resizeColumns(bool firstShow = false, bool forceResize = false);
0029 
0030     int sizeHintForColumn(int column) const override
0031     {
0032         return columnWidth(column);
0033     }
0034 
0035     // Navigation
0036     bool nextCompletion();
0037     bool previousCompletion();
0038     bool pageDown();
0039     bool pageUp();
0040     void top();
0041     void bottom();
0042 
0043     void scheduleUpdate();
0044 
0045     void setScrollingEnabled(bool);
0046 
0047 private Q_SLOTS:
0048     void resizeColumnsSlot();
0049 
0050 protected:
0051     void currentChanged(const QModelIndex &current, const QModelIndex &previous) override; /// Not available as a signal in this way
0052     void scrollContentsBy(int dx, int dy) override;
0053     QStyleOptionViewItem viewOptions() const override;
0054 
0055 private:
0056     bool m_scrollingEnabled;
0057     QTimer *m_resizeTimer;
0058 };
0059 
0060 #endif