7 #include "math_sqrtinset.h"
12 #include "support/LOstream.h"
17 MathSqrtInset::MathSqrtInset(short st)
18 : MathParInset(st, "sqrt", LM_OT_SQRT) {}
21 MathedInset * MathSqrtInset::Clone()
23 return new MathSqrtInset(*this);
27 bool MathSqrtInset::Inside(int x, int y)
29 return x >= xo() - hmax_
30 && x <= xo() + width - hmax_
31 && y <= yo() + descent
32 && y >= yo() - ascent;
37 MathSqrtInset::draw(Painter & pain, int x, int y)
39 MathParInset::draw(pain, x + hmax_ + 2, y);
41 int const d = descent;
42 int const h2 = Height() / 2;
43 int const w2 = (Height() > 4 * hmax_) ? hmax_ : hmax_ / 2;
46 xp[0] = x + hmax_ + wbody_; yp[0] = y - h;
47 xp[1] = x + hmax_; yp[1] = y - h;
48 xp[2] = x + w2; yp[2] = y + d;
49 xp[3] = x; yp[3] = y + d - h2;
50 pain.lines(xp, yp, 4, LColor::mathline);
55 MathSqrtInset::Metrics()
57 MathParInset::Metrics();
62 hmax_ = mathed_char_height(LM_TC_VAR, size(), 'I', a, b);
63 if (hmax_ < 10) hmax_ = 10;
69 void MathSqrtInset::Write(ostream & os, bool fragile)
71 os << '\\' << name << '{';
72 MathParInset::Write(os, fragile);