]> git.lyx.org Git - lyx.git/blob - src/mathed/math_dotsinset.C
fc4b37f55db463ccd1616f68dd2f4cdbba9a7cb4
[lyx.git] / src / mathed / math_dotsinset.C
1 #include <config.h>
2
3 #include "math_dotsinset.h"
4 #include "mathed/support.h"
5
6
7 MathDotsInset::MathDotsInset(string const & nam, int id, short st)
8         : MathedInset(nam, LM_OT_DOTS, st), code(id) {}
9
10
11 MathedInset * MathDotsInset::Clone()
12 {
13         return new MathDotsInset(name, code, GetStyle());
14 }     
15
16
17 void
18 MathDotsInset::draw(Painter & pain, int x, int y)
19 {
20         mathed_draw_deco(pain, x + 2, y - dh, width - 2, ascent, code);
21         if (code == LM_vdots || code == LM_ddots) ++x; 
22         if (code != LM_vdots) --y;
23         mathed_draw_deco(pain, x + 2, y - dh, width - 2, ascent, code);
24 }
25
26
27 void
28 MathDotsInset::Metrics()
29 {
30         mathed_char_height(LM_TC_VAR, size, 'M', ascent, descent);
31         width = mathed_char_width(LM_TC_VAR, size, 'M');   
32         switch (code) {
33         case LM_ldots: dh = 0; break;
34         case LM_cdots: dh = ascent/2; break;
35         case LM_vdots: width /= 2;
36         case LM_ddots: dh = ascent; break;
37         }
38
39
40
41 void
42 MathDotsInset::Write(ostream & os, bool /* fragile */)
43 {
44         os << '\\' << name << ' ';
45 }