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"
15 #include "MetricsInfo.h"
17 #include "frontends/FontMetrics.h"
18 #include "frontends/Painter.h"
24 RenderButton::RenderButton()
29 RenderBase * RenderButton::clone(Inset const *) const
31 return new RenderButton(*this);
35 void RenderButton::update(docstring const & text, bool editable)
42 void RenderButton::metrics(MetricsInfo &, Dimension & dim) const
44 FontInfo font = sane_font;
46 frontend::FontMetrics const & fm =
50 fm.buttonText(text_, dim.wid, dim.asc, dim.des);
52 fm.rectText(text_, dim.wid, dim.asc, dim.des);
59 void RenderButton::draw(PainterInfo & pi, int x, int y) const
61 // Draw it as a box with the LaTeX text
62 FontInfo font = sane_font;
63 font.setColor(Color_command);
67 pi.pain.buttonText(x + 2, y, text_, font, renderState());
69 pi.pain.rectText(x + 2, y, text_, font,
70 Color_commandbg, Color_commandframe);