Give inset codes to all the math insets, so we get more information when
[lyx.git] / src / mathed / InsetMathColor.h
blob19f1636b17b5bca4756dd9accb744f32ec89f434
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.
7 * \author André Pönitz
9 * Full author contact details are available in file CREDITS.
12 #ifndef MATH_COLORINSET_H
13 #define MATH_COLORINSET_H
15 #include "InsetMathNest.h"
17 #include "support/docstream.h"
19 namespace lyx {
21 /// Change colours.
23 class InsetMathColor : public InsetMathNest {
24 public:
25 /// Create a color inset from LyX color number
26 explicit InsetMathColor(bool oldstyle,
27 ColorCode color = Color_none);
28 /// Create a color inset from LaTeX color name
29 explicit InsetMathColor(bool oldstyle, docstring const & color);
30 ///
31 void metrics(MetricsInfo & mi, Dimension & dim) const;
32 /// we write extra braces in any case...
33 /// FIXME Why? Are they necessary if oldstyle_ == false?
34 bool extraBraces() const { return true; }
35 ///
36 void draw(PainterInfo & pi, int x, int y) const;
37 /// we need package color
38 void validate(LaTeXFeatures & features) const;
39 ///
40 void write(WriteStream & os) const;
41 /// write normalized content
42 void normalize(NormalStream & ns) const;
43 ///
44 void infoize(odocstream & os) const;
45 ///
46 InsetCode lyxCode() const { return MATH_COLOR_CODE; }
47 private:
48 virtual Inset * clone() const;
49 /// width of '[' in current font
50 mutable int w_;
51 ///
52 bool oldstyle_;
53 /// Our color. Only valid LaTeX colors are allowed.
54 docstring color_;
58 } // namespace lyx
60 #endif