3 * Purpose: Implementation of insets for mathed
4 * Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
5 * Created: January 1996
8 * Dependencies: Xlib, XForms
10 * Copyright: 1996, 1997 Alejandro Aguilar Sierra
14 * You are free to use and modify this code under the terms of
15 * the GNU General Public Licence version 2 or later.
21 #pragma implementation
24 #include "math_iter.h"
25 #include "math_inset.h"
26 #include "symbol_def.h"
28 #include "mathed/support.h"
32 // Initialize some static class variables.
33 int MathedInset::df_asc;
34 int MathedInset::df_des;
35 int MathedInset::df_width;
36 int MathedInset::workWidth;
39 MathedInset::MathedInset(string const & nm, short ot, short st)
40 : name(nm), objtype(ot), width(0), ascent(0), descent(0), size_(st)
44 // In a near future maybe we use a better fonts renderer
45 void MathedInset::drawStr(Painter & pain, short type, int siz,
46 int x, int y, string const & s)
49 if (MathIsBinary(type))
50 for (string::const_iterator it = s.begin();
51 it != s.end(); ++it) {
59 LyXFont const mf = mathed_get_font(type, siz);
60 pain.text(x, y, st, mf);
64 int MathedInset::Ascent() const
70 int MathedInset::Descent() const
76 int MathedInset::Width() const
82 int MathedInset::Height() const
84 return ascent + descent;
88 bool MathedInset::GetLimits() const
94 void MathedInset::SetLimits(bool) {}
97 string const & MathedInset::GetName() const
103 short MathedInset::GetType() const
109 short MathedInset::GetStyle() const
115 void MathedInset::SetType(short t)
121 void MathedInset::SetStyle(short st)
127 void MathedInset::SetName(string const & n)
133 void MathedInset::defaultAscent(int da)
140 void MathedInset::defaultDescent(int dd)
146 void MathedInset::defaultWidth(int dw)
152 short MathedInset::size() const
158 void MathedInset::size(short s)
164 void MathedInset::incSize()