#include "render_button.h"
-#include "BufferView.h"
#include "LColor.h"
#include "metricsinfo.h"
-#include "frontends/font_metrics.h"
-#include "frontends/LyXView.h"
+#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
+
+namespace lyx {
+
using std::string;
+using std::auto_ptr;
RenderButton::RenderButton()
{}
-RenderBase * RenderButton::clone() const
+auto_ptr<RenderBase> RenderButton::clone(InsetBase const *) const
{
- return new RenderButton(*this);
+ return auto_ptr<RenderBase>(new RenderButton(*this));
}
-void RenderButton::update(string const & text, bool editable)
+void RenderButton::update(docstring const & text, bool editable)
{
text_ = text;
editable_ = editable;
{
LyXFont font(LyXFont::ALL_SANE);
font.decSize();
-
+ frontend::FontMetrics const & fm =
+ theFontMetrics(font);
+
if (editable_)
- font_metrics::buttonText(text_, font, dim.wid, dim.asc, dim.des);
+ fm.buttonText(text_, dim.wid, dim.asc, dim.des);
else
- font_metrics::rectText(text_, font, dim.wid, dim.asc, dim.des);
+ fm.rectText(text_, dim.wid, dim.asc, dim.des);
dim.wid += 4;
}
void RenderButton::draw(PainterInfo & pi, int x, int y) const
{
- BOOST_ASSERT(pi.base.bv);
- view_ = pi.base.bv->owner()->view();
-
// Draw it as a box with the LaTeX text
LyXFont font(LyXFont::ALL_SANE);
font.setColor(LColor::command);
LColor::commandbg, LColor::commandframe);
}
}
+
+
+} // namespace lyx