]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathColor.h
g-brief loads babel internally. So don't load it ourselves.
[lyx.git] / src / mathed / InsetMathColor.h
1 // -*- C++ -*-
2 /**
3  * \file InsetMathColor.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 "InsetMathNest.h"
16
17
18 namespace lyx {
19
20 /// Change colours.
21
22 class InsetMathColor : public InsetMathNest {
23 public:
24         /// Create a color inset from LyX color number
25         InsetMathColor(Buffer * buf, bool oldstyle, ColorCode color = Color_none);
26         /// Create a color inset from LaTeX color name
27         InsetMathColor(Buffer * buf, bool oldstyle, docstring const & color);
28         ///
29         void metrics(MetricsInfo & mi, Dimension & dim) const override;
30         /// we write extra braces in any case...
31         /// FIXME Why? Are they necessary if oldstyle_ == false?
32         bool extraBraces() const override { return true; }
33         ///
34         void draw(PainterInfo & pi, int x, int y) const override;
35         /// we need package color
36         void validate(LaTeXFeatures & features) const override;
37         /// we inherit the mode
38         mode_type currentMode() const override { return current_mode_; }
39         ///
40         void write(TeXMathStream & os) const override;
41         /// FIXME XHTML For now, we do nothing with color.
42         void mathmlize(MathMLStream &) const override {}
43         /// FIXME XHTML For now, we do nothing with color.
44         void htmlize(HtmlStream &) const override {}
45         ///
46         /// write normalized content
47         void normalize(NormalStream & ns) const override;
48         ///
49         void infoize(odocstream & os) const override;
50         ///
51         InsetCode lyxCode() const override { return MATH_COLOR_CODE; }
52 private:
53         Inset * clone() const override;
54         ///
55         bool oldstyle_;
56         /// Our color. Only valid LaTeX colors are allowed.
57         docstring color_;
58         /// the inherited mode
59         mutable mode_type current_mode_;
60 };
61
62
63 } // namespace lyx
64
65 #endif