1 /*
2 Author: Ted Gould <ted@gould.cx>
3 Copyright (c) 2003-2005
5 This code is licensed under the GNU GPL. See COPYING for details.
7 This file is the backend to the extensions system. These are
8 the parts of the system that most users will never see, but are
9 important for implementing the extensions themselves. This file
10 contains the base class for all of that.
11 */
12 #ifndef __INKSCAPE_EXTENSION_IMPLEMENTATION_H__
13 #define __INKSCAPE_EXTENSION_IMPLEMENTATION_H__
15 #include <gtk/gtkdialog.h>
16 #include <gdkmm/types.h>
17 #include <gtkmm/widget.h>
19 #include "forward.h"
20 #include "extension/extension-forward.h"
21 #include "libnr/nr-forward.h"
22 #include "libnr/nr-point.h"
24 namespace Inkscape {
25 namespace Extension {
26 namespace Implementation {
28 /**
29 * Base class for all implementations of modules. This is whether they are done systematically by
30 * having something like the scripting system, or they are implemented internally they all derive
31 * from this class.
32 */
33 class Implementation {
34 public:
35 /* ----- Constructor / destructor ----- */
36 Implementation() {}
38 virtual ~Implementation() {}
40 /* ----- Basic functions for all Extension ----- */
41 virtual bool load(Inkscape::Extension::Extension *module);
43 virtual void unload(Inkscape::Extension::Extension *module);
45 /** Verify any dependencies. */
46 virtual bool check(Inkscape::Extension::Extension *module);
49 /* ----- Input functions ----- */
50 /** Find out information about the file. */
51 virtual Gtk::Widget *prefs_input(Inkscape::Extension::Input *module,
52 gchar const *filename);
54 virtual SPDocument *open(Inkscape::Extension::Input *module,
55 gchar const *filename);
57 /* ----- Output functions ----- */
58 /** Find out information about the file. */
59 virtual Gtk::Widget *prefs_output(Inkscape::Extension::Output *module);
60 virtual void save(Inkscape::Extension::Output *module, SPDocument *doc, gchar const *filename);
62 /* ----- Effect functions ----- */
63 /** Find out information about the file. */
64 virtual Gtk::Widget * prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View * view);
65 /* TODO: need to figure out what we need here */
67 virtual void effect(Inkscape::Extension::Effect *module,
68 Inkscape::UI::View::View *document);
70 /* ----- Print functions ----- */
71 virtual unsigned setup(Inkscape::Extension::Print *module);
72 virtual unsigned set_preview(Inkscape::Extension::Print *module);
74 virtual unsigned begin(Inkscape::Extension::Print *module,
75 SPDocument *doc);
76 virtual unsigned finish(Inkscape::Extension::Print *module);
77 virtual bool textToPath(Inkscape::Extension::Print *ext);
79 /* ----- Rendering methods ----- */
80 virtual unsigned bind(Inkscape::Extension::Print *module,
81 NRMatrix const *transform,
82 float opacity);
83 virtual unsigned release(Inkscape::Extension::Print *module);
84 virtual unsigned comment(Inkscape::Extension::Print *module, const char * comment);
85 virtual unsigned fill(Inkscape::Extension::Print *module,
86 NRBPath const *bpath,
87 NRMatrix const *ctm,
88 SPStyle const *style,
89 NRRect const *pbox,
90 NRRect const *dbox,
91 NRRect const *bbox);
92 virtual unsigned stroke(Inkscape::Extension::Print *module,
93 NRBPath const *bpath,
94 NRMatrix const *transform,
95 SPStyle const *style,
96 NRRect const *pbox,
97 NRRect const *dbox,
98 NRRect const *bbox);
99 virtual unsigned image(Inkscape::Extension::Print *module,
100 unsigned char *px,
101 unsigned int w,
102 unsigned int h,
103 unsigned int rs,
104 NRMatrix const *transform,
105 SPStyle const *style);
106 virtual unsigned text(Inkscape::Extension::Print *module,
107 char const *text,
108 NR::Point p,
109 SPStyle const *style);
110 };
112 } /* namespace Implementation */
113 } /* namespace Extension */
114 } /* namespace Inkscape */
116 #endif /* __INKSCAPE_EXTENSION_IMPLEMENTATION_H__ */
118 /*
119 Local Variables:
120 mode:c++
121 c-file-style:"stroustrup"
122 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
123 indent-tabs-mode:nil
124 fill-column:99
125 End:
126 */
127 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :