X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FRenderBase.h;h=3244f1542224af81fa6e09fb40803b8bf551b421;hb=9c4929ca406091267dafa40f5e083a27db046bf6;hp=d56a4ffc1216fb3fcfbbcef2fe2b7e8bde1cf264;hpb=897436efbb9bd641b61467d185a2dfae9839e575;p=lyx.git diff --git a/src/insets/RenderBase.h b/src/insets/RenderBase.h index d56a4ffc12..3244f15422 100644 --- a/src/insets/RenderBase.h +++ b/src/insets/RenderBase.h @@ -14,8 +14,6 @@ #include "Dimension.h" -#include - namespace lyx { @@ -32,17 +30,20 @@ class RenderBase { public: virtual ~RenderBase() {} - virtual std::auto_ptr clone(Inset const *) const = 0; + virtual RenderBase * clone(Inset const *) const = 0; /// compute the size of the object returned in dim. /// \retval true if the metrics has changed. - virtual bool metrics(MetricsInfo & mi, Dimension & dim) const = 0; + 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; + /// + Dimension const & dimension() const { return dim_; }; + /// render state, exact meaning of state is render-specific - void setRenderState(int state) { state_ = state; } + void setRenderState(bool state) { state_ = state; } /// get render state - int renderState() const { return state_; } + bool renderState() const { return state_; } /// equivalent to dynamic_cast virtual RenderButton * asButton() { return 0; } @@ -51,12 +52,12 @@ public: virtual RenderMonitoredPreview * asMonitoredPreview() { return 0; } protected: - RenderBase() {} - RenderBase(RenderBase const &) {} + RenderBase() : state_(false) {} + RenderBase(RenderBase const &x) : state_(x.state_){} RenderBase & operator=(RenderBase const &) { return *this; } /// render state. currently, render_button uses this to store mouse_hover_ - int state_; + bool state_; /// Cached mutable Dimension dim_; };