1 /****************************************************************************
2 * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. *
4 * Permission is hereby granted, free of charge, to any person obtaining a *
5 * copy of this software and associated documentation files (the *
6 * "Software"), to deal in the Software without restriction, including *
7 * without limitation the rights to use, copy, modify, merge, publish, *
8 * distribute, distribute with modifications, sublicense, and/or sell *
9 * copies of the Software, and to permit persons to whom the Software is *
10 * furnished to do so, subject to the following conditions: *
12 * The above copyright notice and this permission notice shall be included *
13 * in all copies or substantial portions of the Software. *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
18 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
21 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
23 * Except as contained in this notice, the name(s) of the above copyright *
24 * holders shall not be used in advertising or otherwise to promote the *
25 * sale, use or other dealings in this Software without prior written *
27 ****************************************************************************/
29 /****************************************************************************
30 * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995 *
31 * and: Eric S. Raymond <esr@snark.thyrsus.com> *
32 * and: Juergen Pfeifer 1996-1999,2008 *
33 * and: Thomas E. Dickey *
34 ****************************************************************************/
36 /* panel.c -- implementation of panels library, some core routines */
37 #include "panel.priv.h"
39 MODULE_ID("$Id: panel.c,v 1.26 2012/02/23 10:02:15 tom Exp $")
41 /*+-------------------------------------------------------------------------
42 _nc_retrace_panel (pan)
43 --------------------------------------------------------------------------*/
45 NCURSES_EXPORT(PANEL
*)
46 _nc_retrace_panel(PANEL
* pan
)
48 T((T_RETURN("%p"), (void *)pan
));
53 /*+-------------------------------------------------------------------------
55 --------------------------------------------------------------------------*/
58 NCURSES_EXPORT(const char *)
59 _nc_my_visbuf(const void *ptr
)
64 _nc_SPRINTF(temp
, _nc_SLIMIT(sizeof(temp
)) "ptr:%p", ptr
);
66 _nc_STRCPY(temp
, "<null>", sizeof(temp
));
67 return _nc_visbuf(temp
);
72 /*+-------------------------------------------------------------------------
74 --------------------------------------------------------------------------*/
77 _nc_dPanel(const char *text
, const PANEL
* pan
)
79 _tracef("%s id=%s b=%s a=%s y=%d x=%d",
80 text
, USER_PTR(pan
->user
),
81 (pan
->below
) ? USER_PTR(pan
->below
->user
) : "--",
82 (pan
->above
) ? USER_PTR(pan
->above
->user
) : "--",
83 PSTARTY(pan
), PSTARTX(pan
));
87 /*+-------------------------------------------------------------------------
89 --------------------------------------------------------------------------*/
92 _nc_dStack(const char *fmt
, int num
, const PANEL
* pan
)
98 _nc_SPRINTF(s80
, _nc_SLIMIT(sizeof(s80
)) fmt
, num
, pan
);
99 _tracef("%s b=%s t=%s", s80
,
100 (_nc_bottom_panel
) ? USER_PTR(_nc_bottom_panel
->user
) : "--",
101 (_nc_top_panel
) ? USER_PTR(_nc_top_panel
->user
) : "--");
103 _tracef("pan id=%s", USER_PTR(pan
->user
));
104 pan
= _nc_bottom_panel
;
113 /*+-------------------------------------------------------------------------
114 Wnoutrefresh(pan) - debugging hook for wnoutrefresh
115 --------------------------------------------------------------------------*/
118 _nc_Wnoutrefresh(const PANEL
* pan
)
120 dPanel("wnoutrefresh", pan
);
121 wnoutrefresh(pan
->win
);
125 /*+-------------------------------------------------------------------------
127 --------------------------------------------------------------------------*/
130 _nc_Touchpan(const PANEL
* pan
)
132 dPanel("Touchpan", pan
);
137 /*+-------------------------------------------------------------------------
138 Touchline(pan,start,count)
139 --------------------------------------------------------------------------*/
142 _nc_Touchline(const PANEL
* pan
, int start
, int count
)
146 _nc_SPRINTF(s80
, _nc_SLIMIT(sizeof(s80
)) "Touchline s=%d c=%d", start
, count
);
148 touchline(pan
->win
, start
, count
);
154 /* Some C compilers need something defined in a source file */
155 extern void _nc_dummy_panel(void);
157 _nc_dummy_panel(void)