medit/moo/mooedit/mooplugin.h

154 lines
4.9 KiB
C
Raw Normal View History

/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4; coding: utf-8 -*-
*
* mooplugin.h
*
* Copyright (C) 2004-2005 by Yevgen Muntyan <muntyan@math.tamu.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* See COPYING file that comes with this distribution.
*/
#ifndef __MOO_PLUGIN_H__
#define __MOO_PLUGIN_H__
#include "mooedit/mooeditor.h"
G_BEGIN_DECLS
#define MOO_PLUGIN_PREFS_ROOT "Plugins"
2005-09-15 14:49:51 -07:00
#define MOO_PLUGIN_CURRENT_VERSION 7
2005-09-11 23:57:29 -07:00
#define MOO_TYPE_PLUGIN (moo_plugin_get_type ())
#define MOO_PLUGIN(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), MOO_TYPE_PLUGIN, MooPlugin))
#define MOO_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_PLUGIN, MooPluginClass))
#define MOO_IS_PLUGIN(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), MOO_TYPE_PLUGIN))
#define MOO_IS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_PLUGIN))
#define MOO_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_PLUGIN, MooPluginClass))
2005-09-11 23:57:29 -07:00
#define MOO_TYPE_WINDOW_PLUGIN (moo_window_plugin_get_type ())
#define MOO_WINDOW_PLUGIN(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), MOO_TYPE_WINDOW_PLUGIN, MooWindowPlugin))
#define MOO_WINDOW_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_WINDOW_PLUGIN, MooWindowPluginClass))
#define MOO_IS_WINDOW_PLUGIN(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), MOO_TYPE_WINDOW_PLUGIN))
#define MOO_IS_WINDOW_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_WINDOW_PLUGIN))
#define MOO_WINDOW_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_WINDOW_PLUGIN, MooWindowPluginClass))
2005-09-11 23:57:29 -07:00
typedef struct _MooPlugin MooPlugin;
typedef struct _MooPluginInfo MooPluginInfo;
typedef struct _MooPluginParams MooPluginParams;
typedef struct _MooPluginPrefsParams MooPluginPrefsParams;
typedef struct _MooPluginClass MooPluginClass;
typedef struct _MooWindowPlugin MooWindowPlugin;
typedef struct _MooWindowPluginClass MooWindowPluginClass;
2005-09-11 23:57:29 -07:00
typedef gboolean (*MooPluginModuleInitFunc) (void);
2005-09-11 23:57:29 -07:00
typedef gboolean (*MooPluginInitFunc) (MooPlugin *plugin);
typedef void (*MooPluginDeinitFunc) (MooPlugin *plugin);
typedef void (*MooPluginAttachFunc) (MooPlugin *plugin,
MooEditWindow *window);
typedef void (*MooPluginDetachFunc) (MooPlugin *plugin,
MooEditWindow *window);
typedef gboolean (*MooWindowPluginCreateFunc) (MooWindowPlugin *wplugin);
typedef void (*MooWindowPluginDestroyFunc) (MooWindowPlugin *wplugin);
struct _MooPluginParams
{
2005-09-11 23:57:29 -07:00
gboolean enabled;
};
2005-09-11 23:57:29 -07:00
struct _MooPluginPrefsParams
{
};
struct _MooPluginInfo
{
const char *id;
const char *name;
const char *description;
const char *author;
const char *version;
MooPluginParams *params;
MooPluginPrefsParams *prefs_params;
};
2005-09-11 23:57:29 -07:00
struct _MooPlugin
{
GObject parent;
gboolean initialized;
GModule *module;
2005-09-11 23:57:29 -07:00
MooPluginInfo *info;
GType window_plugin_type;
};
struct _MooWindowPlugin
{
2005-09-11 23:57:29 -07:00
GObject parent;
MooEditWindow *window;
MooPlugin *plugin;
};
2005-09-11 23:57:29 -07:00
struct _MooPluginClass
{
GObjectClass parent_class;
guint plugin_system_version;
2005-09-11 23:57:29 -07:00
MooPluginInitFunc init;
MooPluginDeinitFunc deinit;
MooPluginAttachFunc attach;
MooPluginDetachFunc detach;
};
2005-09-11 23:57:29 -07:00
struct _MooWindowPluginClass
{
2005-09-11 23:57:29 -07:00
GObjectClass parent_class;
MooWindowPluginCreateFunc create;
MooWindowPluginDestroyFunc destroy;
};
2005-09-11 23:57:29 -07:00
GType moo_plugin_get_type (void) G_GNUC_CONST;
GType moo_window_plugin_get_type (void) G_GNUC_CONST;
gboolean moo_plugin_register (GType type);
2005-09-11 23:57:29 -07:00
gboolean moo_plugin_initialized (MooPlugin *plugin);
gboolean moo_plugin_enabled (MooPlugin *plugin);
gboolean moo_plugin_set_enabled (MooPlugin *plugin,
gboolean enabled);
2005-09-11 23:57:29 -07:00
MooPlugin *moo_plugin_get (GType type);
gboolean moo_plugin_registered (GType type);
2005-09-11 23:57:29 -07:00
gpointer moo_plugin_lookup (const char *plugin_id);
GSList *moo_list_plugins (void);
2005-09-11 23:57:29 -07:00
const char *moo_plugin_get_id (MooPlugin *plugin);
2005-09-11 23:57:29 -07:00
gpointer moo_window_plugin_lookup (const char *plugin_id,
MooEditWindow *window);
2005-09-11 23:57:29 -07:00
void moo_plugin_read_dir (const char *dir);
2005-09-11 23:57:29 -07:00
void _moo_window_attach_plugins (MooEditWindow *window);
void _moo_plugin_detach_plugins (MooEditWindow *window);
G_END_DECLS
#endif /* __MOO_PLUGIN_H__ */