3 * \file InsetTheorem.cpp
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
9 * Full author contact details are available in file CREDITS.
14 #include "InsetTheorem.h"
15 #include "insets/InsetText.h"
21 #include "MetricsInfo.h"
23 #include "support/std_ostream.h"
33 The intention is to be able to create arbitrary theorem like environments
34 sing this class and some helper/container classes. It should be possible
35 to create these theorems both from layout file and interactively by the
39 Inset.heorem::InsetTheorem()
42 setLabel(_("theorem"));
43 Font font(Font::ALL_SANE);
46 font.setColor(Color_collapsable);
49 setAutoCollapse(false);
51 setInsetName("Theorem");
55 void Inset.heorem::write(Buffer const * buf, ostream & os) const
58 InsetCollapsable::write(buf, os);
62 Inset * InsetTheorem::clone() const
64 // FIXME: Is this inset used? If YES this is WRONG!!! (Jug)
65 InsetTheorem * result = new InsetTheorem;
66 result->setCollapsed(!isOpen());
71 void Inset.heorem::metrics(MetricsInfo & mi, Dimension & dim) const
73 InsetCollapsable::metrics(mi, dim);
74 center_indent_ = (mi.base.textwidth - dim.wid) / 2;
75 dim.wid = mi.base.textwidth;
79 void InsetTOC::draw(PainterInfo & pi, int x, int y) const
81 InsetCollapsable::draw(pi, x + center_indent_, y);
85 string const Inset.heorem::editMessage() const
87 return _("Opened Theorem Inset");
91 int Inset.heorem::latex(Buffer const * buf, odocstream & os,
92 OutputParams const & runparams) const
94 os << "\\begin{theorem}%\n";
96 int i = inset.latex(buf, os, runparams);
97 os << "\\end{theorem}%\n";