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,
40 inherit_font_ = inherit_font;
44 void RenderButton::metrics(MetricsInfo & mi, Dimension & dim) const
46 FontInfo font = inherit_font_ ? mi.base.font : sane_font;
48 frontend::FontMetrics const & fm =
52 fm.buttonText(text_, dim.wid, dim.asc, dim.des);
54 fm.rectText(text_, dim.wid, dim.asc, dim.des);
60 void RenderButton::draw(PainterInfo & pi, int x, int y) const
62 // Draw it as a box with the LaTeX text
63 FontInfo font = inherit_font_ ? pi.base.font : sane_font;
64 font.setColor(Color_command);
68 pi.pain.buttonText(x, y, text_, font, renderState());
70 pi.pain.rectText(x, y, text_, font,
71 Color_commandbg, Color_commandframe);