]> git.lyx.org Git - lyx.git/blob - src/insets/InsetInfo.h
19821658aebad04b2628c6fee2e2dc1ecc2268b6
[lyx.git] / src / insets / InsetInfo.h
1 // -*- C++ -*-
2 /**
3  * \file InsetInfo.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_INFO_H
13 #define INSET_INFO_H
14
15 #include "InsetText.h"
16 #include "RenderButton.h"
17 #include "gettext.h"
18 #include "Cursor.h"
19 #include "support/Translator.h"
20
21 namespace lyx {
22
23 /** Used to insert index labels
24   */
25 class InsetInfo : public InsetText {
26 public:
27         enum info_type {
28                 UNKNOWN_INFO,   // Invalid type
29                 SHORTCUT_INFO,  // Keyboard shortcut
30                 PACKAGE_INFO,   // Availability of package
31                 TEXTCLASS_INFO, // Availability of textclass
32         };
33
34         ///
35         InsetInfo(BufferParams const & bp, std::string const & info = std::string());
36         ///
37         Inset * editXY(Cursor & cur, int x, int y);
38         ///
39         EDITABLE editable() const { return NOT_EDITABLE; }
40         ///
41         void draw(PainterInfo & pi, int x, int y) const;
42         ///
43         void read(Buffer const &, Lexer & lex);
44         ///
45         void write(Buffer const & buf, std::ostream & os) const;
46         ///
47         void doDispatch(Cursor & cur, FuncRequest & cmd);
48         ///
49         Inset::Code lyxCode() const { return Inset::INFO_CODE; }
50         ///
51         void setInfo(std::string const & info);
52         ///
53         bool setMouseHover(bool mouse_hover);
54
55 private:
56         /// The translator between the information type enum and corresponding string.
57         Translator<info_type, std::string> const & nameTranslator() const;
58         /// update info_ and text
59         void updateInfo();
60         ///
61         virtual Inset * clone() const { return new InsetInfo(*this); }
62         ///
63         info_type type_;
64         ///
65         std::string name_;
66         /// store the buffer parameter
67         BufferParams const & bp_;
68         ///
69         bool mouse_hover_;
70 };
71
72
73
74 } // namespace lyx
75
76 #endif