2001-08-03 17:10:22 +00:00
|
|
|
#ifndef MATH_NESTINSET_H
|
|
|
|
#define MATH_NESTINSET_H
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
2001-08-03 17:55:10 +00:00
|
|
|
#include "math_diminset.h"
|
2001-08-03 17:10:22 +00:00
|
|
|
|
|
|
|
/** Abstract base class for all math objects that conatin nested items.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
class LaTeXFeatures;
|
|
|
|
|
2001-08-03 17:55:10 +00:00
|
|
|
class MathNestInset : public MathDimInset {
|
2001-08-03 17:10:22 +00:00
|
|
|
public:
|
|
|
|
///
|
2001-09-26 16:52:34 +00:00
|
|
|
explicit MathNestInset(idx_type ncells);
|
2001-08-03 17:10:22 +00:00
|
|
|
|
2001-08-06 17:20:26 +00:00
|
|
|
///
|
2001-10-19 11:25:48 +00:00
|
|
|
void metrics(MathMetricsInfo const & st) const;
|
2001-08-03 17:10:22 +00:00
|
|
|
/// draw the object, sets xo_ and yo_ cached values
|
2001-08-06 17:20:26 +00:00
|
|
|
void draw(Painter &, int x, int y) const;
|
2001-08-03 17:10:22 +00:00
|
|
|
/// appends itself with macro arguments substituted
|
2001-09-11 15:46:51 +00:00
|
|
|
void substitute(MathMacro const & macro);
|
2001-10-12 12:02:49 +00:00
|
|
|
/// identifies NestInsets
|
|
|
|
MathNestInset * asNestInset() { return this; }
|
2001-08-03 17:10:22 +00:00
|
|
|
|
|
|
|
/// The left key
|
2001-09-26 16:52:34 +00:00
|
|
|
bool idxLeft(idx_type & idx, pos_type & pos) const;
|
2001-08-03 17:10:22 +00:00
|
|
|
/// The right key
|
2001-09-26 16:52:34 +00:00
|
|
|
bool idxRight(idx_type & idx, pos_type & pos) const;
|
2001-08-03 17:10:22 +00:00
|
|
|
|
|
|
|
/// Move one physical cell up
|
2001-09-26 16:52:34 +00:00
|
|
|
bool idxNext(idx_type & idx, pos_type & pos) const;
|
2001-08-03 17:10:22 +00:00
|
|
|
/// Move one physical cell down
|
2001-09-26 16:52:34 +00:00
|
|
|
bool idxPrev(idx_type & idx, pos_type & pos) const;
|
2001-08-03 17:10:22 +00:00
|
|
|
|
|
|
|
/// Target pos when we enter the inset from the left by pressing "Right"
|
2001-09-26 16:52:34 +00:00
|
|
|
bool idxFirst(idx_type & idx, pos_type & pos) const;
|
2001-08-03 17:10:22 +00:00
|
|
|
/// Target pos when we enter the inset from the right by pressing "Left"
|
2001-09-26 16:52:34 +00:00
|
|
|
bool idxLast(idx_type & idx, pos_type & pos) const;
|
2001-08-03 17:10:22 +00:00
|
|
|
|
|
|
|
/// Where should we go if we press home?
|
2001-09-26 16:52:34 +00:00
|
|
|
bool idxHome(idx_type & idx, pos_type & pos) const;
|
2001-08-03 17:10:22 +00:00
|
|
|
/// Where should we go if we press end?
|
2001-09-26 16:52:34 +00:00
|
|
|
bool idxEnd(idx_type & idx, pos_type & pos) const;
|
2001-08-03 17:10:22 +00:00
|
|
|
|
|
|
|
///
|
2001-09-26 16:52:34 +00:00
|
|
|
idx_type nargs() const;
|
2001-08-03 17:10:22 +00:00
|
|
|
|
|
|
|
///
|
2001-09-26 16:52:34 +00:00
|
|
|
MathArray & cell(idx_type);
|
2001-08-03 17:10:22 +00:00
|
|
|
///
|
2001-09-26 16:52:34 +00:00
|
|
|
MathArray const & cell(idx_type) const;
|
2001-08-03 17:10:22 +00:00
|
|
|
///
|
2001-09-26 16:52:34 +00:00
|
|
|
MathXArray & xcell(idx_type);
|
2001-08-03 17:10:22 +00:00
|
|
|
///
|
2001-09-26 16:52:34 +00:00
|
|
|
MathXArray const & xcell(idx_type) const;
|
2001-08-03 17:10:22 +00:00
|
|
|
|
|
|
|
///
|
|
|
|
bool isActive() const { return nargs() > 0; }
|
|
|
|
///
|
2001-10-12 12:02:49 +00:00
|
|
|
void push_back(MathAtom const &);
|
2001-08-03 17:10:22 +00:00
|
|
|
///
|
|
|
|
void dump() const;
|
2001-11-16 09:07:40 +00:00
|
|
|
///
|
|
|
|
bool match(MathInset *) const;
|
2001-08-03 17:10:22 +00:00
|
|
|
|
|
|
|
///
|
|
|
|
void validate(LaTeXFeatures & features) const;
|
2001-10-24 09:16:06 +00:00
|
|
|
///
|
|
|
|
bool covers(int x, int y) const;
|
2001-08-03 17:10:22 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
///
|
|
|
|
typedef std::vector<MathXArray> cells_type;
|
|
|
|
/// The nested contents of the inset are contained here.
|
|
|
|
cells_type cells_;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|