]> git.lyx.org Git - lyx.git/blob - src/mathed/math_charinset.h
Make Helge happy: no more crash on arrow up/down in math macro
[lyx.git] / src / mathed / math_charinset.h
1 // -*- C++ -*-
2 /**
3  * \file math_charinset.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 "math_inset.h"
16
17
18 /// The base character inset.
19 class MathCharInset : public MathInset {
20 public:
21         ///
22         explicit MathCharInset(char c);
23         ///
24         void metrics(MetricsInfo & mi, Dimension & dim) const;
25         ///
26         void draw(PainterInfo & pi, int x, int y) const;
27         ///
28         void metricsT(TextMetricsInfo const & mi, Dimension & dim) const;
29         ///
30         void drawT(TextPainter &, int x, int y) const;
31         ///
32         int width() const { return width_; }
33
34         ///
35         void write(WriteStream & os) const;
36         ///
37         void normalize(NormalStream & ns) const;
38         ///
39         void octave(OctaveStream & os) const;
40         /// identifies Charinsets
41         MathCharInset const * asCharInset() const { return this; }
42         ///
43         char getChar() const { return char_; }
44         ///
45         bool isRelOp() const;
46
47 private:
48         virtual std::auto_ptr<InsetBase> doClone() const;
49         /// the character
50         char char_;
51         /// cached width
52         mutable int width_;
53 };
54 #endif