summaryrefslogtreecommitdiffstats
path: root/src/ui/widget/imageicon.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/widget/imageicon.h')
-rw-r--r--src/ui/widget/imageicon.h138
1 files changed, 138 insertions, 0 deletions
diff --git a/src/ui/widget/imageicon.h b/src/ui/widget/imageicon.h
new file mode 100644
index 000000000..803b2f53f
--- /dev/null
+++ b/src/ui/widget/imageicon.h
@@ -0,0 +1,138 @@
+#ifndef __UI_DIALOG_IMAGE_H__
+#define __UI_DIALOG_IMAGE_H__
+/*
+ * A simple image display widget, using Inkscape's own rendering engine
+ *
+ * Authors:
+ * Bob Jamison
+ * Other dudes from The Inkscape Organization
+ *
+ * Copyright (C) 2004 The Inkscape Organization
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include <glibmm/ustring.h>
+#include <gtkmm/box.h>
+
+
+class SPDocument;
+
+namespace Inkscape
+{
+namespace UI
+{
+namespace Widget
+{
+
+
+/*#########################################################################
+### ImageIcon widget
+#########################################################################*/
+
+/**
+ * This class is evolved from the SVGPreview widget of the FileChooser
+ * This uses Inkscape's renderer to show images in a variety of formats,
+ * including SVG
+ */
+class ImageIcon : public Gtk::VBox
+{
+public:
+
+ /**
+ * Constructor
+ */
+ ImageIcon();
+
+ /**
+ * Construct from a file name
+ */
+ ImageIcon(const Glib::ustring &fileName);
+
+ /**
+ * Copy Constructor
+ */
+ ImageIcon(const ImageIcon &other);
+
+ /**
+ * Destructor
+ */
+ ~ImageIcon();
+
+ /**
+ *
+ */
+ bool showSvgDocument(const SPDocument *doc);
+
+ /**
+ *
+ */
+ bool showSvgFile(const Glib::ustring &fileName);
+
+ /**
+ *
+ */
+ bool showSvgFromMemory(const char *xmlBuffer);
+
+ /**
+ * Show image embedded in SVG
+ */
+ bool showBitmap(const Glib::ustring &fileName);
+
+ /**
+ * Show the "Too large" image
+ */
+ void showBrokenImage(const Glib::ustring &reason);
+
+ /**
+ *
+ */
+ bool show(const Glib::ustring &fileName);
+
+private:
+
+ /**
+ * basic initialization, called by the various constructors
+ */
+ void init();
+
+ /**
+ * The svg document we are currently showing
+ */
+ SPDocument *document;
+
+ /**
+ * The sp_svg_view widget
+ */
+ Gtk::Widget *viewerGtkmm;
+
+ /**
+ * are we currently showing the "broken image" image?
+ */
+ bool showingBrokenImage;
+
+
+ /**
+ * will be set by showImageIcon as a side-effect of an error
+ */
+ Glib::ustring bitmapError;
+
+
+ /**
+ * will be set by showImageIcon as a side-effect of an error
+ */
+ Glib::ustring svgError;
+
+};
+
+
+
+} // namespace Widget
+} // namespace UI
+} // namespace Inkscape
+
+
+#endif /* __UI_DIALOG_IMAGE_H__ */
+/*#########################################################################
+### E N D O F F I L E
+#########################################################################*/