]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_boxinset.h
macro rework
[lyx.git] / src / mathed / math_boxinset.h
index 52054662a6c9794c1f0e63d3d10551845dfffde3..c155a76301cd3d4a0294dd8af8d69777cb133c44 100644 (file)
 // -*- C++ -*-
+/**
+ * \file math_boxinset.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author André Pönitz
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
 #ifndef MATH_BOXINSET_H
 #define MATH_BOXINSET_H
 
-#include "math_gridinset.h"
-#include "LString.h"
-
-#ifdef __GNUG__
-#pragma interface
-#endif
-
-class LyXFont;
-
-// Try to implement the reference inset "natively" for mathed.
-// This is here temporarily until I can do cvs add again.
-
-class ButtonInset: public MathNestInset {
-public:
-       ///
-       ButtonInset();
-       ///
-       void metrics(MathMetricsInfo & mi) const;
-       ///
-       void draw(MathPainterInfo & pi, int x, int y) const;
-
-protected:
-       /// This should provide the text for the button
-       virtual string screenLabel() const = 0;
-};
-
-
-// for things like \name[options]{contents}
-class CommandInset : public ButtonInset {
-public:
-       /// name, contents, options deliminited by '|++|'
-       explicit CommandInset(string const & data);
-       ///
-       MathInset * clone() const;
-       ///
-       void write(WriteStream & os) const;
-       ///
-       //void infoize(std::ostream & os) const;
-       ///
-       //int dispatch(string const & cmd, idx_type idx, pos_type pos);
-       ///
-       string screenLabel() const;
-public:
-       string name_;
-};
-
-
-// for \ref 
-class RefInset : public CommandInset {
-public:
-       ///
-       RefInset();
-       ///
-       explicit RefInset(string const & data);
-       ///
-       MathInset * clone() const;
-       ///
-       //void write(WriteStream & os) const;
-       ///
-       void infoize(std::ostream & os) const;
-       ///
-       int dispatch(string const & cmd, idx_type idx, pos_type pos);
-       ///
-       string screenLabel() const;
-       ///
-       void validate(LaTeXFeatures & features) const;
-
-       /// plain ascii output
-       int ascii(std::ostream & os, int) const;
-       /// linuxdoc output
-       int linuxdoc(std::ostream & os) const;
-       /// docbook output
-       int docbook(std::ostream & os, bool) const;
+#include "math_nestinset.h"
 
+#include <string>
 
-       struct type_info {
-               ///
-               string latex_name;
-               ///
-               string gui_name;
-               ///
-               string short_gui_name;
-       };
-       static type_info types[];
-       ///
-       static int getType(string const & name);
-       ///
-       static string const & getName(int type);
-};
 
+class LyXFont;
 
 /// Support for \\mbox
 
-class MathBoxInset : public MathGridInset {
+class MathBoxInset : public MathNestInset {
 public:
        ///
-       explicit MathBoxInset(string const & name);
+       explicit MathBoxInset(std::string const & name);
        ///
-       MathInset * clone() const;
+       virtual std::auto_ptr<InsetBase> clone() const;
        ///
-       void metrics(MathMetricsInfo & mi) const;
+       mode_type currentMode() const { return TEXT_MODE; }
        ///
-       void draw(MathPainterInfo & pi, int x, int y) const;
-       /// identifies BoxInsets
-       MathBoxInset * asBoxInset() { return this; }
-       /// identifies BoxInsets
-       MathBoxInset const * asBoxInset() const { return this; }
+       void metrics(MetricsInfo & mi, Dimension & dim) const;
        ///
-       void rebreak();
+       void draw(PainterInfo & pi, int x, int y) const;
        ///
        void write(WriteStream & os) const;
        ///
        void normalize(NormalStream & ns) const;
+       ///
+       void infoize(std::ostream & os) const;
 
 private:
        ///
-       mutable MathMetricsInfo mi_;
-       ///
-       string name_;
+       std::string name_;
 };