JKQTPlotter trunk/v5.0.0
an extensive Qt5+Qt6 Plotter framework (including a feature-richt plotter widget, a speed-optimized, but limited variant and a LaTeX equation renderer!), written fully in C/C++ and without external dependencies
Loading...
Searching...
No Matches
jkqtmathtextdecoratednode.h
1/*
2 Copyright (c) 2008-2024 Jan W. Krieger (<jan@jkrieger.de>)
3 with contributions from: Razi Alavizadeh
4
5
6
7 This software is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License (LGPL) as published by
9 the Free Software Foundation, either version 2.1 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License (LGPL) for more details.
16
17 You should have received a copy of the GNU Lesser General Public License (LGPL)
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
19*/
20
21
22
23
24#ifndef JKQTMATHTEXTDECORATEDNODE_H
25#define JKQTMATHTEXTDECORATEDNODE_H
26#include "jkqtmathtext/jkqtmathtext_imexport.h"
27#include "jkqtmathtext/jkqtmathtexttools.h"
28#include "jkqtmathtext/nodes/jkqtmathtextnode.h"
29#include <QPainter>
30
31class JKQTMathText; // forward
32// JKQTMATHTEXT_LIB_EXPORT
33
34
35/** \brief subclass representing a decorated text m (e.g. \c \\vec \c \\hat ...) node
36 * \ingroup jkqtmathtext_items
37 *
38 * \image html jkqtmathtext/decoration_sizing.png
39 *
40 */
42 public:
43 /** \brief types of decoration available in a JKQTMathTextDecoratedNode
44 */
46 MTDvec, /*!< \brief vector arrow over block \image html jkqtmathtext/MTDvec.png */
47 MTDhat, /*!< \brief small hat over block \image html jkqtmathtext/MTDhat.png */
48 MTDwidehat, /*!< \brief full-width hat over block \image html jkqtmathtext/MTDwidehat.png */
49 MTDcheck, /*!< \brief small v over block \image html jkqtmathtext/MTDcheck.png */
50 MTDwidecheck, /*!< \brief full-width v over block \image html jkqtmathtext/MTDwidecheck.png */
51 MTDbreve, /*!< \brief small cup (breve) over block \image html jkqtmathtext/MTDbreve.png */
52 MTDocirc, /*!< \brief single circle over block \image html jkqtmathtext/MTDocirc.png */
53 MTDdot, /*!< \brief single dot over block \image html jkqtmathtext/MTDvec.png */
54 MTDddot, /*!< \brief double dot over block \image html jkqtmathtext/MTDddot.png */
55 MTDbar, /*!< \brief bar over block \image html jkqtmathtext/MTDbar.png */
56 MTDarrow, /*!< \brief arrow over block \image html jkqtmathtext/MTDarrow.png */
57 MTDoverline, /*!< \brief overline over block \image html jkqtmathtext/MTDoverline.png */
58 MTDdoubleoverline, /*!< \brief double overline over block \image html jkqtmathtext/MTDdoubleoverline.png */
59 MTDunderline, /*!< \brief underline under block \image html jkqtmathtext/MTDunderline.png */
60 MTDunderlineDashed, /*!< \brief dashed line under block \image html jkqtmathtext/MTDunderlineDashed.png */
61 MTDunderlineDotted, /*!< \brief dotted line under block \image html jkqtmathtext/MTDunderlineDotted.png */
62 MTDdoubleunderline, /*!< \brief double line under block \image html jkqtmathtext/MTDdoubleunderline.png */
63 MTDtilde, /*!< \brief small tilde over block \image html jkqtmathtext/MTDtilde.png */
64 MTDwidetilde, /*!< \brief full width tilde over block \image html jkqtmathtext/MTDwidetilde.png */
65 MTDacute, /*!< \brief small acute accent over block \image html jkqtmathtext/MTDacute.png */
66 MTDgrave, /*!< \brief small grave accent over block \image html jkqtmathtext/MTDgrave.png */
67 MTDcancel, /*!< \brief cancel text with sloped line \image html jkqtmathtext/MTDcancel.png */
68 MTDbcancel, /*!< \brief cancel text with backward sloped line \image html jkqtmathtext/MTDbcancel.png */
69 MTDxcancel, /*!< \brief cancel text with X \image html jkqtmathtext/MTDxcancel.png */
70 MTDstrike, /*!< \brief strikethrough text \image html jkqtmathtext/MTDstrike.png */
71 MTDoverleftarrow, /*!< \brief left-pointing arrow over everything text \image html jkqtmathtext/MTDoverleftarrow.png */
72 MTDoverrightarrow, /*!< \brief right-pointing arrow over everything text \image html jkqtmathtext/MTDoverrightarrow.png */
73 MTDoverleftrightarrow, /*!< \brief left/right-pointing arrow over everything text \image html jkqtmathtext/MTDoverleftrightarrow.png */
74 MTDunderleftarrow, /*!< \brief left-pointing arrow under everything text \image html jkqtmathtext/MTDunderleftarrow.png */
75 MTDunderrightarrow, /*!< \brief right-pointing arrow under everything text \image html jkqtmathtext/MTDunderrightarrow.png */
76 MTDunderleftrightarrow, /*!< \brief left/right-pointing arrow under everything text \image html jkqtmathtext/MTDunderleftrightarrow.png */
77 };
78 /** \brief convert a DecorationType into a string
79 */
81 /** \brief returns the FracType corresponding to \a instructionName
82 * \see JKQTMathTextFracNode::FracType
83 */
85
86 /** \brief returns true, if the given \a instructionName can be converted to a FracType
87 * \see JKQTMathTextFracNode::FracType
88 */
89 static bool supportsInstructionName(const QString& instructionName);
90
92 virtual ~JKQTMathTextDecoratedNode() override;
93 /** \copydoc JKQTMathTextNode::draw() */
94 virtual double draw(QPainter& painter, double x, double y, JKQTMathTextEnvironment currentEv) const override;
95 /** \copydoc JKQTMathTextNode::toHtml() */
96 virtual bool toHtml(QString& html, JKQTMathTextEnvironment currentEv, JKQTMathTextEnvironment defaultEv) const override;
97 /** \copydoc JKQTMathTextNode::getTypeName() */
98 virtual QString getTypeName() const override ;
99 /** \copydoc decoration */
101 protected:
102 /** \copydoc JKQTMathTextNode::getSizeInternal() */
103 virtual JKQTMathTextNodeSize getSizeInternal(QPainter& painter, JKQTMathTextEnvironment currentEv) const override;
104 /** \brief type of decoration that is added to the child node */
106 /** \brief lists all supported instructions */
107 static const QHash<QString, DecorationType>& instructions();
108};
109#endif // JKQTMATHTEXTDECORATEDNODE_H
110
111
112
113
114
115
116
117
118
subclass representing a decorated text m (e.g. \vec \hat ...) node
Definition jkqtmathtextdecoratednode.h:41
DecorationType
types of decoration available in a JKQTMathTextDecoratedNode
Definition jkqtmathtextdecoratednode.h:45
@ MTDdoubleoverline
double overline over block
Definition jkqtmathtextdecoratednode.h:58
@ MTDcancel
cancel text with sloped line
Definition jkqtmathtextdecoratednode.h:67
@ MTDstrike
strikethrough text
Definition jkqtmathtextdecoratednode.h:70
@ MTDoverrightarrow
right-pointing arrow over everything text
Definition jkqtmathtextdecoratednode.h:72
@ MTDwidehat
full-width hat over block
Definition jkqtmathtextdecoratednode.h:48
@ MTDwidecheck
full-width v over block
Definition jkqtmathtextdecoratednode.h:50
@ MTDunderlineDashed
dashed line under block
Definition jkqtmathtextdecoratednode.h:60
@ MTDunderline
underline under block
Definition jkqtmathtextdecoratednode.h:59
@ MTDdoubleunderline
double line under block
Definition jkqtmathtextdecoratednode.h:62
@ MTDgrave
small grave accent over block
Definition jkqtmathtextdecoratednode.h:66
@ MTDcheck
small v over block
Definition jkqtmathtextdecoratednode.h:49
@ MTDunderrightarrow
right-pointing arrow under everything text
Definition jkqtmathtextdecoratednode.h:75
@ MTDunderlineDotted
dotted line under block
Definition jkqtmathtextdecoratednode.h:61
@ MTDunderleftrightarrow
left/right-pointing arrow under everything text
Definition jkqtmathtextdecoratednode.h:76
@ MTDoverline
overline over block
Definition jkqtmathtextdecoratednode.h:57
@ MTDbreve
small cup (breve) over block
Definition jkqtmathtextdecoratednode.h:51
@ MTDxcancel
cancel text with X
Definition jkqtmathtextdecoratednode.h:69
@ MTDbar
bar over block
Definition jkqtmathtextdecoratednode.h:55
@ MTDacute
small acute accent over block
Definition jkqtmathtextdecoratednode.h:65
@ MTDtilde
small tilde over block
Definition jkqtmathtextdecoratednode.h:63
@ MTDunderleftarrow
left-pointing arrow under everything text
Definition jkqtmathtextdecoratednode.h:74
@ MTDarrow
arrow over block
Definition jkqtmathtextdecoratednode.h:56
@ MTDbcancel
cancel text with backward sloped line
Definition jkqtmathtextdecoratednode.h:68
@ MTDhat
small hat over block
Definition jkqtmathtextdecoratednode.h:47
@ MTDwidetilde
full width tilde over block
Definition jkqtmathtextdecoratednode.h:64
@ MTDoverleftarrow
left-pointing arrow over everything text
Definition jkqtmathtextdecoratednode.h:71
@ MTDvec
vector arrow over block
Definition jkqtmathtextdecoratednode.h:46
@ MTDocirc
single circle over block
Definition jkqtmathtextdecoratednode.h:52
@ MTDoverleftrightarrow
left/right-pointing arrow over everything text
Definition jkqtmathtextdecoratednode.h:73
@ MTDddot
double dot over block
Definition jkqtmathtextdecoratednode.h:54
@ MTDdot
single dot over block
Definition jkqtmathtextdecoratednode.h:53
virtual bool toHtml(QString &html, JKQTMathTextEnvironment currentEv, JKQTMathTextEnvironment defaultEv) const override
convert node to HTML and returns true on success
static DecorationType InstructionName2DecorationType(const QString &mode)
returns the FracType corresponding to instructionName
JKQTMathTextDecoratedNode(JKQTMathText *parent, DecorationType decoration, JKQTMathTextNode *child)
static const QHash< QString, DecorationType > & instructions()
lists all supported instructions
virtual JKQTMathTextNodeSize getSizeInternal(QPainter &painter, JKQTMathTextEnvironment currentEv) const override
determine the size of the node, overwrite this function in derived classes
DecorationType getDecoration() const
type of decoration that is added to the child node
virtual double draw(QPainter &painter, double x, double y, JKQTMathTextEnvironment currentEv) const override
draw the contents at the designated position
static bool supportsInstructionName(const QString &instructionName)
returns true, if the given instructionName can be converted to a FracType
virtual QString getTypeName() const override
return the name of this class as a string
DecorationType decoration
type of decoration that is added to the child node
Definition jkqtmathtextdecoratednode.h:105
static QString DecorationType2String(DecorationType mode)
convert a DecorationType into a string
virtual ~JKQTMathTextDecoratedNode() override
this class parses a mathematical markup string and can then draw the contained text/equation onto a Q...
Definition jkqtmathtext.h:192
subclass representing one node in the syntax tree
Definition jkqtmathtextnode.h:37
subclass representing a node in the syntax tree, that has one child
Definition jkqtmathtextnode.h:174
#define JKQTMATHTEXT_LIB_EXPORT
Definition jkqtmathtext_imexport.h:108
describes the current drawing environment (base fontname ...)
Definition jkqtmathtexttools.h:304
beschreibt die Größe(n) eines Knotens
Definition jkqtmathtexttools.h:393