#ifndef MATH_GRID_H
#define MATH_GRID_H
-#include "math_inset.h"
+#include "math_nestinset.h"
+#include "LString.h"
#ifdef __GNUG__
#pragma interface
\author André Pönitz 2001
*/
-class MathGridInset : public MathInset {
+class MathGridInset : public MathNestInset {
/// additional per-row information
struct RowInfo {
///
RowInfo();
- ///
- int descent_;
- ///
- int ascent_;
- ///
- int offset_;
- ///
+ /// cached descent
+ mutable int descent_;
+ /// cached ascent
+ mutable int ascent_;
+ /// cached offset
+ mutable int offset_;
+ /// hline abow this row?
bool upperline_;
- ///
+ /// hline below this row?
bool lowerline_;
};
char h_align_;
/// cache for drawing
int h_offset;
- ///
- int width_;
- ///
- int offset_;
- ///
+ /// cached width
+ mutable int width_;
+ /// cached offset
+ mutable int offset_;
+ ///
bool leftline_;
///
bool rightline_;
public:
///
- MathGridInset(int m, int n, string const & nm);
- ///
- virtual MathInset * clone() const = 0;
+ MathGridInset(int m, int n);
///
void write(std::ostream &, bool fragile) const;
///
- void metrics(MathStyles st);
+ void metrics(MathStyles st) const;
///
- void draw(Painter &, int, int);
+ void draw(Painter &, int x, int y) const;
///
void halign(string const &);
///
int col(int idx) const { return idx % ncols(); }
///
int row(int idx) const { return idx / ncols(); }
+ ///
+ int cellXOffset(int idx) const;
+ ///
+ int cellYOffset(int idx) const;
///
bool idxUp(int &, int &) const;