]> git.lyx.org Git - lyx.git/blob - src/mathed/math_macro.h
small cleanup, doxygen, formatting changes
[lyx.git] / src / mathed / math_macro.h
1 // -*- C++ -*-
2 /*
3  *  File:        math_macro.h
4  *  Purpose:     Declaration of macro class for mathed 
5  *  Author:      Alejandro Aguilar Sierra <asierra@servidor.unam.mx> 
6  *  Created:     November 1996
7  *  Description: WYSIWYG math macros
8  *
9  *  Dependencies: Mathed
10  *
11  *  Copyright: 1996, 1997 Alejandro Aguilar Sierra
12  *
13  *   Version: 0.2, Mathed & Lyx project.
14  *
15  *   This code is under the GNU General Public Licence version 2 or later.
16  */
17 #ifndef MATH_MACRO
18 #define MATH_MACRO
19
20 #ifdef __GNUG__
21 #pragma interface
22 #endif
23
24 #include <vector>
25 #include "math_parinset.h"
26
27 class MathMacroTemplate;
28
29
30 /** This class contains the data for a macro
31     \author Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
32     \version November 1996
33  */
34 class MathMacro : public MathParInset
35 {
36 public:
37         /// A macro can only be builded from an existing template
38         explicit
39         MathMacro(MathMacroTemplate *);
40         /// or from another macro.
41         explicit
42         MathMacro(MathMacro *);
43         ///
44         ~MathMacro();
45         ///
46         void draw(Painter &, int, int);
47         ///
48         void Metrics();
49         ///
50         MathedInset * Clone();
51         ///
52         void Write(std::ostream &, bool fragile);
53         ///
54         bool setArgumentIdx(int);
55         ///
56         int getArgumentIdx() const;
57         ///
58         int getMaxArgumentIdx() const;
59         ///
60         int GetColumns() const;
61         ///
62         void GetXY(int &, int &) const;
63         ///
64         void SetFocus(int, int);
65         ///
66         MathedArray * GetData();
67         ///
68         MathedRowSt * getRowSt() const;
69         ///
70         void setData(MathedArray *);
71         ///
72         MathedTextCodes getTCode() const;
73         ///
74         bool Permit(short) const;
75 private:
76         ///
77         MathMacroTemplate * tmplate_;
78         ///
79         struct MacroArgumentBase {
80                 /// Position of the macro
81                 int x;
82                 ///
83                 int y;
84                 ///
85                 MathedRowSt * row;
86                 ///
87                 MathedArray * array;
88                 ///
89                 MacroArgumentBase()
90                         : x(0), y(0), row(0), array(0)
91                         {}
92         };
93         std::vector<MacroArgumentBase> args_;
94         ///
95         int idx_;
96         ///
97         int nargs_;
98         ///
99         MathedTextCodes tcode_;
100 };
101 #endif