]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QLImage.h
Minipage is no more (long live the box inset)
[lyx.git] / src / frontends / qt2 / QLImage.h
1 // -*- C++ -*-
2 /**
3  * \file QLImage.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  * \author John Levon
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef QLIMAGE_H
14 #define QLIMAGE_H
15
16
17 #include "graphics/GraphicsImage.h"
18
19 #include <qpixmap.h>
20
21 namespace lyx {
22 namespace graphics {
23
24 class QLImage : public Image {
25 public:
26         /// Access to this class is through this static method.
27         static ImagePtr newImage();
28
29         /// Return the list of loadable formats.
30         static FormatList loadableFormats();
31
32         ~QLImage();
33         QPixmap const & qpixmap() const { return xformed_pixmap_; }
34
35 private:
36         /// Create a copy
37         virtual Image * clone_impl() const;
38         /// Get the image width
39         virtual unsigned int getWidth_impl() const;
40         /// Get the image height
41         virtual unsigned int getHeight_impl() const;
42         // FIXME Is the image drawable ?
43         virtual bool isDrawable_impl() const { return true; }
44         /**
45          * Load the image file into memory.
46          * The process is asynchronous, so this method starts the loading.
47          * When finished, the Image::finishedLoading signal is emitted.
48          */
49         virtual void load_impl(std::string const & filename);
50         /**
51          * Generate the pixmap, based on the current state of
52          * image_ (clipped, rotated, scaled etc).
53          * Uses the params to decide on color, grayscale etc.
54          * Returns true if the pixmap is created.
55          */
56         virtual bool setPixmap_impl(Params const & params);
57         /// Clip the image using params.
58         virtual void clip_impl(Params const & params);
59         /// Rotate the image using params.
60         virtual void rotate_impl(Params const & params);
61         /// Scale the image using params.
62         virtual void scale_impl(Params const & params);
63
64         /// Access to the class is through newImage() and clone.
65         QLImage();
66         ///
67         QLImage(QLImage const &);
68
69         /// the original loaded image
70         QPixmap pixmap_;
71
72         /// the transformed pixmap for display
73         QPixmap xformed_pixmap_;
74 };
75
76 } // namespace graphics
77 } // namespace lyx
78
79 #endif // QLIMAGE_H