2001-08-08 17:26:30 +00:00
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "math_stackrelinset.h"
|
2001-11-08 12:06:56 +00:00
|
|
|
#include "math_mathmlstream.h"
|
2001-11-08 12:15:12 +00:00
|
|
|
#include "math_support.h"
|
2001-08-08 17:26:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
MathStackrelInset::MathStackrelInset()
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
MathInset * MathStackrelInset::clone() const
|
|
|
|
{
|
|
|
|
return new MathStackrelInset(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-10-22 15:37:49 +00:00
|
|
|
void MathStackrelInset::metrics(MathMetricsInfo const & mi) const
|
2001-08-08 17:26:30 +00:00
|
|
|
{
|
2001-10-22 15:37:49 +00:00
|
|
|
MathMetricsInfo m = mi;
|
|
|
|
smallerStyleFrac(m);
|
|
|
|
xcell(0).metrics(m);
|
|
|
|
xcell(1).metrics(mi);
|
2001-08-08 17:26:30 +00:00
|
|
|
width_ = std::max(xcell(0).width(), xcell(1).width()) + 4;
|
|
|
|
ascent_ = xcell(1).ascent() + xcell(0).height() + 4;
|
|
|
|
descent_ = xcell(1).descent();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathStackrelInset::draw(Painter & pain, int x, int y) const
|
|
|
|
{
|
|
|
|
int m = x + width() / 2;
|
|
|
|
xcell(0).draw(pain, m - xcell(0).width() / 2, y - xcell(0).height() - 4);
|
|
|
|
xcell(1).draw(pain, m - xcell(1).width() / 2, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-10-19 11:25:48 +00:00
|
|
|
void MathStackrelInset::write(MathWriteInfo & os) const
|
2001-08-08 17:26:30 +00:00
|
|
|
{
|
2001-10-19 11:25:48 +00:00
|
|
|
os << "\\stackrel{" << cell(0) << "}{" << cell(1) << '}';
|
2001-08-08 17:26:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-11-08 12:06:56 +00:00
|
|
|
void MathStackrelInset::writeNormal(NormalStream & os) const
|
2001-08-08 17:26:30 +00:00
|
|
|
{
|
|
|
|
os << "[stackrel ";
|
|
|
|
cell(0).writeNormal(os);
|
|
|
|
os << " ";
|
|
|
|
cell(1).writeNormal(os);
|
|
|
|
os << "] ";
|
|
|
|
}
|