]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_colorinset.h
Andreas' patch to prevent crash on click on previewd inset
[lyx.git] / src / mathed / math_colorinset.h
index 3f16f4e6d43e36508d1ff5c6c7d9da15ec7adfdf..6eec693f4f90c4ad36ffbfb60711b6107946fc76 100644 (file)
 #ifndef MATH_COLORINSET_H
 #define MATH_COLORINSET_H
 
+#include "LColor.h"
+
 #include "math_nestinset.h"
 
 /// Change colours.
 
 class MathColorInset : public MathNestInset {
 public:
-       ///
-       explicit MathColorInset(bool oldstyle);
-       ///
-       std::auto_ptr<InsetBase> clone() const;
+       /// Create a color inset from LyX color number
+       explicit MathColorInset(bool oldstyle,
+               LColor_color const & color = LColor::none);
+       /// Create a color inset from LaTeX color name
+       explicit MathColorInset(bool oldstyle, std::string const & color);
        ///
        void metrics(MetricsInfo & mi, Dimension & dim) const;
        /// we write extra braces in any case...
+       /// FIXME Why? Are they necessary if oldstyle_ == false?
        bool extraBraces() const { return true; }
        ///
        void draw(PainterInfo & pi, int x, int y) const;
@@ -37,10 +41,13 @@ public:
        ///
        void infoize(std::ostream & os) const;
 private:
+       virtual std::auto_ptr<InsetBase> doClone() const;
        /// width of '[' in current font
        mutable int w_;
        ///
        bool oldstyle_;
+       /// Our color. Only valid LaTeX colors are allowed.
+       std::string color_;
 };
 
 #endif