]> git.lyx.org Git - lyx.git/blob - src/insets/render_base.h
2fbb97775a49c09dab4161aaa977e42bbc21e970
[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 <boost/weak_ptr.hpp>
18
19 class BufferView;
20 class MetricsInfo;
21 class PainterInfo;
22
23
24 class RenderBase {
25 public:
26         virtual ~RenderBase() {}
27
28         virtual RenderBase * clone() const = 0;
29
30         /// compute the size of the object returned in dim
31         virtual void metrics(MetricsInfo & mi, Dimension & dim) const = 0;
32         /// draw inset and update (xo, yo)-cache
33         virtual void draw(PainterInfo & pi, int x, int y) const = 0;
34
35         /// An accessor function to the cached store.
36         BufferView * view() const;
37
38 protected:
39         RenderBase() {}
40         RenderBase(RenderBase const &) {}
41         void operator=(RenderBase const &) {}
42
43         /// These are cached variables (are not copied).
44         mutable boost::weak_ptr<BufferView> view_;
45         mutable Dimension dim_;
46 };
47
48 #endif // NOT RENDER_BASE_H