]> git.lyx.org Git - lyx.git/blob - src/insets/render_graphic.h
ws changes only
[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 private:
48         /// Not implemented.
49         RenderGraphic & operator=(RenderGraphic const &);
50
51         /// The message to display instead of the graphic itself.
52         std::string const statusMessage() const;
53
54         /// Is the image ready to draw, or should we display a message instead?
55         bool readyToDisplay() const;
56
57         /// The stored data.
58         lyx::graphics::Loader loader_;
59         lyx::graphics::Params params_;
60
61         /// Cached variable (not copied).
62         mutable unsigned long checksum_;
63 };
64
65
66 #endif // NOT RENDER_GRAPHIC_H