#ifndef MATH_SCRIPTINSET_H
#define MATH_SCRIPTINSET_H
-#include "math_inset.h"
+#include "math_nestinset.h"
#ifdef __GNUG__
#pragma interface
\author André Pönitz
*/
-class MathScriptInset : public MathInset {
+class MathScriptInset : public MathNestInset {
public:
///
MathScriptInset();
///
- MathScriptInset(bool up, bool down);
+ explicit MathScriptInset(bool up);
///
- MathInset * Clone() const;
+ MathInset * clone() const;
///
- void Write(std::ostream &, bool fragile) const;
+ void write(MathWriteInfo & os) const;
///
- void WriteNormal(std::ostream &) const;
+ void metrics(MathMetricsInfo const & st) const;
///
- void Metrics(MathStyles st);
- ///
- void draw(Painter &, int x, int baseline);
- ///
- bool idxUp(int & idx, int & pos) const;
- ///
- bool idxDown(int & idx, int & pos) const;
- ///
- bool idxLeft(int & idx, int & pos) const;
- ///
- bool idxRight(int & idx, int & pos) const;
- ///
- bool idxFirst(int & idx, int & pos) const;
- ///
- bool idxFirstUp(int & idx, int & pos) const;
+ void draw(Painter &, int x, int y) const;
+
///
- bool idxFirstDown(int & idx, int & pos) const;
+ void write(MathInset const *, MathWriteInfo & os) const;
///
- bool idxLast(int & idx, int & pos) const;
+ void metrics(MathInset const * nucleus, MathMetricsInfo const & st) const;
///
- bool idxLastUp(int & idx, int & pos) const;
+ void draw(MathInset const * nucleus, Painter &, int x, int y) const;
///
- bool idxLastDown(int & idx, int & pos) const;
+ int ascent(MathInset const * nucleus) const;
///
- bool up() const;
+ int descent(MathInset const * nucleus) const;
///
- bool down() const;
+ int width(MathInset const * nucleus) const;
+
///
- void up(bool);
+ bool idxLeft(MathInset::idx_type &, MathInset::pos_type &) const;
///
- void down(bool);
+ bool idxRight(MathInset::idx_type &, MathInset::pos_type &) const;
+
///
- bool isActive() const { return false; }
- /// Identifies ScriptInsets
- bool isScriptInset() const { return true; }
+ MathScriptInset const * asScriptInset() const;
///
- bool idxDelete(int idx);
+ MathScriptInset * asScriptInset();
+
+ /// set limits
+ void limits(int lim) { limits_ = lim; }
+ ///
+ int limits() const { return limits_; }
+ ///
+ bool hasLimits(MathInset const * nucleus) const;
+ /// true if we have an "inner" position
+ MathXArray const & up() const;
+ /// returns subscript
+ MathXArray const & down() const;
+ /// returns superscript
+ MathXArray & up();
+ /// returns subscript
+ MathXArray & down();
+ /// do we have a superscript?
+ bool hasUp() const;
+ /// do we have a subscript?
+ bool hasDown() const;
+ /// do we have a script?
+ bool has(bool up) const;
+ /// remove script
+ void removeScript(bool up);
+ /// remove script
+ void removeEmptyScripts();
+ ///
+ void ensure(bool up);
+
+public:
+ /// returns x offset for main part
+ int dxx(MathInset const * nuc) const;
+ /// returns width of nucleus if any
+ int nwid(MathInset const * nuc) const;
private:
+ /// returns y offset for superscript
+ int dy0(MathInset const * nuc) const;
+ /// returns y offset for subscript
+ int dy1(MathInset const * nuc) const;
+ /// returns x offset for superscript
+ int dx0(MathInset const * nuc) const;
+ /// returns x offset for subscript
+ int dx1(MathInset const * nuc) const;
+ /// returns ascent of nucleus if any
+ int nasc(MathInset const * nuc) const;
+ /// returns descent of nucleus if any
+ int ndes(MathInset const * nuc) const;
+
+ /// possible subscript (index 0) and superscript (index 1)
+ bool script_[2];
///
- bool up_;
- ///
- bool down_;
+ int limits_;
};
#endif
+