4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Angus Leeming
9 * Full author contact details are available in file CREDITS
12 #ifndef GRAPHICINSET_H
13 #define GRAPHICINSET_H
15 #include "dimension.h"
17 #include "graphics/GraphicsLoader.h"
18 #include "graphics/GraphicsParams.h"
19 #include "graphics/GraphicsTypes.h"
21 #include <boost/weak_ptr.hpp>
22 #include <boost/signals/signal0.hpp>
34 GraphicInset(GraphicInset const &);
36 /** Set the message that the inset will show when the
37 * display of the graphic is deactivated.
38 * The default is nothing, meaning that the inset will
39 * show a message descibing the state of the image
42 void setNoDisplayMessage(string const & msg);
44 /// Refresh the info about which file to display and how to display it.
45 void update(grfx::Params const & params);
46 /// File name, image size, rotation angle etc.
47 grfx::Params const & params() const;
49 /// compute the size of the object returned in dim
50 void metrics(MetricsInfo & mi, Dimension & dim) const;
51 /// draw inset and update (xo, yo)-cache
52 void draw(PainterInfo & pi, int x, int y) const;
54 /// Is the stored checksum different to that of the graphics loader?
55 bool hasFileChanged() const;
56 /// Set the cached store.
57 void view(BufferView *) const;
58 /// An accessor function to the cached store.
59 BufferView * view() const;
61 /** Connect and you'll be informed when the loading status of the image
64 typedef boost::signal0<void>::slot_type slot_type;
65 boost::signals::connection connect(slot_type const &) const;
67 /// The message to display instead of the graphic itself.
68 string const statusMessage() const;
77 /// Is the image ready to draw, or should we display a message instead?
78 DisplayType displayType() const;
83 string nodisplay_message_;
85 /// These are all cached variables.
86 mutable unsigned long checksum_;
87 mutable boost::weak_ptr<BufferView> view_;
88 mutable Dimension dim_;
92 #endif // NOT GRAPHICINSET_H