]> git.lyx.org Git - lyx.git/blob - src/mathed/math_macrotemplate.h
b351a4ff6e0b5df76a88b38e2d1fcffb85b06eed
[lyx.git] / src / mathed / math_macrotemplate.h
1 // -*- C++ -*-
2 #ifndef MATHMACROTEMPLATE
3 #define MATHMACROTEMPLATE
4
5 #include <vector>
6
7 #include "math_parinset.h"
8 #include "math_macroarg.h"
9
10 #ifdef __GNUG__
11 #pragma interface
12 #endif
13
14 class MathMacro;
15
16 /** This class contains the macro definition
17     \author Alejandro Aguilar Sierra
18  */
19 class MathMacroTemplate : public MathParInset {
20 public:
21         /// A template constructor needs all the data
22         explicit
23         MathMacroTemplate(string const &, int na = 0, int f = 0);
24         ///
25         void draw(Painter &, int, int);
26         ///
27         void Metrics();
28         ///
29         void WriteDef(std::ostream &, bool fragile);
30         /// useful for special insets
31         void  setTCode(MathedTextCodes t);
32         ///
33         MathedTextCodes getTCode() const;
34         /// 
35         void setArgument(MathedArray *, int i= 0);
36         /// Number of arguments
37         int getNoArgs() const;
38         ///
39         void GetMacroXY(int, int &, int &) const;
40         ///
41         MathParInset * getMacroPar(int) const;
42         ///
43         void SetMacroFocus(int &, int, int);
44         ///
45         void setEditMode(bool);
46         
47         /// Replace the appropriate arguments with a specific macro's data
48         void update(MathMacro * m);
49         ///
50         short flags() const;
51 private:
52         ///
53         short flags_;
54         ///
55         MathedTextCodes tcode_;
56         ///
57         std::vector<MathMacroArgument> args_;
58         ///
59         int nargs_;
60 };
61
62
63 inline
64 short MathMacroTemplate::flags() const {
65         return flags_;
66 }
67 #endif