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 ***********************/
37 tui_gen_win_info::refresh_window ()
49 tui_data_window::refresh_window ()
51 tui_gen_win_info::refresh_window ();
52 for (auto &&win : regs_content)
55 win->refresh_window ();
59 /* Function to delete the curses window, checking for NULL. */
61 tui_delete_win (WINDOW *window)
68 /* Draw a border arround the window. */
70 box_win (struct tui_gen_win_info *win_info,
73 if (win_info && win_info->handle)
78 win = win_info->handle;
79 if (highlight_flag == HILITE)
80 attrs = tui_active_border_attrs;
82 attrs = tui_border_attrs;
86 wborder (win, tui_border_vline, tui_border_vline,
87 tui_border_hline, tui_border_hline,
88 tui_border_ulcorner, tui_border_urcorner,
89 tui_border_llcorner, tui_border_lrcorner);
91 box (win, tui_border_vline, tui_border_hline);
94 mvwaddstr (win, 0, 3, win_info->title);
95 wattroff (win, attrs);
101 tui_unhighlight_win (struct tui_win_info *win_info)
104 && win_info->can_highlight
105 && win_info->handle != NULL)
107 box_win (win_info, NO_HILITE);
108 win_info->refresh_window ();
109 win_info->set_highlight (false);
115 tui_highlight_win (struct tui_win_info *win_info)
118 && win_info->can_highlight
119 && win_info->handle != NULL)
121 box_win (win_info, HILITE);
122 win_info->refresh_window ();
123 win_info->set_highlight (true);
128 tui_check_and_display_highlight_if_needed (struct tui_win_info *win_info)
130 if (win_info != NULL && win_info->can_highlight)
132 if (win_info->is_highlighted)
133 tui_highlight_win (win_info);
135 tui_unhighlight_win (win_info);
143 tui_make_window (struct tui_gen_win_info *win_info, enum tui_box box_it)
147 handle = newwin (win_info->height,
151 win_info->handle = handle;
154 if (box_it == BOX_WINDOW)
155 box_win (win_info, NO_HILITE);
156 win_info->is_visible = true;
157 scrollok (handle, TRUE);
162 /* We can't really make windows visible, or invisible. So we have to
163 delete the entire window when making it visible, and create it
164 again when making it visible. */
166 tui_gen_win_info::make_visible (bool visible)
172 tui_make_window (this, (tui_win_is_auxiliary (type)
173 ? DONT_BOX_WINDOW : BOX_WINDOW));
182 tui_delete_win (handle);
188 tui_make_visible (struct tui_gen_win_info *win_info)
190 win_info->make_visible (true);
194 tui_make_invisible (struct tui_gen_win_info *win_info)
196 win_info->make_visible (false);
199 /* See tui-data.h. */
202 tui_source_window_base::make_visible (bool visible)
204 if (execution_info != nullptr)
205 execution_info->make_visible (visible);
206 tui_win_info::make_visible (visible);
209 /* Makes all windows invisible (except the command and locator
212 make_all_visible (bool visible)
214 for (tui_win_info *win_info : all_tui_windows ())
215 win_info->make_visible (visible);
219 tui_make_all_visible (void)
221 make_all_visible (true);
225 tui_make_all_invisible (void)
227 make_all_visible (false);
230 /* See tui-data.h. */
233 tui_source_window_base::refresh_window ()
235 execution_info->refresh_window ();
236 tui_win_info::refresh_window ();
239 /* Function to refresh all the windows currently displayed. */
244 struct tui_locator_window *locator = tui_locator_win_info_ptr ();
246 for (tui_win_info *win_info : all_tui_windows ())
248 if (win_info->is_visible)
249 win_info->refresh_window ();
251 if (locator->is_visible)
252 locator->refresh_window ();
256 /*********************************
257 ** Local Static Functions
258 *********************************/