]> git.lyx.org Git - features.git/blob - src/mathed/math_macro.h
094efe14f9ee8a459c2b10e979000e87450daef9
[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: Math
10  *
11  *  Copyright: 1996, 1997 Alejandro Aguilar Sierra
12  *
13  *   Version: 0.2, Math & Lyx project.
14  *
15  *   This code is under the GNU General Public Licence version 2 or later.
16  */
17 #ifndef MATH_MACRO_H
18 #define MATH_MACRO_H
19
20 #ifdef __GNUG__
21 #pragma interface
22 #endif
23
24 #include <vector>
25 #include <iosfwd>
26
27 #include "math_inset.h"
28 #include "math_macroarg.h"
29
30 class MathMacroTemplate;
31
32
33 /** This class contains the data for a macro
34     \author Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
35     \version November 1996
36  */
37 class MathMacro : public MathInset {
38 public:
39         /// A macro can be built from an existing template
40         explicit MathMacro(MathMacroTemplate const &);
41         ///
42         void draw(Painter &, int, int);
43         ///
44         void Metrics(MathStyles st);
45         ///
46         MathInset * clone() const;
47         ///
48         void Write(std::ostream &, bool fragile) const;
49         ///
50         void WriteNormal(std::ostream &) const;
51         ///
52         void dump(std::ostream & os) const;
53
54         ///
55         bool idxUp(int &, int &) const;
56         ///
57         bool idxDown(int &, int &) const;
58         ///
59         bool idxLeft(int &, int &) const;
60         ///
61         bool idxRight(int &, int &) const;
62
63 private:
64         ///
65         MathMacroTemplate const * const tmplate_;
66         ///
67         MathXArray expanded_;
68 };
69
70
71 inline std::ostream & operator<<(std::ostream & os, MathMacro const & m)
72 {
73         m.dump(os);
74         return os;
75 }
76 #endif