]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/xformsGImage.h
(John): translate dialog titles.
[lyx.git] / src / frontends / xforms / xformsGImage.h
1 // -*- C++ -*-
2 /**
3  *  \file xformsGImage.h
4  *  Copyright 2002 the LyX Team
5  *  Read the file COPYING
6  *
7  *  \author Angus Leeming, a.leeming@ic.ac.uk
8  */
9
10 /* An instantiation of GImage that makes use of the xforms lirary routines
11  * to load and store the image in memory.
12  */
13
14 #ifndef XFORMS_GRAPHICSIMAGE_H
15 #define XFORMS_GRAPHICSIMAGE_H
16
17 #ifdef __GNUG__
18 #pragma interface
19 #endif
20
21 #include "graphics/GraphicsImage.h"
22 #include FORMS_H_LOCATION
23
24 namespace grfx {
25
26 class xformsGImage : public GImage
27 {
28 public:
29         /// Access to this class is through this static method.
30         static ImagePtr newImage();
31
32         /// Return the list of loadable formats.
33         static FormatList loadableFormats();
34
35         ///
36         ~xformsGImage();
37
38         /// Create a copy
39         GImage * clone() const;
40
41         ///
42         Pixmap getPixmap() const;
43
44         /// Get the image width
45         unsigned int getWidth() const;
46
47         /// Get the image height
48         unsigned int getHeight() const;
49
50         /** Load the image file into memory.
51          *  The process is asynchronous, so this method starts the loading
52          *  and saves the signal. It is emitted once loading is finished.
53          */
54         void load(string const & filename, SignalTypePtr);
55
56         /** Generate the pixmap, based on the current state of
57          *  image_ (clipped, rotated, scaled etc).
58          *  Uses the params to decide on color, grayscale etc.
59          *  Returns true if the pixmap is created.
60          */
61         bool setPixmap(GParams const & params);
62
63         /// Clip the image using params.
64         void clip(GParams const & params);
65
66         /// Rotate the image using params.
67         void rotate(GParams const & params);
68
69         /// Scale the image using params.
70         void scale(GParams const & params);
71
72         /// Internal callbacks.
73         void statusCB(string const &);
74         ///
75         void errorCB(string const &);
76
77 private:
78         /// Access to the class is through newImage() and clone.
79         xformsGImage();
80         ///
81         xformsGImage(xformsGImage const &);
82
83         /// The xforms container.
84         FL_IMAGE * image_;
85
86         /// The pixmap itself.
87         Pixmap pixmap_;
88
89         /// Is the pixmap initialized?
90         enum PixmapStatus {
91                 ///
92                 PIXMAP_UNINITIALISED,
93                 ///
94                 PIXMAP_FAILED,
95                 ///
96                 PIXMAP_SUCCESS
97         };
98
99         PixmapStatus pixmap_status_;
100
101         /// Emit this signal when the loading process is finished.
102         GImage::SignalTypePtr on_finish_;
103 };
104
105 } // namespace grfx
106
107 #endif // XFORMS_GRAPHICSIMAGE_H