Move plugin init code
[gnumeric.git] / src / gnm-plugin.h
blobd15ba79b6f16b830ec0d9d0773805ff30621cbae
1 #ifndef _GNM_PLUGIN_H_
2 # define _GNM_PLUGIN_H_
4 #include <gnumeric.h>
5 #include <goffice/goffice.h>
6 #include <goffice/app/module-plugin-defs.h>
7 #include <tools/gnm-solver.h>
8 #include <gmodule.h>
10 G_BEGIN_DECLS
12 #define GNM_PLUGIN_LOADER_MODULE_TYPE (gnm_plugin_loader_module_get_type ())
13 #define GNM_PLUGIN_LOADER_MODULE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNM_PLUGIN_LOADER_MODULE_TYPE, GnmPluginLoaderModule))
14 GType gnm_plugin_loader_module_get_type (void);
16 #define GNM_PLUGIN_SERVICE_FUNCTION_GROUP_TYPE (gnm_plugin_service_function_group_get_type ())
17 #define GNM_PLUGIN_SERVICE_FUNCTION_GROUP(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNM_PLUGIN_SERVICE_FUNCTION_GROUP_TYPE, GnmPluginServiceFunctionGroup))
18 #define GNM_IS_PLUGIN_SERVICE_FUNCTION_GROUP(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNM_PLUGIN_SERVICE_FUNCTION_GROUP_TYPE))
20 GType gnm_plugin_service_function_group_get_type (void);
21 typedef struct GnmPluginServiceFunctionGroup_ GnmPluginServiceFunctionGroup;
22 typedef struct {
23 gboolean (*func_desc_load) (GOPluginService *service, char const *name,
24 GnmFuncDescriptor *res);
25 } GnmPluginServiceFunctionGroupCallbacks;
27 #define GNM_PLUGIN_SERVICE_UI_TYPE (gnm_plugin_service_ui_get_type ())
28 #define GNM_PLUGIN_SERVICE_UI(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNM_PLUGIN_SERVICE_UI_TYPE, PluginServiceUI))
29 #define GNM_IS_PLUGIN_SERVICE_UI(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNM_PLUGIN_SERVICE_UI_TYPE))
31 GType gnm_plugin_service_ui_get_type (void);
32 typedef struct GnmPluginServiceUI_ PluginServiceUI;
33 typedef struct {
34 void (*plugin_func_exec_action) (
35 GOPluginService *service, GnmAction const *action,
36 WorkbookControl *wbc, GOErrorInfo **ret_error);
37 } GnmPluginServiceUICallbacks;
39 /* This type is intended for use with "ui" service.
40 * Plugins should define arrays of structs of the form:
41 * GnmModulePluginUIActions <service-id>_actions[] = { ... };
43 typedef struct {
44 char const *name;
45 void (*handler) (GnmAction const *action, WorkbookControl *wbc);
46 } GnmModulePluginUIActions;
48 #define GNM_PLUGIN_SERVICE_SOLVER_TYPE (gnm_plugin_service_solver_get_type ())
49 #define GNM_PLUGIN_SERVICE_SOLVER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNM_PLUGIN_SERVICE_SOLVER_TYPE, PluginServiceSolver))
50 #define GNM_IS_PLUGIN_SERVICE_SOLVER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNM_PLUGIN_SERVICE_SOLVER_TYPE))
52 GType gnm_plugin_service_solver_get_type (void);
53 typedef struct GnmPluginServiceSolver_ PluginServiceSolver;
54 typedef struct {
55 GnmSolverCreator creator;
56 GnmSolverFactoryFunctional functional;
57 } GnmPluginServiceSolverCallbacks;
59 /**************************************************************************/
60 #define GNM_PLUGIN_MODULE_HEADER \
61 G_MODULE_EXPORT GOPluginModuleDepend const go_plugin_depends [] = { \
62 { "goffice", GOFFICE_API_VERSION }, \
63 { "gnumeric", GNM_VERSION_FULL } \
64 }; \
65 G_MODULE_EXPORT GOPluginModuleHeader const go_plugin_header = \
66 { GOFFICE_MODULE_PLUGIN_MAGIC_NUMBER, G_N_ELEMENTS (go_plugin_depends) }
68 /**************************************************************************/
70 void gnm_plugins_service_init (void);
71 void gnm_plugins_init (GOCmdContext *c);
73 G_END_DECLS
75 #endif /* _GNM_PLUGIN_H_ */