3 * \file GraphicsCacheItem.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
8 * \author Angus Leeming
10 * Full author contact details are available in file CREDITS.
12 * The graphics cache is a container of graphics::CacheItems.
13 * Each graphics::CacheItem, defined here represents a separate image file.
15 * The routines here can be used to load the graphics file into memory at
16 * which point (status() == graphics::Loaded).
17 * The user is then free to access image() in order to copy it and to then
18 * transform the copy (rotate, scale, clip) and to generate the pixmap.
20 * The graphics cache supports fully asynchronous:
21 * file conversion to a loadable format;
24 * Whether you get that, of course, depends on graphics::Converter and
25 * on the graphics::Image-derived image class.
28 #ifndef GRAPHICSCACHEITEM_H
29 #define GRAPHICSCACHEITEM_H
31 #include "GraphicsTypes.h"
33 #include "support/signals.h"
38 namespace support { class FileName; }
44 /// A graphics::Cache item holder.
48 CacheItem(support::FileName const & file, support::FileName const & doc_file);
49 /// Needed for the pimpl
53 support::FileName const & filename() const;
55 /// Try to load a display format.
56 bool tryDisplayFormat() const;
58 /// It's in the cache. Now start the loading process.
59 void startLoading() const;
61 /** Monitor any changes to the file.
62 * There is no point monitoring the file before startLoading() is
65 void startMonitoring() const;
67 bool monitoring() const;
68 /// perform a modification check asynchronously
69 void checkModifiedAsync() const;
71 /** Get the image associated with filename().
72 * If the image is not yet loaded, returns 0.
73 * This routine returns a pointer to const; if you want to modify it,
74 * create a copy and modify that.
76 Image const * image() const;
78 /// How far have we got in loading the image?
79 ImageStatus status() const;
81 /** Connect and you'll be informed when the loading status of the image
84 typedef signal<void()>::slot_type slot_type;
86 connection connect(slot_type const &) const;
90 CacheItem(CacheItem const &);
91 void operator=(CacheItem const &);
93 /// Use the Pimpl idiom to hide the internals.
95 /// The pointer never changes although *pimpl_'s contents may.
99 } // namespace graphics
102 #endif // GRAPHICSCACHEITEM_H