2 /* This file is part of
3 * =================================================
5 * LyX, The Document Processor
6 * Copyright 1995 Matthias Ettrich.
7 * Copyright 1995-2001 The LyX Team.
9 * This file Copyright 2000 Baruch Even
10 * ================================================= */
12 #ifndef GRAPHICSCACHEITEM_H
13 #define GRAPHICSCACHEITEM_H
19 #include XPM_H_LOCATION
22 #include <boost/utility.hpp>
23 #include <boost/smart_ptr.hpp>
25 #include <sigc++/signal_system.h>
29 /// A GraphicsCache item holder.
30 class GraphicsCacheItem : boost::noncopyable {
33 GraphicsCacheItem(string const & filename);
34 /// d-tor, frees the image structures.
37 /// Return a pixmap that can be displayed on X server.
38 LyXImage * getImage() const;
53 /// Is the pixmap ready for display?
54 ImageStatus getImageStatus() const;
56 /** Get a notification when the image conversion is done.
57 used by an internal callback mechanism.
59 void imageConverted(bool success);
62 /** Start image conversion process, checks first that it is necessary
63 * if necessary will start an (a)synchronous task and notify upon
64 * completion by calling imageConverted(bool) where true is for success
65 * and false is for a failure.
67 * Returns a bool to denote success or failure of starting the conversion
70 bool convertImage(string const & filename);
72 /// Load the image into memory, this gets called from imageConverted(bool).
75 /// Sets the status of the image, in the future will also notify listeners
76 /// that the status is updated.
77 void setStatus(ImageStatus new_status);
79 /** The filename we refer too.
80 This is used when removing ourselves from the cache.
83 /// The temporary file that we use
86 ImageStatus imageStatus_;
87 /// The image (if it got loaded)
88 boost::scoped_ptr<LyXImage> image_;