1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 1995 Matthias Ettrich
7 * Copyright 2000 The LyX Team.
9 * ====================================================== */
14 #pragma implementation
17 #include "insetbutton.h"
25 InsetButton::InsetButton()
29 int InsetButton::ascent(Painter & pain, LyXFont const &) const
31 LyXFont font(LyXFont::ALL_SANE);
34 int width, ascent, descent;
35 string s = getScreenLabel();
38 pain.buttonText(0, 0, s, font,
39 false, width, ascent, descent);
41 pain.rectText(0, 0, s, font,
42 LColor::commandbg, LColor::commandframe,
43 false, width, ascent, descent);
49 int InsetButton::descent(Painter & pain, LyXFont const &) const
51 LyXFont font(LyXFont::ALL_SANE);
54 int width, ascent, descent;
55 string s = getScreenLabel();
58 pain.buttonText(0, 0, s, font,
59 false, width, ascent, descent);
61 pain.rectText(0, 0, s, font,
62 LColor::commandbg, LColor::commandframe,
63 false, width, ascent, descent);
69 int InsetButton::width(Painter & pain, LyXFont const &) const
71 LyXFont font(LyXFont::ALL_SANE);
74 int width, ascent, descent;
75 string s = getScreenLabel();
78 pain.buttonText(0, 0, s, font,
79 false, width, ascent, descent);
81 pain.rectText(0, 0, s, font,
82 LColor::commandbg, LColor::commandframe,
83 false, width, ascent, descent);
89 void InsetButton::draw(Painter & pain, LyXFont const &,
90 int baseline, float & x) const
92 // Draw it as a box with the LaTeX text
93 LyXFont font(LyXFont::ALL_SANE);
94 font.setColor(LColor::command).decSize();
97 string s = getScreenLabel();
100 pain.buttonText(int(x)+2, baseline, s, font, true, width);
102 pain.rectText(int(x)+2, baseline, s, font,
103 LColor::commandbg, LColor::commandframe,