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