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"
27 RenderButton::RenderButton()
32 auto_ptr<RenderBase> RenderButton::clone(InsetBase const *) const
34 return auto_ptr<RenderBase>(new RenderButton(*this));
38 void RenderButton::update(docstring const & text, bool editable)
45 void RenderButton::metrics(MetricsInfo &, Dimension & dim) const
47 LyXFont font(LyXFont::ALL_SANE);
49 lyx::frontend::FontMetrics const & fm =
53 fm.buttonText(text_, dim.wid, dim.asc, dim.des);
55 fm.rectText(text_, dim.wid, dim.asc, dim.des);
61 void RenderButton::draw(PainterInfo & pi, int x, int y) const
63 // Draw it as a box with the LaTeX text
64 LyXFont font(LyXFont::ALL_SANE);
65 font.setColor(LColor::command);
69 pi.pain.buttonText(x + 2, y, text_, font);
71 pi.pain.rectText(x + 2, y, text_, font,
72 LColor::commandbg, LColor::commandframe);