File indexing completed on 2024-04-21 03:57:51

0001 /*
0002     SPDX-FileCopyrightText: 2017-18 Friedrich W. H. Kossebau <kossebau@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef KATE_ANNOTATIONITEMDELEGATE_H
0008 #define KATE_ANNOTATIONITEMDELEGATE_H
0009 
0010 #include <ktexteditor/abstractannotationitemdelegate.h>
0011 
0012 namespace KTextEditor
0013 {
0014 class ViewPrivate;
0015 }
0016 class KateViewInternal;
0017 
0018 class KateAnnotationItemDelegate : public KTextEditor::AbstractAnnotationItemDelegate
0019 {
0020 public:
0021     explicit KateAnnotationItemDelegate(QObject *parent);
0022     ~KateAnnotationItemDelegate() override;
0023 
0024 public:
0025     void paint(QPainter *painter, const KTextEditor::StyleOptionAnnotationItem &option, KTextEditor::AnnotationModel *model, int line) const override;
0026     bool helpEvent(QHelpEvent *event,
0027                    KTextEditor::View *view,
0028                    const KTextEditor::StyleOptionAnnotationItem &option,
0029                    KTextEditor::AnnotationModel *model,
0030                    int line) override;
0031     void hideTooltip(KTextEditor::View *view) override;
0032     QSize sizeHint(const KTextEditor::StyleOptionAnnotationItem &option, KTextEditor::AnnotationModel *model, int line) const override;
0033 
0034 private:
0035     mutable qreal m_maxCharWidth = 0.0;
0036     mutable QFontMetricsF m_cachedDataContentFontMetrics;
0037 };
0038 
0039 #endif