X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FRenderBase.h;h=cc1973e45978aadf06041b7bcc82af04d73d6135;hb=667560114752e668fbd59123faf9d454da632fb0;hp=9657f48f5bd23e3490bc5bf6c39e31ecf606e0b8;hpb=00e305c9d9bd8b0ff54b6c58adb6192d5934ed60;p=lyx.git diff --git a/src/insets/RenderBase.h b/src/insets/RenderBase.h index 9657f48f5b..cc1973e459 100644 --- a/src/insets/RenderBase.h +++ b/src/insets/RenderBase.h @@ -14,12 +14,10 @@ #include "Dimension.h" -#include - namespace lyx { -class InsetBase; +class Inset; class MetricsInfo; class PainterInfo; @@ -32,17 +30,20 @@ class RenderBase { public: virtual ~RenderBase() {} - virtual std::auto_ptr clone(InsetBase 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_; };