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