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"
15 #include "BufferView.h"
17 #include "metricsinfo.h"
19 #include "frontends/font_metrics.h"
20 #include "frontends/LyXView.h"
21 #include "frontends/Painter.h"
26 RenderButton::RenderButton()
31 RenderBase * RenderButton::clone() const
33 return new RenderButton(*this);
37 void RenderButton::update(string const & text, bool editable)
44 void RenderButton::metrics(MetricsInfo &, Dimension & dim) const
46 LyXFont font(LyXFont::ALL_SANE);
50 font_metrics::buttonText(text_, font, dim.wid, dim.asc, dim.des);
52 font_metrics::rectText(text_, font, dim.wid, dim.asc, dim.des);
58 void RenderButton::draw(PainterInfo & pi, int x, int y) const
60 BOOST_ASSERT(pi.base.bv);
61 view_ = pi.base.bv->owner()->view();
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);