| 1 | /* |
| 2 | SPDX-FileCopyrightText: 2017-18 Friedrich W. H. Kossebau <kossebau@kde.org> |
| 3 | |
| 4 | SPDX-License-Identifier: LGPL-2.0-or-later |
| 5 | */ |
| 6 | |
| 7 | #ifndef KATE_ANNOTATIONITEMDELEGATE_H |
| 8 | #define KATE_ANNOTATIONITEMDELEGATE_H |
| 9 | |
| 10 | #include <ktexteditor/abstractannotationitemdelegate.h> |
| 11 | |
| 12 | namespace KTextEditor |
| 13 | { |
| 14 | class ViewPrivate; |
| 15 | } |
| 16 | class KateViewInternal; |
| 17 | |
| 18 | class KateAnnotationItemDelegate : public KTextEditor::AbstractAnnotationItemDelegate |
| 19 | { |
| 20 | public: |
| 21 | explicit KateAnnotationItemDelegate(QObject *parent); |
| 22 | ~KateAnnotationItemDelegate() override; |
| 23 | |
| 24 | public: |
| 25 | void paint(QPainter *painter, const KTextEditor::StyleOptionAnnotationItem &option, KTextEditor::AnnotationModel *model, int line) const override; |
| 26 | bool helpEvent(QHelpEvent *event, |
| 27 | KTextEditor::View *view, |
| 28 | const KTextEditor::StyleOptionAnnotationItem &option, |
| 29 | KTextEditor::AnnotationModel *model, |
| 30 | int line) override; |
| 31 | void hideTooltip(KTextEditor::View *view) override; |
| 32 | QSize sizeHint(const KTextEditor::StyleOptionAnnotationItem &option, KTextEditor::AnnotationModel *model, int line) const override; |
| 33 | |
| 34 | private: |
| 35 | mutable qreal m_maxCharWidth = 0.0; |
| 36 | mutable QFontMetricsF m_cachedDataContentFontMetrics; |
| 37 | }; |
| 38 | |
| 39 | #endif |
| 40 | |