]> git.lyx.org Git - features.git/blob - src/mathed/math_macro.h
more mathed cleanup
[features.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 class MathMacro : public MathParInset
32 {
33 public:
34         /// A macro can only be builded from an existing template
35         explicit
36         MathMacro(MathMacroTemplate *);
37         /// or from another macro.
38         explicit
39         MathMacro(MathMacro *);
40         ///
41         ~MathMacro();
42         ///
43         void draw(Painter &, int, int);
44         ///
45         void Metrics();
46         ///
47         MathedInset * Clone();
48         ///
49         void Write(std::ostream &, bool fragile);
50         ///
51         bool setArgumentIdx(int);
52         ///
53         int getArgumentIdx() const;
54         ///
55         int getMaxArgumentIdx() const;
56         ///
57         int GetColumns() const;
58         ///
59         void GetXY(int &, int &) const;
60         ///
61         void SetFocus(int, int);
62         ///
63         MathedArray * GetData();
64         ///
65         MathedRowSt * getRowSt() const;
66         ///
67         void SetData(MathedArray *);
68         ///
69         MathedTextCodes getTCode() const;
70         ///
71         bool Permit(short) const;
72 private:
73         ///
74         MathMacroTemplate * tmplate;
75         ///
76         struct MacroArgumentBase {
77                 /// Position of the macro
78                 int x;
79                 ///
80                 int y;
81                 ///
82                 MathedRowSt * row;
83                 ///
84                 MathedArray * array;
85                 ///
86                 MacroArgumentBase() { x = y = 0;  array = 0; row = 0; }
87         };
88         std::vector<MacroArgumentBase> args_;
89         ///
90         int idx;
91         ///
92         int nargs;
93         ///
94         MathedTextCodes tcode;
95         ///
96         friend class MathMacroTemplate;
97 };
98 #endif