]> git.lyx.org Git - lyx.git/blob - src/insets/InsetListings.h
Remremove unneeded init() method.
[lyx.git] / src / insets / InsetListings.h
1 // -*- C++ -*-
2 /**
3  * \file InsetListings.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Bo Peng
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef INSETLISTINGS_H
13 #define INSETLISTINGS_H
14
15 #include "LaTeXFeatures.h"
16 #include "InsetERT.h"
17 #include "InsetListingsParams.h"
18 #include "MailInset.h"
19
20
21 namespace lyx {
22
23 /** A collapsable text inset for program listings.
24  */
25
26
27 class InsetListings : public InsetCollapsable {
28 public:
29         ///
30         InsetListings(BufferParams const &, InsetListingsParams const & par = InsetListingsParams());
31         ///
32         ~InsetListings();
33         ///
34         InsetCode lyxCode() const { return LISTINGS_CODE; }
35         /// lstinline is inlined, normal listing is displayed
36         virtual DisplayType display() const;
37         ///
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 &);
41         ///
42         void write(Buffer const & buf, std::ostream & os) const;
43         ///
44         void read(Buffer const & buf, Lexer & lex);
45         ///
46         virtual docstring const editMessage() const;
47         ///
48         int latex(Buffer const &, odocstream &, OutputParams const &) const;
49         ///
50         void validate(LaTeXFeatures &) const;
51         ///
52         bool showInsetDialog(BufferView *) const;
53         ///
54         InsetListingsParams const & params() const { return params_; }
55         ///
56         InsetListingsParams & params() { return params_; }
57 protected:
58         InsetListings(InsetListings const &);
59         ///
60         virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
61         ///
62         bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
63 private:
64         virtual Inset * clone() const;
65         ///
66         void setButtonLabel();
67         ///
68         docstring getCaption(Buffer const &, OutputParams const &) const;
69         ///
70         InsetListingsParams params_;
71 };
72
73
74 class InsetListingsMailer : public MailInset {
75 public:
76         ///
77         InsetListingsMailer(InsetListings & inset);
78         ///
79         virtual Inset & inset() const { return inset_; }
80         ///
81         virtual std::string const & name() const { return name_; }
82         ///
83         virtual std::string const inset2string(Buffer const &) const;
84         ///
85         static void string2params(std::string const &,
86                 InsetListingsParams &);
87         ///
88         static std::string const params2string(InsetListingsParams const &);
89 private:
90         ///
91         static std::string const name_;
92         ///
93         InsetListings & inset_;
94 };
95
96
97 } // namespace lyx
98
99 #endif