]> git.lyx.org Git - lyx.git/blob - src/mathed/math_macrotemplate.h
tfracinset files is missing so all usage of tfrac is commented out
[lyx.git] / src / mathed / math_macrotemplate.h
1 // -*- C++ -*-
2 /**
3  * \file math_macrotemplate.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Alejandro Aguilar Sierra
8  * \author André Pönitz
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef MATH_MACROTEMPLATE_H
14 #define MATH_MACROTEMPLATE_H
15
16 #include "math_data.h"
17 #include "math_macrotable.h"
18 #include "math_nestinset.h"
19
20
21 /// This class contains the macro definition.
22 class MathMacroTemplate : public MathNestInset {
23 public:
24         ///
25         MathMacroTemplate();
26         ///
27         MathMacroTemplate(std::string const & name, int nargs,
28                 std::string const & type,
29                 MathArray const & = MathArray(),
30                 MathArray const & = MathArray());
31         ///
32         explicit MathMacroTemplate(std::istream & is);
33         ///
34         std::auto_ptr<InsetBase> clone() const;
35         ///
36         void edit(LCursor & cur, bool left);
37         ///
38         EDITABLE editable() const { return HIGHLY_EDITABLE; }
39         ///
40         void read(Buffer const &, LyXLex & lex);
41         ///
42         void write(Buffer const &, std::ostream & os) const;
43         ///
44         void write(WriteStream & os) const;
45         /// Number of arguments
46         int numargs() const;
47         ///
48         void numargs(int);
49         ///
50         std::string name() const;
51         ///
52         MacroData asMacroData() const;
53         ///
54         void draw(PainterInfo & pi, int x, int y) const;
55         ///
56         void metrics(MetricsInfo & mi, Dimension & dim) const;
57         /// identifies macro templates
58         MathMacroTemplate * asMacroTemplate() { return this; }
59         /// identifies macro templates
60         MathMacroTemplate const * asMacroTemplate() const { return this; }
61         ///
62         InsetBase::Code lyxCode() const { return MATHMACRO_CODE; }
63
64 private:
65         /// prefix in inset
66         std::string prefix() const;
67
68         ///
69         int numargs_;
70         ///
71         std::string name_;
72         /// newcommand or renewcommand or def
73         std::string type_;
74 };
75
76 #endif