]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathBox.h
simplify GuiToc / TocWidget interaction. Much can still be simplified...
[lyx.git] / src / mathed / InsetMathBox.h
index 0bb2744d0a14a14c498d987454ababdb8f394fb3..9b40ba09519a76bcb2dcf9a9b26f875e76b70f81 100644 (file)
 
 namespace lyx {
 
-
-class LyXFont;
-
 /// Support for \\mbox
-
 class InsetMathBox : public InsetMathNest {
 public:
        ///
@@ -31,7 +27,7 @@ public:
        ///
        mode_type currentMode() const { return TEXT_MODE; }
        ///
-       bool metrics(MetricsInfo & mi, Dimension & dim) const;
+       void metrics(MetricsInfo & mi, Dimension & dim) const;
        ///
        void draw(PainterInfo & pi, int x, int y) const;
        ///
@@ -42,13 +38,105 @@ public:
        void infoize(odocstream & os) const;
 
 private:
-       virtual std::auto_ptr<InsetBase> doClone() const;
+       Inset * clone() const { return new InsetMathBox(*this); }
        ///
        docstring name_;
 };
 
 
+/// Non-AMS-style frame
+class InsetMathFBox : public InsetMathNest {
+public:
+       ///
+       InsetMathFBox();
+       ///
+       mode_type currentMode() const { return TEXT_MODE; }
+       ///
+       void metrics(MetricsInfo & mi, Dimension & dim) const;
+       ///
+       void draw(PainterInfo & pi, int x, int y) const;
+       ///
+       void write(WriteStream & os) const;
+       /// write normalized content
+       void normalize(NormalStream & ns) const;
+       ///
+       void infoize(odocstream & os) const;
+private:
+       ///
+       Inset * clone() const { return new InsetMathFBox(*this); }
+};
+
+
+/// Extra nesting
+class InsetMathFrameBox : public InsetMathNest {
+public:
+       ///
+       InsetMathFrameBox();
+       ///
+       void metrics(MetricsInfo & mi, Dimension & dim) const;
+       ///
+       void draw(PainterInfo & pi, int x, int y) const;
+       ///
+       void write(WriteStream & os) const;
+       /// write normalized content
+       void normalize(NormalStream & ns) const;
+       ///
+       mode_type currentMode() const { return TEXT_MODE; }
+private:
+       Inset * clone() const { return new InsetMathFrameBox(*this); }
+       /// width of '[' in current font
+       mutable int w_;
+};
+
+
+/// Extra nesting: \\makebox.
+// consolidate with InsetMathFrameBox?
+class InsetMathMakebox : public InsetMathNest {
+public:
+       ///
+       InsetMathMakebox();
+       ///
+       void metrics(MetricsInfo & mi, Dimension & dim) const;
+       ///
+       void draw(PainterInfo & pi, int x, int y) const;
+       ///
+       void write(WriteStream & os) const;
+       /// write normalized content
+       void normalize(NormalStream & ns) const;
+       ///
+       mode_type currentMode() const { return TEXT_MODE; }
+       ///
+       void infoize(odocstream & os) const;
+private:
+       Inset * clone() const { return new InsetMathMakebox(*this); }
+       /// width of '[' in current font
+       mutable int w_;
+};
+
+
+
+/// AMS-style frame
+class InsetMathBoxed : public InsetMathNest {
+public:
+       ///
+       InsetMathBoxed();
+       ///
+       void validate(LaTeXFeatures & features) const;
+       ///
+       void metrics(MetricsInfo & mi, Dimension & dim) const;
+       ///
+       void draw(PainterInfo & pi, int x, int y) const;
+       ///
+       void write(WriteStream & os) const;
+       /// write normalized content
+       void normalize(NormalStream & ns) const;
+       ///
+       void infoize(odocstream & os) const;
+private:
+       Inset * clone() const { return new InsetMathBoxed(*this); }
+};
+
 
 } // namespace lyx
 
-#endif
+#endif // MATH_MBOX