Typo fixes from Trent W Buck.
[screen-lua.git] / src / layer.h
blob7d5da0b0642cd531b1c8f538718889cb0f940771
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$ GNU
30 #ifndef SCREEN_LAYER_H
31 #define SCREEN_LAYER_H
34 * This is the overlay structure. It is used to create a seperate
35 * layer over the current windows.
38 struct mchar; /* forward declaration */
40 struct LayFuncs
42 void (*lf_LayProcess) __P((char **, int *));
43 void (*lf_LayAbort) __P((void));
44 void (*lf_LayRedisplayLine) __P((int, int, int, int));
45 void (*lf_LayClearLine) __P((int, int, int, int));
46 int (*lf_LayRewrite) __P((int, int, int, struct mchar *, int));
47 int (*lf_LayResize) __P((int, int));
48 void (*lf_LayRestore) __P((void));
51 struct layer
53 struct canvas *l_cvlist; /* list of canvases displaying layer */
54 int l_width;
55 int l_height;
56 int l_x; /* cursor position */
57 int l_y;
58 int l_encoding;
59 struct LayFuncs *l_layfn;
60 void *l_data;
62 struct layer *l_next; /* layer stack, should be in data? */
63 struct layer *l_bottom; /* bottom element of layer stack */
64 int l_blocking;
65 int l_mode; /* non-zero == edit mode */
67 struct {
68 unsigned char buffer[3]; /* [0]: the button
69 [1]: x
70 [2]: y
72 int len;
73 int start;
74 } l_mouseevent;
76 struct {
77 int d : 1; /* Is the output for the layer blocked? */
79 /* After unpausing, what region should we refresh? */
80 int *left, *right;
81 int top, bottom;
82 int lines;
83 } l_pause;
86 #define LayProcess (*flayer->l_layfn->lf_LayProcess)
87 #define LayAbort (*flayer->l_layfn->lf_LayAbort)
88 #define LayRedisplayLine (*flayer->l_layfn->lf_LayRedisplayLine)
89 #define LayClearLine (*flayer->l_layfn->lf_LayClearLine)
90 #define LayRewrite (*flayer->l_layfn->lf_LayRewrite)
91 #define LayResize (*flayer->l_layfn->lf_LayResize)
92 #define LayRestore (*flayer->l_layfn->lf_LayRestore)
94 #define LaySetCursor() LGotoPos(flayer, flayer->l_x, flayer->l_y)
95 #define LayCanResize(l) (l->l_layfn->LayResize != DefResize)
97 /* XXX: AArgh! think again! */
99 #define LAY_CALL_UP(fn) do \
101 struct layer *oldlay = flayer; \
102 struct canvas *oldcvlist, *cv; \
103 debug("LayCallUp\n"); \
104 flayer = flayer->l_next; \
105 oldcvlist = flayer->l_cvlist; \
106 debug1("oldcvlist: %x\n", oldcvlist); \
107 flayer->l_cvlist = oldlay->l_cvlist; \
108 for (cv = flayer->l_cvlist; cv; cv = cv->c_lnext) \
109 cv->c_layer = flayer; \
110 fn; \
111 flayer = oldlay; \
112 for (cv = flayer->l_cvlist; cv; cv = cv->c_lnext) \
113 cv->c_layer = flayer; \
114 flayer->l_next->l_cvlist = oldcvlist; \
115 } while(0)
117 #define LAY_DISPLAYS(l, fn) do \
119 struct display *olddisplay = display; \
120 struct canvas *cv; \
121 for (display = displays; display; display = display->d_next) \
123 for (cv = D_cvlist; cv; cv = cv->c_next) \
124 if (cv->c_layer == l) \
125 break; \
126 if (cv == 0) \
127 continue; \
128 fn; \
130 display = olddisplay; \
131 } while(0)
133 #endif /* SCREEN_LAYER_H */
136 * (Un)Pauses a layer.
138 * @param layer The layer that should be (un)paused.
139 * @param pause Should we pause the layer?
141 void LayPause __P((struct layer *layer, int pause));
144 * Update the region to refresh after a layer is unpaused.
146 * @param layer The layer.
147 * @param xs The left-end of the region.
148 * @param xe The right-end of the region.
149 * @param ys The top-end of the region.
150 * @param ye The bottom-end of the region.
152 void LayPauseUpdateRegion __P((struct layer *layer, int xs, int xe, int ys, int ye));
155 * Free any internal memory for the layer.
157 * @param layer The layer.
159 void LayerCleanupMemory __P((struct layer *layer));