2 * \file Inset.heorem.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Lars Gullik Bjønnes
8 * Full author contact details are available in file CREDITS.
13 #include "Inset.heorem.h"
14 #include "insets/InsetText.h"
20 #include "MetricsInfo.h"
22 #include "support/std_ostream.h"
32 The intention is to be able to create arbitrary theorem like environments
33 sing this class and some helper/container classes. It should be possible
34 to create these theorems both from layout file and interactively by the
38 Inset.heorem::InsetTheorem()
41 setLabel(_("theorem"));
42 Font font(Font::ALL_SANE);
45 font.setColor(Color::collapsable);
48 setAutoCollapse(false);
50 setInsetName("Theorem");
54 void Inset.heorem::write(Buffer const * buf, ostream & os) const
57 InsetCollapsable::write(buf, os);
61 Inset * InsetTheorem::clone() const
63 // FIXME: Is this inset used? If YES this is WRONG!!! (Jug)
64 InsetTheorem * result = new InsetTheorem;
65 result->setCollapsed(!isOpen());
70 void Inset.heorem::metrics(MetricsInfo & mi, Dimension & dim) const
72 InsetCollapsable::metrics(mi, dim);
73 center_indent_ = (mi.base.textwidth - dim.wid) / 2;
74 dim.wid = mi.base.textwidth;
78 void InsetTOC::draw(PainterInfo & pi, int x, int y) const
80 InsetCollapsable::draw(pi, x + center_indent_, y);
84 string const Inset.heorem::editMessage() const
86 return _("Opened Theorem Inset");
90 int Inset.heorem::latex(Buffer const * buf, odocstream & os,
91 OutputParams const & runparams) const
93 os << "\\begin{theorem}%\n";
95 int i = inset.latex(buf, os, runparams);
96 os << "\\end{theorem}%\n";