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 | |
13 | class KateCompletionWidget; |
14 | class KateCompletionModel; |
15 | |
16 | class QTimer; |
17 | |
18 | class KateCompletionTree final : public QTreeView |
19 | { |
20 | public: |
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 | |
45 | private: |
46 | void resizeColumnsSlot(); |
47 | |
48 | protected: |
49 | void currentChanged(const QModelIndex ¤t, 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 | |
53 | private: |
54 | bool m_scrollingEnabled; |
55 | QTimer *m_resizeTimer; |
56 | }; |
57 | |
58 | #endif |
59 | |