]> git.lyx.org Git - lyx.git/blob - src/insets/render_base.h
setFont rework + some code simplification
[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 MetricsInfo;
20 class PainterInfo;
21
22 class RenderButton;
23 class RenderGraphic;
24 class RenderPreview;
25 class RenderMonitoredPreview;
26
27 class RenderBase {
28 public:
29         virtual ~RenderBase() {}
30
31         virtual std::auto_ptr<RenderBase> clone() const = 0;
32
33         /// compute the size of the object returned in dim
34         virtual void metrics(MetricsInfo & mi, Dimension & dim) const = 0;
35         /// draw inset and update (xo, yo)-cache
36         virtual void draw(PainterInfo & pi, int x, int y) const = 0;
37
38         /// equivalent to dynamic_cast
39         virtual RenderButton * asButton() { return 0; }
40         virtual RenderGraphic * asGraphic() { return 0; }
41         virtual RenderPreview * asPreview() { return 0; }
42         virtual RenderMonitoredPreview * asMonitoredPreview() { return 0; }
43
44 protected:
45         RenderBase() {}
46         RenderBase(RenderBase const &) {}
47         void operator=(RenderBase const &) {}
48
49         /// Cached
50         mutable Dimension dim_;
51 };
52
53 #endif // NOT RENDER_BASE_H