2 /* This file is part of
3 * =================================================
5 * LyX, The Document Processor
6 * Copyright 1995 Matthias Ettrich.
7 * Copyright 1995-2000 The LyX Team.
9 * This file Copyright 2000 Baruch Even
10 * ================================================= */
12 #ifndef GRAPHICSCACHEITEM_PIMPL_H
13 #define GRAPHICSCACHEITEM_PIMPL_H
21 #include "graphics/GraphicsCacheItem.h"
23 #include XPM_H_LOCATION
25 #include "graphics/Renderer.h"
26 #include "support/syscall.h"
28 #include "sigc++/signal_system.h"
29 #ifdef SIGC_CXX_NAMESPACES
33 /* (Baruch Even 2000-08-05)
34 * This has a major drawback: it is only designed for X servers, no easy
35 * porting to non X-server based platform is offered right now, this is done
36 * in order to get a first version out of the door.
38 * Later versions should consider how to do this with more platform
39 * independence, this will probably involve changing the Painter class too.
42 /// A GraphicsCache item holder.
43 class GraphicsCacheItem_pimpl {
45 /// d-tor, frees the image structures.
46 ~GraphicsCacheItem_pimpl();
48 /// Get the height of the image. Returns -1 on error.
49 int getHeight() const;
51 /// Get the width of the image. Returns -1 on error.
54 /// Return a pixmap that can be displayed on X server.
55 Pixmap getImage() const;
57 typedef GraphicsCacheItem::ImageStatus ImageStatus;
59 /// Is the pixmap ready for display?
60 ImageStatus getImageStatus() const;
62 /// Get a notification when the image conversion is done.
63 /// used by an internal callback mechanism.
64 void imageConverted(int retval);
67 /// Private c-tor so that only GraphicsCache can create an instance.
68 GraphicsCacheItem_pimpl();
70 /// Set the filename this item will be pointing too.
71 bool setFilename(string const & filename);
73 /// Create an XPM file version of the image.
74 bool renderXPM(string const & filename);
76 /// Load the image from XPM to memory Pixmap
80 friend class GraphicsCacheItem;
82 /// The file name of the XPM file.
88 /// Is the pixmap loaded?
89 ImageStatus imageStatus_;
92 /// The rendering object.
95 /// The system caller, runs the convertor.
98 /// The reference count