]> git.lyx.org Git - lyx.git/blob - src/graphics/PreviewImage.h
cb1cb71b3d830d8eec6055988b7416dc0a5befe5
[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
20 namespace grfx {
21
22 class PreviewLoader;
23 class Image;
24
25 class PreviewImage {
26 public:
27         /** ascent = height * ascent_frac
28          *  descent = height * (1 - ascent_frac)
29          */
30         PreviewImage(PreviewLoader & parent,
31                      string const & latex_snippet,
32                      string const & bitmap_file,
33                      double ascent_frac);
34         ///
35         ~PreviewImage();
36
37         ///
38         string const & snippet() const;
39         ///
40         int ascent() const;
41         ///
42         int descent() const;
43         ///
44         int width() const;
45
46         /** If the image is not yet loaded (WaitingToLoad), then this method
47          *  triggers that.
48          */
49         Image const * image() const;
50
51 private:
52         /// Use the Pimpl idiom to hide the internals.
53         class Impl;
54         /// The pointer never changes although *pimpl_'s contents may.
55         boost::scoped_ptr<Impl> const pimpl_;
56 };
57
58 } // namespace grfx
59
60 #endif // PREVIEWIMAGE_H