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
jkqtmathtexthorizontallistnode.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 JKQTMATHTEXTHONRIZONTALLISTNODE_H
25#define JKQTMATHTEXTHONRIZONTALLISTNODE_H
26#include "jkqtmathtext/jkqtmathtext_imexport.h"
27#include "jkqtmathtext/jkqtmathtexttools.h"
28#include "jkqtmathtext/nodes/jkqtmathtextnode.h"
29#include <QPainter>
30#include <QFontMetricsF>
31
32class JKQTMathText; // forward
33// JKQTMATHTEXT_LIB_EXPORT
34
35
36/** \brief subclass representing a list of nodes in the syntax tree, layed out horizontally
37 * \ingroup jkqtmathtext_items
38 *
39 * This type of node also implements typesetting sub-/superscript above/below the previous node (if
40 * JKQTMathTextNode::is() is \c true for that previus node. The drawing is done as defined in the
41 * following image:
42 * \image html jkqtmathtext_subsuper_with_limits.png
43 *
44 * In addition this node also ensures that subscripts are moved to the left for italic previous
45 * text or nodes that require such a shift (e.g. \c \\nabla or \c \\int ):
46 *
47 * \image html jkqtmathtext/jkqtmathtext_doc_subsuper_italiccorrection.png
48 *
49 * \image html jkqtmathtext/jkqtmathtext_doc_subsuper_italiccorrection_boxes.png
50 *
51 * This is implemented using JKQTMathTextNodeSize::baselineXCorrection .
52 *
53 * In addition this class implements execution of instructions derived from
54 * JKQTMathTextModifyEnvironmentNodeMixIn.
55 *
56 * \see JKQTMathTextVerticalListNode
57 */
59 public:
62 /** \copydoc JKQTMathTextNode::getTypeName() */
63 virtual QString getTypeName() const override;
64 /** \copydoc JKQTMathTextNode::draw() */
65 virtual double draw(QPainter& painter, double x, double y, JKQTMathTextEnvironment currentEv) const override;
66 /** \copydoc JKQTMathTextNode::toHtml() */
67 virtual bool toHtml(QString& html, JKQTMathTextEnvironment currentEv, JKQTMathTextEnvironment defaultEv) const override;
68 /** \brief add a child node */
70 /** \copydoc JKQTMathTextMultiChildNode::getChildren() */
71 virtual QList<JKQTMathTextNode*> getChildren() override;
72 /** \copydoc JKQTMathTextMultiChildNode::childCount() */
73 virtual int childCount() const override;
74 /** \copydoc JKQTMathTextMultiChildNode::clearChildren() */
75 virtual void clearChildren(bool deleteChildren=true) override;
76 /** \copydoc JKQTMathTextMultiChildNode::deleteChild() */
77 virtual void deleteChild(int i) override;
78 /** \copydoc JKQTMathTextMultiChildNode::getChild() */
79 virtual JKQTMathTextNode* getChild(int i) override;
80 /** \copydoc JKQTMathTextMultiChildNode::getChild() */
81 virtual const JKQTMathTextNode* getChild(int i) const override;
82 /** \copydoc JKQTMathTextMultiChildNode::getChild() */
83 virtual JKQTMathTextNode* replaceChild(int i, JKQTMathTextNode* newChild) override;
84 /** \copydoc JKQTMathTextModifyEnvironmentNodeMixIn::modifyEnvironment() */
85 virtual void modifyEnvironment(JKQTMathTextEnvironment& currentEv) const override;
86
87 protected:
88 /** \copydoc JKQTMathTextNode::getSizeInternal() */
89 virtual JKQTMathTextNodeSize getSizeInternal(QPainter& painter, JKQTMathTextEnvironment currentEv) const override;
90 /** \brief list of all nodes within the line */
91 QList<JKQTMathTextNode*> nodes;
92 private:
93 /** \brief internal implementation of clearChildren() that is non-virtual, so can be used in the destructor */
94 void clearChildrenImpl(bool deleteChildren);
95};
96
97
98
99
100#endif // JKQTMATHTEXTHONRIZONTALLISTNODE_H
101
102
103
104
105
106
107
108
109
subclass representing a list of nodes in the syntax tree, layed out horizontally
Definition jkqtmathtexthorizontallistnode.h:58
virtual JKQTMathTextNodeSize getSizeInternal(QPainter &painter, JKQTMathTextEnvironment currentEv) const override
determine the size of the node, overwrite this function in derived classes
virtual JKQTMathTextNode * getChild(int i) override
returns the i-th child node
virtual JKQTMathTextNode * replaceChild(int i, JKQTMathTextNode *newChild) override
returns the i-th child node
virtual void deleteChild(int i) override
delete the i-th child
virtual const JKQTMathTextNode * getChild(int i) const override
returns the i-th child node
virtual void clearChildren(bool deleteChildren=true) override
clear all children, deleting them if deleteChildren==true
virtual void modifyEnvironment(JKQTMathTextEnvironment &currentEv) const override
modifies the fiven JKQTMathTextEnvironment currrentEv
virtual QString getTypeName() const override
return the name of this class as a string
void addChild(JKQTMathTextNode *n)
add a child node
virtual bool toHtml(QString &html, JKQTMathTextEnvironment currentEv, JKQTMathTextEnvironment defaultEv) const override
convert node to HTML and returns true on success
QList< JKQTMathTextNode * > nodes
list of all nodes within the line
Definition jkqtmathtexthorizontallistnode.h:91
virtual ~JKQTMathTextHorizontalListNode() override
virtual int childCount() const override
returns the number of child nodes
JKQTMathTextHorizontalListNode(JKQTMathText *parent)
void clearChildrenImpl(bool deleteChildren)
internal implementation of clearChildren() that is non-virtual, so can be used in the destructor
virtual QList< JKQTMathTextNode * > getChildren() override
returns a list of all child node
virtual double draw(QPainter &painter, double x, double y, JKQTMathTextEnvironment currentEv) const override
draw the contents at the designated position
this class parses a mathematical markup string and can then draw the contained text/equation onto a Q...
Definition jkqtmathtext.h:192
mixin extending a node that does not produce any output, but provides a function modifyEnvironment() ...
Definition jkqtmathtextnode.h:322
subclass representing a node in the syntax tree, that has two children
Definition jkqtmathtextnode.h:202
subclass representing one node in the syntax tree
Definition jkqtmathtextnode.h:37
#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