]> git.lyx.org Git - lyx.git/blob - src/insets/render_graphic.h
Get rid of hte dynamic_casts in InsetExternal.
[lyx.git] / src / insets / render_graphic.h
1 // -*- C++ -*-
2 /**
3  * \file render_graphic.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_GRAPHIC_H
13 #define RENDER_GRAPHIC_H
14
15 #include "render_base.h"
16
17 #include "graphics/GraphicsLoader.h"
18 #include "graphics/GraphicsParams.h"
19
20 #include <boost/signals/signal0.hpp>
21
22
23 class RenderGraphic : public RenderBase
24 {
25 public:
26         RenderGraphic();
27         RenderGraphic(RenderGraphic const &);
28         RenderBase * clone() const;
29
30         /// compute the size of the object returned in dim
31         void metrics(MetricsInfo & mi, Dimension & dim) const;
32         /// draw inset and update (xo, yo)-cache
33         void draw(PainterInfo & pi, int x, int y) const;
34
35         /// Refresh the info about which file to display and how to display it.
36         void update(lyx::graphics::Params const & params);
37
38         /// Is the stored checksum different to that of the graphics loader?
39         bool hasFileChanged() const;
40
41         /** Connect and you'll be informed when the loading status of the image
42          *  changes.
43          */
44         typedef boost::signal0<void>::slot_type slot_type;
45         boost::signals::connection connect(slot_type const &) const;
46
47         /// equivalent to dynamic_cast
48         virtual RenderGraphic * asGraphic() { return this; }
49
50 private:
51         /// Not implemented.
52         RenderGraphic & operator=(RenderGraphic const &);
53
54         /// The stored data.
55         lyx::graphics::Loader loader_;
56         lyx::graphics::Params params_;
57
58         /// Cached variable (not copied).
59         mutable unsigned long checksum_;
60 };
61
62
63 #endif // NOT RENDER_GRAPHIC_H