803b2f53fbce2d15e15c77a722ded4ee61437d14
1 #ifndef __UI_DIALOG_IMAGE_H__
2 #define __UI_DIALOG_IMAGE_H__
3 /*
4 * A simple image display widget, using Inkscape's own rendering engine
5 *
6 * Authors:
7 * Bob Jamison
8 * Other dudes from The Inkscape Organization
9 *
10 * Copyright (C) 2004 The Inkscape Organization
11 *
12 * Released under GNU GPL, read the file 'COPYING' for more information
13 */
15 #include <glibmm/ustring.h>
16 #include <gtkmm/box.h>
19 class SPDocument;
21 namespace Inkscape
22 {
23 namespace UI
24 {
25 namespace Widget
26 {
29 /*#########################################################################
30 ### ImageIcon widget
31 #########################################################################*/
33 /**
34 * This class is evolved from the SVGPreview widget of the FileChooser
35 * This uses Inkscape's renderer to show images in a variety of formats,
36 * including SVG
37 */
38 class ImageIcon : public Gtk::VBox
39 {
40 public:
42 /**
43 * Constructor
44 */
45 ImageIcon();
47 /**
48 * Construct from a file name
49 */
50 ImageIcon(const Glib::ustring &fileName);
52 /**
53 * Copy Constructor
54 */
55 ImageIcon(const ImageIcon &other);
57 /**
58 * Destructor
59 */
60 ~ImageIcon();
62 /**
63 *
64 */
65 bool showSvgDocument(const SPDocument *doc);
67 /**
68 *
69 */
70 bool showSvgFile(const Glib::ustring &fileName);
72 /**
73 *
74 */
75 bool showSvgFromMemory(const char *xmlBuffer);
77 /**
78 * Show image embedded in SVG
79 */
80 bool showBitmap(const Glib::ustring &fileName);
82 /**
83 * Show the "Too large" image
84 */
85 void showBrokenImage(const Glib::ustring &reason);
87 /**
88 *
89 */
90 bool show(const Glib::ustring &fileName);
92 private:
94 /**
95 * basic initialization, called by the various constructors
96 */
97 void init();
99 /**
100 * The svg document we are currently showing
101 */
102 SPDocument *document;
104 /**
105 * The sp_svg_view widget
106 */
107 Gtk::Widget *viewerGtkmm;
109 /**
110 * are we currently showing the "broken image" image?
111 */
112 bool showingBrokenImage;
115 /**
116 * will be set by showImageIcon as a side-effect of an error
117 */
118 Glib::ustring bitmapError;
121 /**
122 * will be set by showImageIcon as a side-effect of an error
123 */
124 Glib::ustring svgError;
126 };
130 } // namespace Widget
131 } // namespace UI
132 } // namespace Inkscape
135 #endif /* __UI_DIALOG_IMAGE_H__ */
136 /*#########################################################################
137 ### E N D O F F I L E
138 #########################################################################*/