1 /* General window behavior.
3 Copyright (C) 1998-2019 Free Software Foundation, Inc.
5 Contributed by Hewlett-Packard Company.
7 This file is part of GDB.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
24 #include "tui/tui-data.h"
25 #include "tui/tui-wingeneral.h"
26 #include "tui/tui-win.h"
28 #include "gdb_curses.h"
30 /***********************
32 ***********************/
34 /* Refresh the window. */
36 tui_refresh_win (struct tui_gen_win_info
*win_info
)
38 if (win_info
->type
== DATA_WIN
&& win_info
->content_size
> 0)
42 for (i
= 0; (i
< win_info
->content_size
); i
++)
44 struct tui_gen_win_info
*data_item_win_ptr
;
46 data_item_win_ptr
= win_info
->content
[i
]->which_element
.data_window
;
47 if (data_item_win_ptr
!= NULL
48 && data_item_win_ptr
->handle
!= NULL
)
49 wrefresh (data_item_win_ptr
->handle
);
52 else if (win_info
->type
== CMD_WIN
)
58 if (win_info
->handle
!= NULL
)
59 wrefresh (win_info
->handle
);
66 /* Function to delete the curses window, checking for NULL. */
68 tui_delete_win (WINDOW
*window
)
77 /* Draw a border arround the window. */
79 box_win (struct tui_gen_win_info
*win_info
,
82 if (win_info
&& win_info
->handle
)
87 win
= win_info
->handle
;
88 if (highlight_flag
== HILITE
)
89 attrs
= tui_active_border_attrs
;
91 attrs
= tui_border_attrs
;
95 wborder (win
, tui_border_vline
, tui_border_vline
,
96 tui_border_hline
, tui_border_hline
,
97 tui_border_ulcorner
, tui_border_urcorner
,
98 tui_border_llcorner
, tui_border_lrcorner
);
100 box (win
, tui_border_vline
, tui_border_hline
);
103 mvwaddstr (win
, 0, 3, win_info
->title
);
104 wattroff (win
, attrs
);
110 tui_unhighlight_win (struct tui_win_info
*win_info
)
113 && win_info
->generic
.handle
!= NULL
)
115 box_win (&win_info
->generic
, NO_HILITE
);
116 wrefresh (win_info
->generic
.handle
);
117 win_info
->set_highlight (false);
123 tui_highlight_win (struct tui_win_info
*win_info
)
126 && win_info
->can_highlight
127 && win_info
->generic
.handle
!= NULL
)
129 box_win (&win_info
->generic
, HILITE
);
130 wrefresh (win_info
->generic
.handle
);
131 win_info
->set_highlight (true);
136 tui_check_and_display_highlight_if_needed (struct tui_win_info
*win_info
)
138 if (win_info
!= NULL
&& win_info
->generic
.type
!= CMD_WIN
)
140 if (win_info
->is_highlighted
)
141 tui_highlight_win (win_info
);
143 tui_unhighlight_win (win_info
);
151 tui_make_window (struct tui_gen_win_info
*win_info
, int box_it
)
155 handle
= newwin (win_info
->height
,
159 win_info
->handle
= handle
;
162 if (box_it
== BOX_WINDOW
)
163 box_win (win_info
, NO_HILITE
);
164 win_info
->is_visible
= true;
165 scrollok (handle
, TRUE
);
170 /* We can't really make windows visible, or invisible. So we have to
171 delete the entire window when making it visible, and create it
172 again when making it visible. */
174 make_visible (struct tui_gen_win_info
*win_info
, bool visible
)
176 /* Don't tear down/recreate command window. */
177 if (win_info
->type
== CMD_WIN
)
182 if (!win_info
->is_visible
)
184 tui_make_window (win_info
, !tui_win_is_auxillary (win_info
->type
));
185 win_info
->is_visible
= true;
189 && win_info
->is_visible
190 && win_info
->handle
!= NULL
)
192 win_info
->is_visible
= false;
193 tui_delete_win (win_info
->handle
);
194 win_info
->handle
= NULL
;
201 tui_make_visible (struct tui_gen_win_info
*win_info
)
203 make_visible (win_info
, true);
207 tui_make_invisible (struct tui_gen_win_info
*win_info
)
209 make_visible (win_info
, false);
212 /* See tui-data.h. */
215 tui_win_info::make_visible (bool visible
)
217 ::make_visible (&generic
, visible
);
220 /* See tui-data.h. */
223 tui_source_window_base::make_visible (bool visible
)
225 ::make_visible (execution_info
, visible
);
226 tui_win_info::make_visible (visible
);
229 /* Makes all windows invisible (except the command and locator
232 make_all_visible (bool visible
)
236 for (i
= 0; i
< MAX_MAJOR_WINDOWS
; i
++)
238 if (tui_win_list
[i
] != NULL
)
239 tui_win_list
[i
]->make_visible (visible
);
246 tui_make_all_visible (void)
248 make_all_visible (true);
252 tui_make_all_invisible (void)
254 make_all_visible (false);
257 /* See tui-data.h. */
260 tui_win_info::refresh ()
262 touchwin (generic
.handle
);
263 tui_refresh_win (&generic
);
266 /* See tui-data.h. */
269 tui_source_window_base::refresh ()
271 touchwin (execution_info
->handle
);
272 tui_refresh_win (execution_info
);
273 tui_win_info::refresh ();
276 /* Function to refresh all the windows currently displayed. */
279 tui_refresh_all (struct tui_win_info
**list
)
282 struct tui_gen_win_info
*locator
= tui_locator_win_info_ptr ();
284 for (type
= SRC_WIN
; (type
< MAX_MAJOR_WINDOWS
); type
++)
286 if (list
[type
] && list
[type
]->generic
.is_visible
)
287 list
[type
]->refresh ();
289 if (locator
->is_visible
)
291 touchwin (locator
->handle
);
292 tui_refresh_win (locator
);
297 /*********************************
298 ** Local Static Functions
299 *********************************/
This page took 0.036054 seconds and 4 git commands to generate.