4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Angus Leeming
9 * Full author contact details are available in file CREDITS.
15 #include "Dimension.h"
27 class RenderMonitoredPreview;
31 virtual ~RenderBase() {}
33 virtual RenderBase * clone(Inset const *) const = 0;
35 /// compute the size of the object returned in dim.
36 /// \retval true if the metrics has changed.
37 virtual void metrics(MetricsInfo & mi, Dimension & dim) const = 0;
38 /// draw inset and update (xo, yo)-cache
39 virtual void draw(PainterInfo & pi, int x, int y, bool const darkmode = false) const = 0;
41 /// render state, exact meaning of state is render-specific
42 void setRenderState(bool state) { state_ = state; }
44 bool renderState() const { return state_; }
46 /// equivalent to dynamic_cast
47 virtual RenderButton * asButton() { return 0; }
48 virtual RenderGraphic * asGraphic() { return 0; }
49 virtual RenderPreview * asPreview() { return 0; }
50 virtual RenderMonitoredPreview * asMonitoredPreview() { return 0; }
53 RenderBase() : state_(false) {}
54 RenderBase(RenderBase const & x) : state_(x.state_) {}
55 RenderBase & operator=(RenderBase const &) { return *this; }
57 /// render state. currently, render_button uses this to store mouse_hover_
60 mutable Dimension dim_;
66 #endif // NOT RENDERBASE_H