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
21 #include XPM_H_LOCATION
24 #include <boost/utility.hpp>
25 #include <boost/smart_ptr.hpp>
27 #include <sigc++/signal_system.h>
31 /// A GraphicsCache item holder.
32 class GraphicsCacheItem : boost::noncopyable {
35 GraphicsCacheItem(string const & filename);
36 /// d-tor, frees the image structures.
39 /// Return a pixmap that can be displayed on X server.
40 LyXImage * getImage() const;
55 /// Is the pixmap ready for display?
56 ImageStatus getImageStatus() const;
58 /** Get a notification when the image conversion is done.
59 used by an internal callback mechanism.
61 void imageConverted(bool success);
64 /** Start image conversion process, checks first that it is necessary
65 * if necessary will start an (a)synchronous task and notify upon
66 * completion by calling imageConverted(bool) where true is for success
67 * and false is for a failure.
69 * Returns a bool to denote success or failure of starting the conversion
72 bool convertImage(string const & filename);
74 /// Load the image into memory, this gets called from imageConverted(bool).
77 /// Sets the status of the image, in the future will also notify listeners
78 /// that the status is updated.
79 void setStatus(ImageStatus new_status);
81 /** The filename we refer too.
82 This is used when removing ourselves from the cache.
85 /// The temporary file that we use
88 ImageStatus imageStatus_;
89 /// The image (if it got loaded)
90 boost::scoped_ptr<LyXImage> image_;