]> git.lyx.org Git - lyx.git/blob - src/insets/InsetInfo.h
c7909e47394f9a429237c714fc7269ff8c08f262
[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                 MENU_INFO,      // Which menu item is used for certain function
33         };
34
35         ///
36         InsetInfo(BufferParams const & bp, std::string const & info = std::string());
37         ///
38         Inset * editXY(Cursor & cur, int x, int y);
39         ///
40         EDITABLE editable() const { return NOT_EDITABLE; }
41         ///
42         void draw(PainterInfo & pi, int x, int y) const;
43         ///
44         void read(Buffer const &, Lexer & lex);
45         ///
46         void write(Buffer const & buf, std::ostream & os) const;
47         ///
48         void doDispatch(Cursor & cur, FuncRequest & cmd);
49         ///
50         Inset::Code lyxCode() const { return Inset::INFO_CODE; }
51         ///
52         void setInfo(std::string const & info);
53         ///
54         bool setMouseHover(bool mouse_hover);
55
56 private:
57         /// The translator between the information type enum and corresponding string.
58         Translator<info_type, std::string> const & nameTranslator() const;
59         /// update info_ and text
60         void updateInfo();
61         ///
62         virtual Inset * clone() const { return new InsetInfo(*this); }
63         ///
64         info_type type_;
65         ///
66         std::string name_;
67         /// store the buffer parameter
68         BufferParams const & bp_;
69         ///
70         bool mouse_hover_;
71 };
72
73
74
75 } // namespace lyx
76
77 #endif