]> git.lyx.org Git - lyx.git/blob - src/graphics/GraphicsCacheItem_pimpl.h
Cleaned up cruft in InsetGraphics.
[lyx.git] / src / graphics / GraphicsCacheItem_pimpl.h
1 // -*- C++ -*-
2 /* This file is part of
3  * =================================================
4  * 
5  *          LyX, The Document Processor
6  *          Copyright 1995 Matthias Ettrich.
7  *          Copyright 1995-2000 The LyX Team.
8  *
9  *          This file Copyright 2000 Baruch Even
10  * ================================================= */
11
12 #ifndef GRAPHICSCACHEITEM_PIMPL_H
13 #define GRAPHICSCACHEITEM_PIMPL_H
14
15 #include <config.h>
16
17 #ifdef __GNUG__
18 #pragma interface
19 #endif
20
21 #include "graphics/GraphicsCacheItem.h"
22
23 #include XPM_H_LOCATION
24 #include "LString.h"
25 #include "graphics/ImageLoader.h"
26 #include "support/syscall.h"
27
28 #include "sigc++/signal_system.h"
29 #ifdef SIGC_CXX_NAMESPACES
30 using SigC::Signal0;
31 #endif
32
33 class LyXImage;
34
35 /// A GraphicsCache item holder.
36 class GraphicsCacheItem_pimpl {
37 public:
38         /// d-tor, frees the image structures.
39         ~GraphicsCacheItem_pimpl();
40         
41         /// Return a pixmap that can be displayed on X server.
42         LyXImage * getImage() const { return image_; };
43
44         typedef GraphicsCacheItem::ImageStatus ImageStatus;
45         
46         /// Is the pixmap ready for display?
47         ImageStatus getImageStatus() const; 
48
49         /** Get a notification when the image conversion is done.
50             used by an internal callback mechanism. */
51         void imageConverted(int retval);
52
53 private:
54         /// Private c-tor so that only GraphicsCache can create an instance.
55         GraphicsCacheItem_pimpl();
56
57         /// Set the filename this item will be pointing too.
58         bool setFilename(string const & filename);
59
60         /// Create an XPM file version of the image.
61         bool renderXPM(string const & filename);
62
63         /// Load the image from XPM to memory Pixmap
64         void loadXPMImage();
65         
66         ///
67         friend class GraphicsCacheItem;
68
69         /// The file name of the XPM file.
70         string xpmfile;
71         /// Is the pixmap loaded?
72         ImageStatus imageStatus_;
73         /// The image pixmap
74         LyXImage * image_;
75         /// The rendering object.
76         ImageLoader * imageLoader;
77
78         /// The system caller, runs the convertor.
79         Systemcalls syscall;
80
81         /// The reference count
82         int refCount;
83 };
84
85 #endif