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.
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>
33 virtual ~RenderInset();
35 virtual RenderInset * clone() const = 0;
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;
42 /// An accessor function to the cached store.
43 BufferView * view() const;
47 RenderInset(RenderInset const &);
48 RenderInset & operator=(RenderInset const &);
50 /// These are cached variables (are not copied).
51 mutable boost::weak_ptr<BufferView> view_;
52 mutable Dimension dim_;
56 class ButtonRenderer : public RenderInset
61 virtual RenderInset * clone() const;
63 /// This should provide the text for the button
64 void update(string const &, bool editable);
66 /// compute the size of the object returned in dim
67 virtual void metrics(MetricsInfo & mi, Dimension & dim) const;
68 /// draw inset and update (xo, yo)-cache
69 virtual void draw(PainterInfo & pi, int x, int y) const;
78 class GraphicRenderer : public RenderInset
82 GraphicRenderer(GraphicRenderer const &);
84 virtual RenderInset * clone() const;
86 /// Refresh the info about which file to display and how to display it.
87 void update(lyx::graphics::Params const & params);
89 /// compute the size of the object returned in dim
90 virtual void metrics(MetricsInfo & mi, Dimension & dim) const;
91 /// draw inset and update (xo, yo)-cache
92 virtual void draw(PainterInfo & pi, int x, int y) const;
94 /// Is the stored checksum different to that of the graphics loader?
95 bool hasFileChanged() const;
97 /** Connect and you'll be informed when the loading status of the image
100 typedef boost::signal0<void>::slot_type slot_type;
101 virtual boost::signals::connection connect(slot_type const &) const;
105 GraphicRenderer & operator=(GraphicRenderer const &);
107 /// The message to display instead of the graphic itself.
108 string const statusMessage() const;
110 /// Is the image ready to draw, or should we display a message instead?
111 bool readyToDisplay() const;
114 lyx::graphics::Loader loader_;
115 lyx::graphics::Params params_;
117 /// Cached variable (not copied).
118 mutable unsigned long checksum_;
122 #endif // NOT RENDERERS_H