3 #include "math_sqrtinset.h"
8 #include "support/LOstream.h"
12 MathSqrtInset::MathSqrtInset(short st)
13 : MathParInset(st, "sqrt", LM_OT_SQRT) {}
16 MathedInset * MathSqrtInset::Clone()
18 return new MathSqrtInset(*this);
22 bool MathSqrtInset::Inside(int x, int y)
24 return x >= xo() - hmax_
25 && x <= xo() + width - hmax_
26 && y <= yo() + descent
27 && y >= yo() - ascent;
32 MathSqrtInset::draw(Painter & pain, int x, int y)
34 MathParInset::draw(pain, x + hmax_ + 2, y);
36 int const d = descent;
37 int const h2 = Height() / 2;
38 int const w2 = (Height() > 4 * hmax_) ? hmax_ : hmax_ / 2;
41 xp[0] = x + hmax_ + wbody_; yp[0] = y - h;
42 xp[1] = x + hmax_; yp[1] = y - h;
43 xp[2] = x + w2; yp[2] = y + d;
44 xp[3] = x; yp[3] = y + d - h2;
45 pain.lines(xp, yp, 4, LColor::mathline);
50 MathSqrtInset::Metrics()
52 MathParInset::Metrics();
57 hmax_ = mathed_char_height(LM_TC_VAR, size(), 'I', a, b);
58 if (hmax_ < 10) hmax_ = 10;
64 void MathSqrtInset::Write(ostream & os, bool fragile)
66 os << '\\' << name << '{';
67 MathParInset::Write(os, fragile);