Add some window events.
[screen-lua.git] / src / script.h
blob6f70ce96ce04635fbda91b50346d8fbdf3fb26be
1 /* Copyright (c) 2008 Sadrul Habib Chowdhury (sadrul@users.sf.net)
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 3, or (at your option)
6 * any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program (see the file COPYING); if not, write to the
15 * Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
18 ****************************************************************
19 * $Id$ FAU
21 #ifndef SCRIPT_H
22 #define SCRIPT_H
23 struct win;
25 /*Obsolete*/
26 struct ScriptFuncs
28 int (*sf_ProcessCaption) __P((const char *, struct win *, int len));
31 /***Language binding***/
32 struct binding
34 char * name;
35 int inited;
36 int registered;
37 int (*bd_Init) __P((void));
38 int (*bd_Finit) __P((void));
39 int (*bd_call) __P((const char *func, const char **argv));
40 /*Returns zero on failure, non zero on success*/
41 int (*bd_Source) __P((const char *, int));
42 /* The return value is significant:
43 * a non-zero value will stop further
44 * notification to the rest of the chain.*/
45 int (*bd_dispatch) __P((void *handler, const char *params, va_list va));
47 struct binding *b_next;
48 struct ScriptFuncs *fns;
51 void LoadBindings(void);
52 void FinalizeBindings(void);
53 void ScriptCmd __P((int argc, const char **argv));
55 /***Script events***/
57 struct script_event;
58 /* Script event listener */
59 struct listener
61 /*Binding dependent event handler data*/
62 void *handler;
63 struct binding *bd;
65 /* smaller means higher privilege.*/
66 unsigned int priv;
67 struct listener *chain;
68 struct listener *prev;
71 /* the script_event structure needs to be zeroed before using.
72 * embeding this structure directly into screen objects will do the job, as
73 * long as the objects are created from calloc() call.*/
74 struct script_event
76 /* expected parameter description of this event. */
77 char *params;
78 struct listener listeners;
80 struct script_event* object_get_event __P((char *obj, const char *name));
81 int trigger_sevent(struct script_event *ev, VA_DOTS);
82 int register_listener(struct script_event *ev, struct listener *l);
83 void unregister_listener(struct listener *l);
85 struct gevents {
86 struct script_event cmdexecuted;
87 struct script_event detached;
88 struct script_event forechanged;
90 extern struct gevents globalevents;
91 #endif