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