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"
17 #include "support/debug.h"
18 #include "support/gettext.h"
21 #include "MetricsInfo.h"
30 The intention is to be able to create arbitrary theorem like environments
31 sing this class and some helper/container classes. It should be possible
32 to create these theorems both from layout file and interactively by the
36 Inset.heorem::InsetTheorem()
39 setLabel(_("theorem"));
41 setAutoCollapse(false);
43 setInsetName("Theorem");
47 void Inset.heorem::write(Buffer const * buf, ostream & os) const
50 InsetCollapsable::write(buf, os);
54 Inset * InsetTheorem::clone() const
56 // FIXME: Is this inset used? If YES this is WRONG!!! (Jug)
57 InsetTheorem * result = new InsetTheorem;
58 result->setCollapsed(!isOpen());
63 void Inset.heorem::metrics(MetricsInfo & mi, Dimension & dim) const
65 InsetCollapsable::metrics(mi, dim);
66 center_indent_ = (mi.base.textwidth - dim.wid) / 2;
67 dim.wid = mi.base.textwidth;
71 void InsetTOC::draw(PainterInfo & pi, int x, int y) const
73 InsetCollapsable::draw(pi, x + center_indent_, y);
77 string const Inset.heorem::editMessage() const
79 return _("Opened Theorem Inset");
83 int Inset.heorem::latex(Buffer const * buf, odocstream & os,
84 OutputParams const & runparams) const
86 os << "\\begin{theorem}%\n";
88 int i = inset.latex(buf, os, runparams);
89 os << "\\end{theorem}%\n";