]> git.lyx.org Git - features.git/blob - src/mathed/math_macrotemplate.h
fix macro, small cleanup
[features.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         //~MathMacroTemplate();
26         ///
27         void draw(Painter &, int, int);
28         ///
29         void Metrics();
30         ///
31         void WriteDef(std::ostream &, bool fragile);
32         /// useful for special insets
33         void  setTCode(MathedTextCodes t);
34         ///
35         MathedTextCodes getTCode() const;
36         /// 
37         void setArgument(MathedArray *, int i= 0);
38         /// Number of arguments
39         int getNoArgs() const;
40         ///
41         void GetMacroXY(int, int &, int &) const;
42         ///
43         MathParInset * getMacroPar(int) const;
44         ///
45         void SetMacroFocus(int &, int, int);
46         ///
47         void setEditMode(bool);
48         
49         /// Replace the appropriate arguments with a specific macro's data
50         void update(MathMacro * m = 0);
51         ///
52         short flags() const;
53 private:
54         ///
55         short flags_;
56         ///
57         MathedTextCodes tcode_;
58         ///
59         std::vector<MathMacroArgument> args_;
60         ///
61         int nargs_;
62 };
63
64
65 inline
66 short MathMacroTemplate::flags() const {
67         return flags_;
68 }
69 #endif