1/*
2 SPDX-FileCopyrightText: 2006 Hamish Rodda <rodda@kde.org>
3 SPDX-FileCopyrightText: 2007-2008 David Nolden <david.nolden.kdevelop@art-master.de>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef KATECOMPLETIONTREE_H
9#define KATECOMPLETIONTREE_H
10
11#include <QTreeView>
12
13class KateCompletionWidget;
14class KateCompletionModel;
15
16class QTimer;
17
18class KateCompletionTree final : public QTreeView
19{
20public:
21 explicit KateCompletionTree(KateCompletionWidget *parent);
22
23 KateCompletionWidget *widget() const;
24 KateCompletionModel *kateModel() const;
25
26 void resizeColumns(bool firstShow = false, bool forceResize = false);
27
28 int sizeHintForColumn(int column) const override
29 {
30 return columnWidth(column);
31 }
32
33 // Navigation
34 bool nextCompletion();
35 bool previousCompletion();
36 bool pageDown();
37 bool pageUp();
38 void top();
39 void bottom();
40
41 void scheduleUpdate();
42
43 void setScrollingEnabled(bool);
44
45private:
46 void resizeColumnsSlot();
47
48protected:
49 void currentChanged(const QModelIndex &current, const QModelIndex &previous) override; /// Not available as a signal in this way
50 void scrollContentsBy(int dx, int dy) override;
51 void initViewItemOption(QStyleOptionViewItem *option) const override;
52
53private:
54 bool m_scrollingEnabled;
55 QTimer *m_resizeTimer;
56};
57
58#endif
59

source code of ktexteditor/src/completion/katecompletiontree.h