iceWing
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
plugin.h
Go to the documentation of this file.
1 /* -*- mode: C; tab-width: 4; c-basic-offset: 4; -*- */
2 
3 /*
4  * Author: Frank Loemker
5  *
6  * Copyright (C) 1999-2009
7  * Frank Loemker, Applied Computer Science, Faculty of Technology,
8  * Bielefeld University, Germany
9  *
10  * This file is part of iceWing, a graphical plugin shell.
11  *
12  * iceWing is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * iceWing is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
25  */
26 
27 #ifndef iw_plugin_H
28 #define iw_plugin_H
29 
30 #define IW_GRAB_TYPES
31 #include "grab.h"
32 #undef IW_GRAB_TYPES
33 
34 /* plugDefinition->abi_version should be set to this value in
35  the plug_get_info() factory function of a plugin. */
36 #define PLUG_ABI_VERSION 2
37 
38 /* For C++ plugins, this is the provided version.
39  This can also be used to test whether icemm support is available at all. */
40 #define ICEMM_VERSION 1
41 
42 /* Customizing flags for plug_add_default_page() */
43 typedef enum {
44  PLUG_PAGE_NOPLUG = 1 << 0,
47 
48 typedef struct _plugPlugin plugPlugin;
49 struct plugData;
50 
51 /* Definition of a plugin instance. Must be returned by the
52  plug_get_info() factory function of a plugin. */
53 typedef struct plugDefinition {
54  const char *name; /* Name of the instance, must be unique */
55  int abi_version; /* Always PLUG_ABI_VERSION */
56  void (*init) (struct plugDefinition *plug, grabParameter *para, int argc, char **argv);
57  int (*init_options) (struct plugDefinition *plug);
58  void (*cleanup) (struct plugDefinition *plug);
59  BOOL (*process) (struct plugDefinition *plug, char *id, struct plugData *data);
60  void *reserved1;
61  void *reserved2;
62  void *reserved3;
64 
65 /* Called on load of the plugin. Returns the filled plugin definition
66  structure and whether the plugin should be inserted at the start or
67  at the end of the iceWing internal plugin list. */
68 typedef plugDefinition* (*plugGetInfoFunc) (int call_cnt, BOOL *append);
69 
70 #include "plugin_comm.h"
71 #include "grab.h"
72 
73 #ifdef __cplusplus
74 extern "C" {
75 #endif
76 
77 /*********************************************************************
78  Return the plugin whose name matches 'name'.
79 *********************************************************************/
80 plugPlugin *plug_get_by_name (const char *name);
81 plugDefinition *plug_def_get_by_name (const char *name);
82 
83 /*********************************************************************
84  Return the path where 'plug' can store it's data files.
85 *********************************************************************/
87 
88 /*********************************************************************
89  Return a pointer to a per-plugin-instance string of the form
90  'plugDef->name''suffix'. Can be used e.g. for preview windows and
91  option pages.
92 *********************************************************************/
93 char *plug_name (plugDefinition *plug, const char *suffix);
94 
95 /*********************************************************************
96  Set the plugin enabled state.
97 *********************************************************************/
98 void plug_set_enable (plugPlugin *plug, BOOL enabled);
99 
100 /*********************************************************************
101  Register a new plugin 'plug_new' with iceWing. The new plugin gets
102  associated with the plugin 'plug', which should be the calling
103  plugin. Initialization is scheduled before the next main loop run.
104  append : Should the new plugin be inserted at the start or at
105  the end of the iceWing internal plugin list.
106  argc, argv: Command line arguments for the new plugin.
107  Return TRUE on sucess, FALSE otherwise.
108 
109  Attention: The function is not thread save. Should only be used for
110  language bindings. No arguments are copied.
111 *********************************************************************/
113  BOOL append, int argc, char **argv);
114 
115 /*********************************************************************
116  Create a new option page with the name 'plugDef->name" "suffix' and
117  two widgets:
118  1. Toggle to enable/disable the plugin processing call
119  (only if PLUG_PAGE_NODISABLE is not set in flags).
120  2. String for plugin names (only if PLUG_PAGE_NOPLUG is not set in
121  flags). The plugin gets called one after another for all data
122  from plugins which are entered here.
123  Return the number of the newly created page.
124 *********************************************************************/
125 int plug_add_default_page (plugDefinition *plugDef, const char *suffix,
126  plugPageFlags flags);
127 
128 #ifdef __cplusplus
129 }
130 #endif
131 
132 #endif /* iw_plugin_H */