]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QLImage.h
fix tooltips in toolbar
[lyx.git] / src / frontends / qt2 / QLImage.h
1 // -*- C++ -*-
2 /**
3  * \file QLImage.h
4  * Copyright 2002 the LyX Team
5  * Read the file COPYING
6  *
7  * \author Angus Leeming, a.leeming@ic.ac.uk
8  * \author John Levon <moz@compsoc.man.ac.uk>
9  */
10
11 #ifndef QLIMAGE_H
12 #define QLIMAGE_H
13
14 #ifdef __GNUG__
15 #pragma interface
16 #endif
17
18 #include "graphics/GraphicsImage.h"
19  
20 #include <qpixmap.h>
21  
22 namespace grfx {
23
24 class QLImage : public Image
25 {
26 public:
27         /// Access to this class is through this static method.
28         static ImagePtr newImage();
29
30         /// Return the list of loadable formats.
31         static FormatList loadableFormats();
32
33         ~QLImage();
34
35         /// Create a copy
36         virtual Image * clone() const;
37
38         QPixmap const & qpixmap() const { return xformed_pixmap_; }
39
40         /// Get the image width
41         virtual unsigned int getWidth() const;
42
43         /// Get the image height
44         virtual unsigned int getHeight() const;
45
46         // FIXME 
47         virtual bool isDrawable() const { return true; } 
48  
49         /** 
50          * Load the image file into memory.
51          * The process is asynchronous, so this method starts the loading.
52          * When finished, the Image::finishedLoading signal is emitted.
53          */
54         virtual void load(string const & filename);
55
56         /**
57          * Generate the pixmap, based on the current state of
58          * image_ (clipped, rotated, scaled etc).
59          * Uses the params to decide on color, grayscale etc.
60          * Returns true if the pixmap is created.
61          */
62         virtual bool setPixmap(Params const & params);
63
64         /// Clip the image using params.
65         virtual void clip(Params const & params);
66
67         /// Rotate the image using params.
68         virtual void rotate(Params const & params);
69
70         /// Scale the image using params.
71         virtual void scale(Params const & params);
72
73 private:
74         /// Access to the class is through newImage() and clone.
75         QLImage();
76         ///
77         QLImage(QLImage const &);
78
79         /// the original loaded image
80         QPixmap pixmap_;
81
82         /// the transformed pixmap for display
83         QPixmap xformed_pixmap_;
84 };
85
86 } // namespace grfx
87
88 #endif // QLIMAGE_H