Commit | Line | Data |
---|---|---|
f377b406 | 1 | /* TUI display registers in window. |
55fb0713 | 2 | |
88b9d363 | 3 | Copyright (C) 1998-2022 Free Software Foundation, Inc. |
55fb0713 | 4 | |
f377b406 SC |
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 | |
a9762ec7 | 11 | the Free Software Foundation; either version 3 of the License, or |
f377b406 SC |
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 | |
a9762ec7 | 20 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
f377b406 | 21 | |
1a5c2598 TT |
22 | #ifndef TUI_TUI_REGS_H |
23 | #define TUI_TUI_REGS_H | |
c906108c | 24 | |
18ab23af TT |
25 | #include "tui/tui-data.h" |
26 | ||
96bd6233 TT |
27 | /* A data item window. */ |
28 | ||
7134f2eb | 29 | struct tui_data_item_window |
96bd6233 | 30 | { |
fdb01f0c | 31 | tui_data_item_window () = default; |
96bd6233 | 32 | |
fa4dc567 TT |
33 | DISABLE_COPY_AND_ASSIGN (tui_data_item_window); |
34 | ||
35 | tui_data_item_window (tui_data_item_window &&) = default; | |
36 | ||
7134f2eb | 37 | void rerender (WINDOW *handle, int field_width); |
dc7ff8a6 | 38 | |
7134f2eb TT |
39 | /* Location. */ |
40 | int x = 0; | |
41 | int y = 0; | |
22b7b041 TT |
42 | /* The register number. */ |
43 | int regno = -1; | |
96bd6233 | 44 | bool highlight = false; |
7134f2eb | 45 | bool visible = false; |
7a02bab7 | 46 | std::string content; |
96bd6233 TT |
47 | }; |
48 | ||
18ab23af TT |
49 | /* The TUI registers window. */ |
50 | struct tui_data_window : public tui_win_info | |
51 | { | |
fdb01f0c | 52 | tui_data_window () = default; |
18ab23af TT |
53 | |
54 | DISABLE_COPY_AND_ASSIGN (tui_data_window); | |
55 | ||
18ab23af TT |
56 | const char *name () const override |
57 | { | |
58 | return DATA_NAME; | |
59 | } | |
60 | ||
04c72a68 | 61 | void check_register_values (struct frame_info *frame); |
18ab23af | 62 | |
04c72a68 | 63 | void show_registers (struct reggroup *group); |
18ab23af | 64 | |
89df7f90 TT |
65 | struct reggroup *get_current_group () const |
66 | { | |
80df3337 | 67 | return m_current_group; |
89df7f90 TT |
68 | } |
69 | ||
04c72a68 | 70 | protected: |
18ab23af | 71 | |
04c72a68 TT |
72 | void do_scroll_vertical (int num_to_scroll) override; |
73 | void do_scroll_horizontal (int num_to_scroll) override | |
74 | { | |
75 | } | |
18ab23af | 76 | |
04c72a68 | 77 | void rerender () override; |
18ab23af | 78 | |
04c72a68 | 79 | private: |
18ab23af TT |
80 | |
81 | /* Display the registers in the content from 'start_element_no' | |
82 | until the end of the register content or the end of the display | |
83 | height. No checking for displaying past the end of the registers | |
84 | is done here. */ | |
85 | void display_registers_from (int start_element_no); | |
86 | ||
87 | /* Display the registers starting at line line_no in the data | |
88 | window. Answers the line number that the display actually | |
89 | started from. If nothing is displayed (-1) is returned. */ | |
90 | int display_registers_from_line (int line_no); | |
91 | ||
18ab23af TT |
92 | /* Return the index of the first element displayed. If none are |
93 | displayed, then return -1. */ | |
94 | int first_data_item_displayed (); | |
95 | ||
96 | /* Display the registers in the content from 'start_element_no' on | |
97 | 'start_line_no' until the end of the register content or the end | |
98 | of the display height. This function checks that we won't | |
99 | display off the end of the register display. */ | |
100 | void display_reg_element_at_line (int start_element_no, int start_line_no); | |
3df505f6 | 101 | |
ca02d7c8 TT |
102 | void show_register_group (struct reggroup *group, |
103 | struct frame_info *frame, | |
b5457826 | 104 | bool refresh_values_only); |
04c72a68 TT |
105 | |
106 | /* Answer the number of the last line in the regs display. If there | |
107 | are no registers (-1) is returned. */ | |
108 | int last_regs_line_no () const; | |
109 | ||
110 | /* Answer the line number that the register element at element_no is | |
111 | on. If element_no is greater than the number of register | |
112 | elements there are, -1 is returned. */ | |
113 | int line_from_reg_element_no (int element_no) const; | |
114 | ||
115 | /* Answer the index of the first element in line_no. If line_no is | |
116 | past the register area (-1) is returned. */ | |
117 | int first_reg_element_no_inline (int line_no) const; | |
118 | ||
04c72a68 TT |
119 | /* Delete all the item windows in the data window. This is usually |
120 | done when the data window is scrolled. */ | |
121 | void delete_data_content_windows (); | |
122 | ||
123 | void erase_data_content (const char *prompt); | |
89df7f90 TT |
124 | |
125 | /* Windows that are used to display registers. */ | |
80df3337 TT |
126 | std::vector<tui_data_item_window> m_regs_content; |
127 | int m_regs_column_count = 0; | |
128 | struct reggroup *m_current_group = nullptr; | |
7134f2eb TT |
129 | |
130 | /* Width of each register's display area. */ | |
131 | int m_item_width = 0; | |
ca02d7c8 | 132 | }; |
c906108c | 133 | |
1a5c2598 | 134 | #endif /* TUI_TUI_REGS_H */ |