]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathChar.h
Fixed bug 3449 by Stefan Schimanski:
[lyx.git] / src / mathed / InsetMathChar.h
1 // -*- C++ -*-
2 /**
3  * \file InsetMathChar.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author André Pönitz
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef MATH_CHARINSET_H
13 #define MATH_CHARINSET_H
14
15 #include "InsetMath.h"
16
17
18 namespace lyx {
19
20 /// The base character inset.
21 class InsetMathChar : public InsetMath {
22 public:
23         ///
24         explicit InsetMathChar(char_type c);
25         ///
26         bool metrics(MetricsInfo & mi, Dimension & dim) const;
27         ///
28         void draw(PainterInfo & pi, int x, int y) const;
29         ///
30         void metricsT(TextMetricsInfo const & mi, Dimension & dim) const;
31         ///
32         void drawT(TextPainter &, int x, int y) const;
33         ///
34         int width() const { return width_; }
35         ///
36         int kerning() const { return kerning_; }
37
38         ///
39         void write(WriteStream & os) const;
40         ///
41         void normalize(NormalStream & ns) const;
42         ///
43         void octave(OctaveStream & os) const;
44         ///
45         void mathmlize(MathStream & ms) const;
46         /// identifies Charinsets
47         InsetMathChar const * asCharInset() const { return this; }
48         ///
49         char_type getChar() const { return char_; }
50         ///
51         bool isRelOp() const;
52
53 private:
54         virtual std::auto_ptr<InsetBase> doClone() const;
55         /// the character
56         char_type char_;
57         /// cached width
58         mutable int width_;
59         /// cached kerning for superscript
60         mutable int kerning_;
61 };
62
63 } // namespace lyx
64
65 #endif