Code

moving trunk for module inkscape
[inkscape.git] / src / extension / implementation / plugin.h
1 /** \file
2  * Inkscape::Extension::Implementation::Plugin
3  *
4  * Author:  Ted Gould <ted@gould.cx>
5  * Copyright (c) 2004-2005
6  *
7  * This code is licensed under the GNU GPL.  See COPYING for details.
8  */
9 #ifndef __INKSCAPE_EXTENSION_IMPLEMENTATION_PLUGIN_H__
10 #define __INKSCAPE_EXTENSION_IMPLEMENTATION_PLUGIN_H__
12 #include <extension/implementation/implementation.h>
13 #include <glibmm/module.h>
14 #include "plugin-link.h"
16 namespace Inkscape {
17 namespace Extension {
18 namespace Implementation {
20 /** \brief  For the most part this is a direct steal from \c implementation.h
21             in that all the functions have the same prototypes.  The two
22             added things are a pointer to the loaded module and a pointer
23             to the symbol table in that. */
24 class Plugin : public Implementation {
25     /** \brief A pointer to the module created when loading the plugin. */
26     Glib::Module * _module;
27     /** \brief The symbol table that is in the plugin.  It is pulled out
28                here so that it doesn't have to be grabbed as often. */
29     inkscape_plugin_function_table * _symTable;
31 public:
32     Plugin(void);
34     /* ----- Basic functions for all Extension ----- */
35     virtual bool load(Inkscape::Extension::Extension *module);
37     virtual void unload(Inkscape::Extension::Extension *module);
39     /** Verify any dependencies. */
40     virtual bool check(Inkscape::Extension::Extension *module);
43     /* ----- Input functions ----- */
44     /** Find out information about the file. */
45     virtual Gtk::Widget *prefs_input(Inkscape::Extension::Input *module,
46                              gchar const *filename);
48     virtual SPDocument *open(Inkscape::Extension::Input *module,
49                              gchar const *filename);
51     /* ----- Output functions ----- */
52     /** Find out information about the file. */
53     virtual Gtk::Widget *prefs_output(Inkscape::Extension::Output *module);
54     virtual void save(Inkscape::Extension::Output *module, SPDocument *doc, gchar const *filename);
56     /* ----- Effect functions ----- */
57     /** Find out information about the file. */
58     virtual Gtk::Widget * prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View * view);
59     /* TODO: need to figure out what we need here */
61     virtual void effect(Inkscape::Extension::Effect *module,
62                         Inkscape::UI::View::View *document);
64     /* ----- Print functions ----- */
65     virtual unsigned setup(Inkscape::Extension::Print *module);
66     virtual unsigned set_preview(Inkscape::Extension::Print *module);
68     virtual unsigned begin(Inkscape::Extension::Print *module,
69                            SPDocument *doc);
70     virtual unsigned finish(Inkscape::Extension::Print *module);
71     virtual bool     textToPath(Inkscape::Extension::Print *ext);
73     /* ----- Rendering methods ----- */
74     virtual unsigned bind(Inkscape::Extension::Print *module,
75                           NRMatrix const *transform,
76                           float opacity);
77     virtual unsigned release(Inkscape::Extension::Print *module);
78     virtual unsigned comment(Inkscape::Extension::Print *module, const char * comment);
79     virtual unsigned fill(Inkscape::Extension::Print *module,
80                           NRBPath const *bpath,
81                           NRMatrix const *ctm,
82                           SPStyle const *style,
83                           NRRect const *pbox,
84                           NRRect const *dbox,
85                           NRRect const *bbox);
86     virtual unsigned stroke(Inkscape::Extension::Print *module,
87                             NRBPath const *bpath,
88                             NRMatrix const *transform,
89                             SPStyle const *style,
90                             NRRect const *pbox,
91                             NRRect const *dbox,
92                             NRRect const *bbox);
93     virtual unsigned image(Inkscape::Extension::Print *module,
94                            unsigned char *px,
95                            unsigned int w,
96                            unsigned int h,
97                            unsigned int rs,
98                            NRMatrix const *transform,
99                            SPStyle const *style);
100     virtual unsigned text(Inkscape::Extension::Print *module,
101                           char const *text,
102                           NR::Point p,
103                           SPStyle const *style);
104 };
106 }  /* namespace Implementation */
107 }  /* namespace Extension */
108 }  /* namespace Inkscape */
110 #endif /* __INKSCAPE_EXTENSION_IMPLEMENTATION_PLUGIN_H__ */
112 /*
113   Local Variables:
114   mode:c++
115   c-file-style:"stroustrup"
116   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
117   indent-tabs-mode:nil
118   fill-column:99
119   End:
120 */
121 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :