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