X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Frender_base.h;h=4aea45469824baed9111d9234950b178da082edf;hb=e28331ed63062dea10d0a21b9ec12034b4b17b9a;hp=e8a0468e0d5e093083715a53ea55a48b8897f6d8;hpb=c38370d1c3dc594b17c53c28582f8092a15901d9;p=lyx.git diff --git a/src/insets/render_base.h b/src/insets/render_base.h index e8a0468e0d..4aea454698 100644 --- a/src/insets/render_base.h +++ b/src/insets/render_base.h @@ -16,6 +16,10 @@ #include + +namespace lyx { + +class InsetBase; class MetricsInfo; class PainterInfo; @@ -28,12 +32,17 @@ class RenderBase { public: virtual ~RenderBase() {} - virtual std::auto_ptr clone() const = 0; + virtual std::auto_ptr clone(InsetBase const *) const = 0; - /// compute the size of the object returned in dim - virtual void metrics(MetricsInfo & mi, Dimension & dim) 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; /// draw inset and update (xo, yo)-cache virtual void draw(PainterInfo & pi, int x, int y) const = 0; + /// render state, exact meaning of state is render-specific + void setRenderState(int state) { state_ = state; } + /// get render state + int renderState() const { return state_; } /// equivalent to dynamic_cast virtual RenderButton * asButton() { return 0; } @@ -44,10 +53,15 @@ public: protected: RenderBase() {} RenderBase(RenderBase const &) {} - void operator=(RenderBase const &) {} + RenderBase & operator=(RenderBase const &) { return *this; } + /// render state. currently, render_button uses this to store mouse_hover_ + int state_; /// Cached mutable Dimension dim_; }; + +} // namespace lyx + #endif // NOT RENDER_BASE_H