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