Rearrange the python scripting support a bit.
[screen-lua.git] / src / layer.h
blob572c9e66ea8de147e15df26ceed906de729c53ce
1 /* Copyright (c) 2008, 2009
2 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
3 * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
4 * Micah Cowan (micah@cowan.name)
5 * Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
6 * Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
7 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
8 * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
9 * Copyright (c) 1987 Oliver Laumann
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3, or (at your option)
14 * any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program (see the file COPYING); if not, see
23 * http://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
26 ****************************************************************
27 * $Id$ FAU
31 * This is the overlay structure. It is used to create a seperate
32 * layer over the current windows.
35 struct mchar; /* forward declaration */
37 struct LayFuncs
39 void (*lf_LayProcess) __P((char **, int *));
40 void (*lf_LayAbort) __P((void));
41 void (*lf_LayRedisplayLine) __P((int, int, int, int));
42 void (*lf_LayClearLine) __P((int, int, int, int));
43 int (*lf_LayRewrite) __P((int, int, int, struct mchar *, int));
44 int (*lf_LayResize) __P((int, int));
45 void (*lf_LayRestore) __P((void));
48 struct layer
50 struct canvas *l_cvlist; /* list of canvases displaying layer */
51 int l_width;
52 int l_height;
53 int l_x; /* cursor position */
54 int l_y;
55 int l_encoding;
56 struct LayFuncs *l_layfn;
57 char *l_data;
59 struct layer *l_next; /* layer stack, should be in data? */
60 struct layer *l_bottom; /* bottom element of layer stack */
61 int l_blocking;
64 #define LayProcess (*flayer->l_layfn->lf_LayProcess)
65 #define LayAbort (*flayer->l_layfn->lf_LayAbort)
66 #define LayRedisplayLine (*flayer->l_layfn->lf_LayRedisplayLine)
67 #define LayClearLine (*flayer->l_layfn->lf_LayClearLine)
68 #define LayRewrite (*flayer->l_layfn->lf_LayRewrite)
69 #define LayResize (*flayer->l_layfn->lf_LayResize)
70 #define LayRestore (*flayer->l_layfn->lf_LayRestore)
72 #define LaySetCursor() LGotoPos(flayer, flayer->l_x, flayer->l_y)
73 #define LayCanResize(l) (l->l_layfn->LayResize != DefResize)
75 /* XXX: AArgh! think again! */
77 #define LAY_CALL_UP(fn) do \
78 { \
79 struct layer *oldlay = flayer; \
80 struct canvas *oldcvlist, *cv; \
81 debug("LayCallUp\n"); \
82 flayer = flayer->l_next; \
83 oldcvlist = flayer->l_cvlist; \
84 debug1("oldcvlist: %x\n", oldcvlist); \
85 flayer->l_cvlist = oldlay->l_cvlist; \
86 for (cv = flayer->l_cvlist; cv; cv = cv->c_lnext) \
87 cv->c_layer = flayer; \
88 fn; \
89 flayer = oldlay; \
90 for (cv = flayer->l_cvlist; cv; cv = cv->c_lnext) \
91 cv->c_layer = flayer; \
92 flayer->l_next->l_cvlist = oldcvlist; \
93 } while(0)
95 #define LAY_DISPLAYS(l, fn) do \
96 { \
97 struct display *olddisplay = display; \
98 struct canvas *cv; \
99 for (display = displays; display; display = display->d_next) \
101 for (cv = D_cvlist; cv; cv = cv->c_next) \
102 if (cv->c_layer == l) \
103 break; \
104 if (cv == 0) \
105 continue; \
106 fn; \
108 display = olddisplay; \
109 } while(0)