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