]> git.lyx.org Git - lyx.git/blobdiff - src/insets/render_base.h
The speed patch: redraw only rows that have changed
[lyx.git] / src / insets / render_base.h
index 2fbb97775a49c09dab4161aaa977e42bbc21e970..ba9221fbf70830cd9023afeb45692d7d8b62a3b4 100644 (file)
 
 #include "dimension.h"
 
-#include <boost/weak_ptr.hpp>
+#include <memory>
 
-class BufferView;
+class InsetBase;
 class MetricsInfo;
 class PainterInfo;
 
+class RenderButton;
+class RenderGraphic;
+class RenderPreview;
+class RenderMonitoredPreview;
 
 class RenderBase {
 public:
        virtual ~RenderBase() {}
 
-       virtual RenderBase * clone() const = 0;
+       virtual std::auto_ptr<RenderBase> clone(InsetBase const *) const = 0;
 
        /// compute the size of the object returned in dim
        virtual void metrics(MetricsInfo & mi, Dimension & dim) const = 0;
        /// draw inset and update (xo, yo)-cache
        virtual void draw(PainterInfo & pi, int x, int y) const = 0;
 
-       /// An accessor function to the cached store.
-       BufferView * view() const;
+       /// equivalent to dynamic_cast
+       virtual RenderButton * asButton() { return 0; }
+       virtual RenderGraphic * asGraphic() { return 0; }
+       virtual RenderPreview * asPreview() { return 0; }
+       virtual RenderMonitoredPreview * asMonitoredPreview() { return 0; }
 
 protected:
        RenderBase() {}
        RenderBase(RenderBase const &) {}
-       void operator=(RenderBase const &) {}
+       RenderBase & operator=(RenderBase const &) { return *this; }
 
-       /// These are cached variables (are not copied).
-       mutable boost::weak_ptr<BufferView> view_;
+       /// Cached
        mutable Dimension dim_;
 };