2 * \file render_button.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Angus Leeming
8 * Full author contact details are available in file CREDITS.
13 #include "render_button.h"
16 #include "metricsinfo.h"
18 #include "frontends/FontMetrics.h"
19 #include "frontends/Painter.h"
28 RenderButton::RenderButton()
33 auto_ptr<RenderBase> RenderButton::clone(InsetBase const *) const
35 return auto_ptr<RenderBase>(new RenderButton(*this));
39 void RenderButton::update(docstring const & text, bool editable)
46 void RenderButton::metrics(MetricsInfo &, Dimension & dim) const
48 LyXFont font(LyXFont::ALL_SANE);
50 frontend::FontMetrics const & fm =
54 fm.buttonText(text_, dim.wid, dim.asc, dim.des);
56 fm.rectText(text_, dim.wid, dim.asc, dim.des);
62 void RenderButton::draw(PainterInfo & pi, int x, int y) const
64 // Draw it as a box with the LaTeX text
65 LyXFont font(LyXFont::ALL_SANE);
66 font.setColor(LColor::command);
70 pi.pain.buttonText(x + 2, y, text_, font);
72 pi.pain.rectText(x + 2, y, text_, font,
73 LColor::commandbg, LColor::commandframe);