]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/xformsImage.h
remove defaults stuff, let Qt handle no toolbar
[lyx.git] / src / frontends / xforms / xformsImage.h
1 // -*- C++ -*-
2 /**
3  *  \file xformsImage.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 /* An instantiation of Image that makes use of the xforms lirary routines
13  * to load and store the image in memory.
14  */
15
16 #ifndef XFORMSIMAGE_H
17 #define XFORMSIMAGE_H
18
19
20 #include "graphics/GraphicsImage.h"
21
22 #include <X11/X.h>
23
24 struct flimage_;
25 typedef flimage_ FL_IMAGE;
26
27 namespace grfx {
28
29 class xformsImage : public Image
30 {
31 public:
32         /// Access to this class is through this static method.
33         static ImagePtr newImage();
34
35         /// Return the list of loadable formats.
36         static FormatList loadableFormats();
37
38         ///
39         ~xformsImage();
40
41         /// Create a copy
42         Image * clone() const;
43
44         ///
45         Pixmap getPixmap() const;
46
47         /// Get the image width
48         unsigned int getWidth() const;
49
50         /// Get the image height
51         unsigned int getHeight() const;
52
53         virtual bool isDrawable() const;
54
55         /** Load the image file into memory.
56          *  The process is asynchronous, so this method starts the loading.
57          *  When finished, the Image::finishedLoading signal is emitted.
58          */
59         void load(string const & filename);
60
61         /** Generate the pixmap, based on the current state of
62          *  image_ (clipped, rotated, scaled etc).
63          *  Uses the params to decide on color, grayscale etc.
64          *  Returns true if the pixmap is created.
65          */
66         bool setPixmap(Params const & params);
67
68         /// Clip the image using params.
69         void clip(Params const & params);
70
71         /// Rotate the image using params.
72         void rotate(Params const & params);
73
74         /// Scale the image using params.
75         void scale(Params const & params);
76
77         /// Internal callbacks.
78         void statusCB(string const &);
79         ///
80         void errorCB(string const &);
81
82 private:
83         /// Access to the class is through newImage() and clone.
84         xformsImage();
85         ///
86         xformsImage(xformsImage const &);
87
88         /// The xforms container.
89         FL_IMAGE * image_;
90
91         /// The pixmap itself.
92         Pixmap pixmap_;
93
94         /// Is the pixmap initialized?
95         enum PixmapStatus {
96                 ///
97                 PIXMAP_UNINITIALISED,
98                 ///
99                 PIXMAP_FAILED,
100                 ///
101                 PIXMAP_SUCCESS
102         };
103
104         PixmapStatus pixmap_status_;
105 };
106
107 } // namespace grfx
108
109 #endif // XFORMSIMAGE_H