3 * \file InsetListings.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
12 #ifndef INSETLISTINGS_H
13 #define INSETLISTINGS_H
15 #include "LaTeXFeatures.h"
17 #include "InsetListingsParams.h"
18 #include "MailInset.h"
23 /** A collapsable text inset for program listings.
27 class InsetListings : public InsetCollapsable {
30 InsetListings(Buffer const &, InsetListingsParams const & par = InsetListingsParams());
34 bool isLabeled() const { return true; }
36 InsetCode lyxCode() const { return LISTINGS_CODE; }
37 /// lstinline is inlined, normal listing is displayed
38 DisplayType display() const;
40 docstring name() const { return from_ascii("Listings"); }
41 // Update the counters of this inset and of its contents
42 void updateLabels(ParIterator const &);
44 void write(std::ostream & os) const;
46 void read(Lexer & lex);
48 docstring editMessage() const;
50 int latex(odocstream &, OutputParams const &) const;
52 void validate(LaTeXFeatures &) const;
54 bool showInsetDialog(BufferView *) const;
56 InsetListingsParams const & params() const { return params_; }
58 InsetListingsParams & params() { return params_; }
61 void doDispatch(Cursor & cur, FuncRequest & cmd);
63 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
65 Inset * clone() const { return new InsetListings(*this); }
67 void setButtonLabel();
69 docstring getCaption(OutputParams const &) const;
71 InsetListingsParams params_;
75 class InsetListingsMailer : public MailInset {
78 InsetListingsMailer(InsetListings & inset);
80 virtual Inset & inset() const { return inset_; }
82 virtual std::string const & name() const { return name_; }
84 virtual std::string const inset2string(Buffer const &) const;
86 static void string2params(std::string const &,
87 InsetListingsParams &);
89 static std::string const params2string(InsetListingsParams const &);
92 static std::string const name_;
94 InsetListings & inset_;