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 MathSqrtInset * p = new MathSqrtInset(GetStyle());
20 p->setData(it.Copy());
25 bool MathSqrtInset::Inside(int x, int y)
27 return x >= xo() - hmax_
28 && x <= xo() + width - hmax_
29 && y <= yo() + descent
30 && y >= yo() - ascent;
35 MathSqrtInset::draw(Painter & pain, int x, int y)
37 MathParInset::draw(pain, x + hmax_ + 2, y);
39 int const d = descent;
40 int const h2 = Height() / 2;
41 int const w2 = (Height() > 4 * hmax_) ? hmax_ : hmax_ / 2;
44 xp[0] = x + hmax_ + wbody_; yp[0] = y - h;
45 xp[1] = x + hmax_; yp[1] = y - h;
46 xp[2] = x + w2; yp[2] = y + d;
47 xp[3] = x; yp[3] = y + d - h2;
48 pain.lines(xp, yp, 4, LColor::mathline);
53 MathSqrtInset::Metrics()
55 MathParInset::Metrics();
60 hmax_ = mathed_char_height(LM_TC_VAR, size(), 'I', a, b);
61 if (hmax_ < 10) hmax_ = 10;
67 void MathSqrtInset::Write(ostream & os, bool fragile)
69 os << '\\' << name << '{';
70 MathParInset::Write(os, fragile);