2 #ifndef MATH_SCRIPTINSET_H
3 #define MATH_SCRIPTINSET_H
5 #include "math_nestinset.h"
11 /** Inset for super- and subscripts
15 class MathScriptInset : public MathNestInset {
20 explicit MathScriptInset(bool up);
22 MathInset * clone() const;
24 void write(std::ostream &, bool fragile) const;
26 void metrics(MathStyles st) const;
28 void draw(Painter &, int x, int y) const;
31 void write(MathInset const * nucleus, std::ostream &, bool fragile) const;
33 void metrics(MathInset const * nucleus, MathStyles st) const;
35 void draw(MathInset const * nucleus, Painter &, int x, int y) const;
37 int ascent(MathInset const * nucleus) const;
39 int descent(MathInset const * nucleus) const;
41 int width(MathInset const * nucleus) const;
44 MathScriptInset const * asScriptInset() const;
46 MathScriptInset * asScriptInset();
49 void limits(int lim) { limits_ = lim; }
51 int limits() const { return limits_; }
53 bool hasLimits(MathInset const * nucleus) const;
54 /// true if we have an "inner" position
55 MathXArray const & up() const;
57 MathXArray const & down() const;
58 /// returns superscript
62 /// do we have a superscript?
64 /// do we have a subscript?
66 /// do we have a script?
67 bool has(bool up) const;
69 void removeScript(bool up);
71 void removeEmptyScripts();
76 /// returns x offset for main part
77 int dxx(MathInset const * nuc) const;
78 /// returns width of nucleus if any
79 int nwid(MathInset const * nuc) const;
81 /// returns y offset for superscript
82 int dy0(MathInset const * nuc) const;
83 /// returns y offset for subscript
84 int dy1(MathInset const * nuc) const;
85 /// returns x offset for superscript
86 int dx0(MathInset const * nuc) const;
87 /// returns x offset for subscript
88 int dx1(MathInset const * nuc) const;
89 /// returns ascent of nucleus if any
90 int nasc(MathInset const * nuc) const;
91 /// returns descent of nucleus if any
92 int ndes(MathInset const * nuc) const;
94 /// possible subscript (index 0) and superscript (index 1)