]> git.lyx.org Git - lyx.git/blob - src/mathed/math_colorinset.h
Fix to bug 2362: Deleting superscript also deletes subscript.
[lyx.git] / src / mathed / math_colorinset.h
1 // -*- C++ -*-
2 /**
3  * \file math_colorinset.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_COLORINSET_H
13 #define MATH_COLORINSET_H
14
15 #include "LColor.h"
16
17 #include "math_nestinset.h"
18
19 /// Change colours.
20
21 class MathColorInset : public MathNestInset {
22 public:
23         /// Create a color inset from LyX color number
24         explicit MathColorInset(bool oldstyle,
25                 LColor_color const & color = LColor::none);
26         /// Create a color inset from LaTeX color name
27         explicit MathColorInset(bool oldstyle, std::string const & color);
28         ///
29         void metrics(MetricsInfo & mi, Dimension & dim) const;
30         /// we write extra braces in any case...
31         /// FIXME Why? Are they necessary if oldstyle_ == false?
32         bool extraBraces() const { return true; }
33         ///
34         void draw(PainterInfo & pi, int x, int y) const;
35         /// we need package color
36         void validate(LaTeXFeatures & features) const;
37         ///
38         void write(WriteStream & os) const;
39         /// write normalized content
40         void normalize(NormalStream & ns) const;
41         ///
42         void infoize(std::ostream & os) const;
43 private:
44         virtual std::auto_ptr<InsetBase> doClone() const;
45         /// width of '[' in current font
46         mutable int w_;
47         ///
48         bool oldstyle_;
49         /// Our color. Only valid LaTeX colors are allowed.
50         std::string color_;
51 };
52
53 #endif