aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/util/qsgtextnode.h
blob: db91dc01aeb44744bcd9b158fa10de913f7c14db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#ifndef QSGTEXTNODE_H
#define QSGTEXTNODE_H

#include <QtGui/qtextlayout.h>
#include <QtQuick/qsgnode.h>

QT_BEGIN_NAMESPACE

class Q_QUICK_EXPORT QSGTextNode : public QSGTransformNode
{
public:
    // Should match the TextStyle in qquicktext_p.h
    enum TextStyle : quint8
    {
        Normal,
        Outline,
        Raised,
        Sunken
    };

    // Should match the RenderType in qquicktext_p.h
    enum RenderType: quint8
    {
        QtRendering,
        NativeRendering,
        CurveRendering
    };

    ~QSGTextNode() override = default;

    virtual void setColor(const QColor &color) = 0;
    virtual QColor color() const = 0;

    virtual void setTextStyle(TextStyle textStyle) = 0;
    virtual TextStyle textStyle() = 0;

    virtual void setStyleColor(const QColor &styleColor) = 0;
    virtual QColor styleColor() const = 0;

    virtual void setLinkColor(const QColor &linkColor) = 0;
    virtual QColor linkColor() const = 0;

    virtual void setSelectionColor(const QColor &selectionColor) = 0;
    virtual QColor selectionColor() const = 0;

    virtual void setSelectionTextColor(const QColor &selectionTextColor) = 0;
    virtual QColor selectionTextColor() const = 0;

    virtual void setRenderType(RenderType renderType) = 0;
    virtual RenderType renderType() const = 0;

    virtual void setRenderTypeQuality(int renderTypeQuality) = 0;
    virtual int renderTypeQuality() const = 0;

    virtual void setSmooth(bool smooth) = 0;
    virtual bool smooth() const = 0;

    virtual void clear() = 0;

    virtual void setViewport(const QRectF &viewport) = 0;
    virtual QRectF viewport() const = 0;

    virtual void addTextLayout(const QPointF &position,
                               QTextLayout *layout,
                               int selectionStart = -1,
                               int selectionCount = -1,
                               int lineStart = 0,
                               int lineCount = -1) = 0;
    virtual void addTextDocument(const QPointF &position,
                                 QTextDocument *document,
                                 int selectionStart = -1,
                                 int selectionCount = -1) = 0;

};

QT_END_NAMESPACE

#endif // QSGTEXTNODE_H