]> git.lyx.org Git - lyx.git/blob - src/insets/InsetListings.h
Fix bug 4346: http://bugzilla.lyx.org/show_bug.cgi?id=4346.
[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 INSET_LISTINGS_H
13 #define INSET_LISTINGS_H
14
15 #include "LaTeXFeatures.h"
16 #include "InsetERT.h"
17 #include "InsetListingsParams.h"
18
19
20 namespace lyx {
21
22 /////////////////////////////////////////////////////////////////////////
23 //
24 // InsetListings
25 //
26 /////////////////////////////////////////////////////////////////////////
27
28 /// A collapsable text inset for program listings.
29 class InsetListings : public InsetCollapsable
30 {
31 public:
32         ///
33         InsetListings(Buffer const &, InsetListingsParams const & par = InsetListingsParams());
34         ///
35         ~InsetListings();
36         ///
37         static void string2params(std::string const &, InsetListingsParams &);
38         ///
39         static std::string params2string(InsetListingsParams const &);
40 private:
41         ///
42         bool isLabeled() const { return true; }
43         ///
44         InsetCode lyxCode() const { return LISTINGS_CODE; }
45         /// lstinline is inlined, normal listing is displayed
46         DisplayType display() const;
47         ///
48         docstring name() const { return from_ascii("Listings"); }
49         // Update the counters of this inset and of its contents
50         void updateLabels(ParIterator const &);
51         ///
52         void write(std::ostream & os) const;
53         ///
54         void read(Lexer & lex);
55         ///
56         docstring editMessage() const;
57         ///
58         int latex(odocstream &, OutputParams const &) const;
59         ///
60         void validate(LaTeXFeatures &) const;
61         ///
62         bool showInsetDialog(BufferView *) const;
63         ///
64         InsetListingsParams const & params() const { return params_; }
65         ///
66         InsetListingsParams & params() { return params_; }
67         ///
68         docstring contextMenu(BufferView const & bv, int x, int y) const;
69         ///
70         void doDispatch(Cursor & cur, FuncRequest & cmd);
71         ///
72         bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
73         ///
74         Inset * clone() const { return new InsetListings(*this); }
75         ///
76         void setButtonLabel(BufferView const & bv);
77         ///
78         docstring getCaption(OutputParams const &) const;
79
80         ///
81         InsetListingsParams params_;
82 };
83
84 } // namespace lyx
85
86 #endif // INSET_LISTINGS_H