Adding upstream version 0.3.5.2+svn20080509.
[debian/lxpanel.git] / src / plugin.h
1 /**
2 * Copyright (c) 2006 LxDE Developers, see the file AUTHORS for details.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19 #ifndef PLUGIN_H
20 #define PLUGIN_H
21
22 #include <gmodule.h>
23
24 #include <gtk/gtk.h>
25 #include <gdk/gdk.h>
26 #include <stdio.h>
27 #include "panel.h"
28
29 typedef struct {
30 /* common */
31 char *fname;
32 int count;
33 GModule *gmodule;
34
35 int dynamic : 1;
36 int invisible : 1;
37 /* these fields are pointers to the data within loaded dll */
38 char *type;
39 char *name;
40 char *version;
41 char *description;
42
43 int (*constructor)(struct _Plugin *this, char **fp);
44 void (*destructor)(struct _Plugin *this);
45 void (*config)(struct _Plugin *this, GtkWindow* parent); /* config UI */
46 void (*save)(struct _Plugin *this, FILE* fp);
47 void (*orientation)(struct _Plugin *this);
48 } PluginClass;
49
50 typedef struct _Plugin{
51 PluginClass *class;
52 Panel *panel;
53 GtkWidget *pwid;
54 int expand;
55 int padding;
56 int border;
57 gpointer priv;
58 } Plugin;
59
60 /* if plugin is external it will load its dll */
61 Plugin * plugin_load(char *type);
62 void plugin_put(Plugin *this);
63 int plugin_start(Plugin *this, char **fp);
64 void plugin_stop(Plugin *this);
65
66 void plugin_class_unref( PluginClass* pc );
67
68 /*
69 Get a list of all available plugin classes
70 Return a newly allocated GList which should be freed with
71 plugin_class_list_free( list );
72 */
73 GList* plugin_get_available_classes();
74 void plugin_class_list_free( GList* classes );
75
76 void plugin_set_background( Plugin* pl, Panel* p );
77 void plugin_widget_set_background( GtkWidget* w, Panel* p );
78
79 /* FIXME: optional definitions */
80 #define STATIC_SEPARATOR
81 /* #define STATIC_IMAGE */
82 #define STATIC_LAUNCHBAR
83 #define STATIC_DCLOCK
84 #define STATIC_WINCMD
85 #define STATIC_DIRMENU
86 #define STATIC_TASKBAR
87 #define STATIC_PAGER
88 #define STATIC_TRAY
89 #define STATIC_MENU
90 #define STATIC_SPACE
91 #define STATIC_ICONS
92
93 #if 0
94 /* Try to handle GTypePlugin problems, but in vain. :-( */
95 #define LX_TYPE_TYPE_PLUGIN (lx_type_plugin_get_type ())
96 #define LX_TYPE_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LX_TYPE_TYPE_PLUGIN, LXTypePlugin))
97 #define LX_TYPE_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LX_TYPE_TYPE_PLUGIN, LXTypePluginClass))
98 #define LX_IS_TYPE_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LX_TYPE_TYPE_PLUGIN))
99
100 typedef struct _LXTypePlugin LXTypePlugin;
101 typedef struct _LXTypePluginClass LXTypePluginClass;
102
103 struct _LXTypePlugin {
104 GObject parent;
105 };
106
107 struct _LXTypePluginClass {
108 GObjectClass parent;
109 };
110
111 GTypePlugin* lx_type_plugin_get( const char* plugin_name );
112 #endif
113
114 #endif