]> git.lyx.org Git - lyx.git/blob - src/insets/render_base.h
The speed patch: redraw only rows that have changed
[lyx.git] / src / insets / render_base.h
1 // -*- C++ -*-
2 /**
3  * \file render_base.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Angus Leeming
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef RENDER_BASE_H
13 #define RENDER_BASE_H
14
15 #include "dimension.h"
16
17 #include <memory>
18
19 class InsetBase;
20 class MetricsInfo;
21 class PainterInfo;
22
23 class RenderButton;
24 class RenderGraphic;
25 class RenderPreview;
26 class RenderMonitoredPreview;
27
28 class RenderBase {
29 public:
30         virtual ~RenderBase() {}
31
32         virtual std::auto_ptr<RenderBase> clone(InsetBase const *) const = 0;
33
34         /// compute the size of the object returned in dim
35         virtual void metrics(MetricsInfo & mi, Dimension & dim) const = 0;
36         /// draw inset and update (xo, yo)-cache
37         virtual void draw(PainterInfo & pi, int x, int y) const = 0;
38
39         /// equivalent to dynamic_cast
40         virtual RenderButton * asButton() { return 0; }
41         virtual RenderGraphic * asGraphic() { return 0; }
42         virtual RenderPreview * asPreview() { return 0; }
43         virtual RenderMonitoredPreview * asMonitoredPreview() { return 0; }
44
45 protected:
46         RenderBase() {}
47         RenderBase(RenderBase const &) {}
48         RenderBase & operator=(RenderBase const &) { return *this; }
49
50         /// Cached
51         mutable Dimension dim_;
52 };
53
54 #endif // NOT RENDER_BASE_H