2 * \file RenderButton.cpp
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 "RenderButton.h"
16 #include "MetricsInfo.h"
18 #include "frontends/FontMetrics.h"
19 #include "frontends/Painter.h"
28 RenderButton::RenderButton()
33 auto_ptr<RenderBase> RenderButton::clone(Inset const *) const
35 return auto_ptr<RenderBase>(new RenderButton(*this));
39 void RenderButton::update(docstring const & text, bool editable)
46 bool RenderButton::metrics(MetricsInfo &, Dimension & dim) const
48 Font font(Font::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);
66 void RenderButton::draw(PainterInfo & pi, int x, int y) const
68 // Draw it as a box with the LaTeX text
69 Font font(Font::ALL_SANE);
70 font.setColor(Color::command);
74 pi.pain.buttonText(x + 2, y, text_, font, renderState());
76 pi.pain.rectText(x + 2, y, text_, font,
77 Color::commandbg, Color::commandframe);