]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/xformsImage.h
Change glob() API to accept a dir parameter.
[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 #include "graphics/GraphicsImage.h"
20
21 #include <X11/X.h>
22
23 struct flimage_;
24 typedef flimage_ FL_IMAGE;
25
26 namespace lyx {
27 namespace graphics {
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         Pixmap getPixmap() const;
42
43         /// Internal callbacks.
44         void statusCB(std::string const &);
45         void errorCB(std::string const &);
46
47 private:
48         /// Create a copy
49         virtual Image * clone_impl() const;
50         /// Get the image width
51         virtual unsigned int getWidth_impl() const;
52         /// Get the image height
53         virtual unsigned int getHeight_impl() const;
54         /// Is the image drawable ?
55         virtual bool isDrawable_impl() const;
56         /** Load the image file into memory.
57          *  The process is asynchronous, so this method starts the loading.
58          *  When finished, the Image::finishedLoading signal is emitted.
59          */
60         virtual void load_impl(std::string const & filename);
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_impl(Params const & params);
67         /// Clip the image using params.
68         virtual void clip_impl(Params const & params);
69
70         /// Rotate the image using params.
71         virtual void rotate_impl(Params const & params);
72
73         /// Scale the image using params.
74         virtual void scale_impl(Params const & params);
75
76         /// Access to the class is through newImage() and clone.
77         xformsImage();
78         ///
79         xformsImage(xformsImage const &);
80
81         /// The xforms container.
82         FL_IMAGE * image_;
83
84         /// The pixmap itself.
85         Pixmap pixmap_;
86
87         /// Is the pixmap initialized?
88         enum PixmapStatus {
89                 ///
90                 PIXMAP_UNINITIALISED,
91                 ///
92                 PIXMAP_FAILED,
93                 ///
94                 PIXMAP_SUCCESS
95         };
96
97         PixmapStatus pixmap_status_;
98 };
99
100 } // namespace graphics
101 } // namespace lyx
102
103 #endif // XFORMSIMAGE_H