]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathColor.h
Coding style
[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 #include "support/docstream.h"
18
19 namespace lyx {
20
21 /// Change colours.
22
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 private:
46         virtual Inset * clone() const;
47         /// width of '[' in current font
48         mutable int w_;
49         ///
50         bool oldstyle_;
51         /// Our color. Only valid LaTeX colors are allowed.
52         docstring color_;
53 };
54
55
56 } // namespace lyx
57
58 #endif