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"
25 RenderButton::RenderButton()
30 RenderBase * RenderButton::clone(Inset const *) const
32 return new RenderButton(*this);
36 void RenderButton::update(docstring const & text, bool editable)
43 bool RenderButton::metrics(MetricsInfo &, Dimension & dim) const
45 Font font(Font::ALL_SANE);
47 frontend::FontMetrics const & fm =
51 fm.buttonText(text_, dim.wid, dim.asc, dim.des);
53 fm.rectText(text_, dim.wid, dim.asc, dim.des);
63 void RenderButton::draw(PainterInfo & pi, int x, int y) const
65 // Draw it as a box with the LaTeX text
66 Font font(Font::ALL_SANE);
67 font.setColor(Color::command);
71 pi.pain.buttonText(x + 2, y, text_, font, renderState());
73 pi.pain.rectText(x + 2, y, text_, font,
74 Color::commandbg, Color::commandframe);