Simplify TUI C-x 2 binding
[deliverable/binutils-gdb.git] / gdb / tui / tui-regs.h
1 /* TUI display registers in window.
2
3 Copyright (C) 1998-2020 Free Software Foundation, Inc.
4
5 Contributed by Hewlett-Packard Company.
6
7 This file is part of GDB.
8
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.
13
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.
18
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/>. */
21
22 #ifndef TUI_TUI_REGS_H
23 #define TUI_TUI_REGS_H
24
25 #include "tui/tui-data.h"
26
27 /* A data item window. */
28
29 struct tui_data_item_window : public tui_gen_win_info
30 {
31 tui_data_item_window ()
32 : tui_gen_win_info (DATA_ITEM_WIN)
33 {
34 }
35
36 DISABLE_COPY_AND_ASSIGN (tui_data_item_window);
37
38 tui_data_item_window (tui_data_item_window &&) = default;
39
40 void rerender () override;
41
42 void refresh_window () override;
43
44 int max_height () const override
45 {
46 return 1;
47 }
48
49 int min_height () const override
50 {
51 return 1;
52 }
53
54 const char *name = nullptr;
55 /* The register number, or data display number. */
56 int item_no = -1;
57 bool highlight = false;
58 gdb::unique_xmalloc_ptr<char> content;
59 };
60
61 /* The TUI registers window. */
62 struct tui_data_window : public tui_win_info
63 {
64 tui_data_window ()
65 : tui_win_info (DATA_WIN)
66 {
67 }
68
69 DISABLE_COPY_AND_ASSIGN (tui_data_window);
70
71 void refresh_window () override;
72
73 void no_refresh () override;
74
75 const char *name () const override
76 {
77 return DATA_NAME;
78 }
79
80 void check_register_values (struct frame_info *frame);
81
82 void show_registers (struct reggroup *group);
83
84 struct reggroup *get_current_group () const
85 {
86 return m_current_group;
87 }
88
89 protected:
90
91 void do_scroll_vertical (int num_to_scroll) override;
92 void do_scroll_horizontal (int num_to_scroll) override
93 {
94 }
95
96 void rerender () override;
97
98 private:
99
100 /* Display the registers in the content from 'start_element_no'
101 until the end of the register content or the end of the display
102 height. No checking for displaying past the end of the registers
103 is done here. */
104 void display_registers_from (int start_element_no);
105
106 /* Display the registers starting at line line_no in the data
107 window. Answers the line number that the display actually
108 started from. If nothing is displayed (-1) is returned. */
109 int display_registers_from_line (int line_no);
110
111 /* Return the index of the first element displayed. If none are
112 displayed, then return -1. */
113 int first_data_item_displayed ();
114
115 /* Display the registers in the content from 'start_element_no' on
116 'start_line_no' until the end of the register content or the end
117 of the display height. This function checks that we won't
118 display off the end of the register display. */
119 void display_reg_element_at_line (int start_element_no, int start_line_no);
120
121 void show_register_group (struct reggroup *group,
122 struct frame_info *frame,
123 bool refresh_values_only);
124
125 /* Answer the number of the last line in the regs display. If there
126 are no registers (-1) is returned. */
127 int last_regs_line_no () const;
128
129 /* Answer the line number that the register element at element_no is
130 on. If element_no is greater than the number of register
131 elements there are, -1 is returned. */
132 int line_from_reg_element_no (int element_no) const;
133
134 /* Answer the index of the first element in line_no. If line_no is
135 past the register area (-1) is returned. */
136 int first_reg_element_no_inline (int line_no) const;
137
138 /* Delete all the item windows in the data window. This is usually
139 done when the data window is scrolled. */
140 void delete_data_content_windows ();
141
142 void erase_data_content (const char *prompt);
143
144 /* Windows that are used to display registers. */
145 std::vector<tui_data_item_window> m_regs_content;
146 int m_regs_column_count = 0;
147 struct reggroup *m_current_group = nullptr;
148 };
149
150 #endif /* TUI_TUI_REGS_H */
This page took 0.031612 seconds and 4 git commands to generate.