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/font_metrics.h"
19 #include "frontends/Painter.h"
25 RenderButton::RenderButton()
30 auto_ptr<RenderBase> RenderButton::clone() const
32 return auto_ptr<RenderBase>(new RenderButton(*this));
36 void RenderButton::update(string const & text, bool editable)
43 void RenderButton::metrics(MetricsInfo &, Dimension & dim) const
45 LyXFont font(LyXFont::ALL_SANE);
49 font_metrics::buttonText(text_, font, dim.wid, dim.asc, dim.des);
51 font_metrics::rectText(text_, font, dim.wid, dim.asc, dim.des);
57 void RenderButton::draw(PainterInfo & pi, int x, int y) const
59 // Draw it as a box with the LaTeX text
60 LyXFont font(LyXFont::ALL_SANE);
61 font.setColor(LColor::command);
65 pi.pain.buttonText(x + 2, y, text_, font);
67 pi.pain.rectText(x + 2, y, text_, font,
68 LColor::commandbg, LColor::commandframe);