]> git.lyx.org Git - lyx.git/blob - src/graphics/PreviewImage.h
dont use pragma impementation and interface anymore
[lyx.git] / src / graphics / PreviewImage.h
1 // -*- C++ -*-
2 /**
3  *  \file PreviewImage.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 PREVIEWIMAGE_H
13 #define PREVIEWIMAGE_H
14
15 #include "LString.h"
16 #include <boost/scoped_ptr.hpp>
17
18 class Inset;
19 class BufferView;
20
21 namespace grfx {
22
23 class PreviewLoader;
24 class Image;
25
26 class PreviewImage {
27 public:
28         /** ascent = height * ascent_frac
29          *  descent = height * (1 - ascent_frac)
30          */
31         PreviewImage(PreviewLoader & parent,
32                      string const & latex_snippet,
33                      string const & bitmap_file,
34                      double ascent_frac);
35         ///
36         ~PreviewImage();
37
38         ///
39         string const & snippet() const;
40         ///
41         int ascent() const;
42         ///
43         int descent() const;
44         ///
45         int width() const;
46
47         /** If the image is not yet loaded (WaitingToLoad), then this method
48          *  triggers that.
49          *  inset and bv are passed so we can choose to load only
50          *  those insets that are visible.
51          */
52         Image const * image(Inset const & inset, BufferView const & bv) const;
53
54 private:
55         /// Use the Pimpl idiom to hide the internals.
56         class Impl;
57         /// The pointer never changes although *pimpl_'s contents may.
58         boost::scoped_ptr<Impl> const pimpl_;
59 };
60
61 } // namespace grfx
62
63 #endif // PREVIEWIMAGE_H