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 InsetERT {
30 InsetListings(BufferParams const &, InsetListingsParams const & par = InsetListingsParams());
34 InsetCode lyxCode() const { return LISTINGS_CODE; }
35 /// lstinline is inlined, normal listing is displayed
36 virtual DisplayType display() const;
38 docstring name() const { return from_ascii("Listings"); }
39 // Update the counters of this inset and of its contents
40 virtual void updateLabels(Buffer const &, ParIterator const &);
42 void write(Buffer const & buf, std::ostream & os) const;
44 void read(Buffer const & buf, Lexer & lex);
46 virtual docstring const editMessage() const;
48 int latex(Buffer const &, odocstream &, OutputParams const &) const;
50 void validate(LaTeXFeatures &) const;
52 void metrics(MetricsInfo &, Dimension &) const;
54 void draw(PainterInfo & pi, int x, int y) const;
56 bool showInsetDialog(BufferView *) const;
58 void getDrawFont(Font &) const;
60 InsetListingsParams const & params() const { return params_; }
62 InsetListingsParams & params() { return params_; }
64 InsetListings(InsetListings const &);
66 virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
68 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
70 virtual Inset * clone() const;
74 void setButtonLabel();
76 docstring getCaption(Buffer const &, OutputParams const &) const;
78 InsetListingsParams params_;
82 class InsetListingsMailer : public MailInset {
85 InsetListingsMailer(InsetListings & inset);
87 virtual Inset & inset() const { return inset_; }
89 virtual std::string const & name() const { return name_; }
91 virtual std::string const inset2string(Buffer const &) const;
93 static void string2params(std::string const &,
94 InsetListingsParams &);
96 static std::string const params2string(InsetListingsParams const &);
99 static std::string const name_;
101 InsetListings & inset_;