]> git.lyx.org Git - lyx.git/blob - src/insets/inseterror.h
4d40f04e4f8c638c325be669d8d28eee2b8c8c92
[lyx.git] / src / insets / inseterror.h
1 // -*- C++ -*-
2 /**
3  * \file inseterror.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars Gullik Bjønnes
8  *
9  * Full author contact details are available in file CREDITS
10  */
11
12 #ifndef INSET_ERROR_H
13 #define INSET_ERROR_H
14
15
16 #include "inset.h"
17 #include "LString.h"
18
19 #include <boost/signals/signal0.hpp>
20
21 /** Used for error messages from LaTeX runs.
22
23   The edit-operation opens a
24   dialog with the text of the error-message. The inset is displayed as
25   "Error" in a box, and automatically deleted. */
26 class InsetError : public Inset {
27 public:
28         ///
29         explicit
30         InsetError(string const &, bool same_id = false);
31         ///
32         ~InsetError() { hideDialog(); }
33         ///
34         int ascent(BufferView *, LyXFont const &) const;
35         ///
36         int descent(BufferView *, LyXFont const &) const;
37         ///
38         int width(BufferView *, LyXFont const &) const;
39         ///
40         void draw(BufferView *, LyXFont const &, int, float &, bool) const;
41         ///
42         void write(Buffer const *, std::ostream &) const {}
43         ///
44         void read(Buffer const *, LyXLex &) {}
45         ///
46         int latex(Buffer const *, std::ostream &, bool, bool) const { return 0; }
47         ///
48         int ascii(Buffer const *, std::ostream &, int) const { return 0; }
49         ///
50         int linuxdoc(Buffer const *, std::ostream &) const { return 0; }
51         ///
52         int docbook(Buffer const *, std::ostream &, bool) const { return 0; }
53         ///
54         bool autoDelete() const { return true; }
55         /// what appears in the minibuffer when opening
56         string const editMessage() const;
57         ///
58         void edit(BufferView *, int, int, mouse_button::state);
59         ///
60         void edit(BufferView * bv, bool front = true);
61         ///
62         EDITABLE editable() const { return IS_EDITABLE; }
63         ///
64         Inset * clone(Buffer const &, bool same_id = false) const {
65                 return new InsetError(contents, same_id);
66         }
67         ///
68         Inset::Code lyxCode() const { return Inset::ERROR_CODE; }
69         /// We don't want "begin" and "end inset" in lyx-file
70         bool directWrite() const { return true; };
71         ///
72         string const & getContents() const { return contents; }
73         ///
74         boost::signal0<void> hideDialog;
75 private:
76         ///
77         string contents;
78 };
79 #endif