diff options
author | Tom Tromey <tom@tromey.com> | 2019-06-16 10:13:13 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2019-06-25 07:48:24 -0600 |
commit | 33b906abfa7721128791883875d90394f8e2e7c2 (patch) | |
tree | 9a70d1592112232a2d178afe1beea0bc3d28ea58 /gdb/tui/tui-data.h | |
parent | e7e11af42dca6482302833c4106974176aa66052 (diff) | |
download | gdb-33b906abfa7721128791883875d90394f8e2e7c2.zip gdb-33b906abfa7721128791883875d90394f8e2e7c2.tar.gz gdb-33b906abfa7721128791883875d90394f8e2e7c2.tar.bz2 |
Create subclasses for different window types
This changes the TUI so that each different major window type has its
own subclass.
gdb/ChangeLog
2019-06-25 Tom Tromey <tom@tromey.com>
* tui/tui-data.h (struct tui_win_info): Make constructor
protected. Make destructor virtual. Add initializers.
(tui_source_window, tui_data_window, tui_cmd_window): New
classes.
* tui/tui-data.c (tui_win_info): Rename from init_win_info. Now a
constructor. Add "type" parameter.
(tui_source_window, tui_data_window, tui_cmd_window): New
constructors.
(tui_alloc_win_info): Instantiate the appropriate subclass.
Diffstat (limited to 'gdb/tui/tui-data.h')
-rw-r--r-- | gdb/tui/tui-data.h | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h index c5c2c2b..1627625 100644 --- a/gdb/tui/tui-data.h +++ b/gdb/tui/tui-data.h @@ -271,15 +271,15 @@ struct tui_command_info /* This defines information about each logical window. */ struct tui_win_info { - explicit tui_win_info (enum tui_win_type type) - { - generic.type = type; - } - - ~tui_win_info (); +protected: + explicit tui_win_info (enum tui_win_type type); DISABLE_COPY_AND_ASSIGN (tui_win_info); +public: + + virtual ~tui_win_info (); + struct tui_gen_win_info generic; /* General window information. */ union { @@ -288,8 +288,30 @@ struct tui_win_info struct tui_command_info command_info; } detail; - int can_highlight; /* Can this window ever be highlighted? */ - int is_highlighted; /* Is this window highlighted? */ + + /* Can this window ever be highlighted? */ + int can_highlight = 0; + + /* Is this window highlighted? */ + int is_highlighted = 0; +}; + +struct tui_source_window : public tui_win_info +{ + explicit tui_source_window (enum tui_win_type type); + DISABLE_COPY_AND_ASSIGN (tui_source_window); +}; + +struct tui_data_window : public tui_win_info +{ + tui_data_window (); + DISABLE_COPY_AND_ASSIGN (tui_data_window); +}; + +struct tui_cmd_window : public tui_win_info +{ + tui_cmd_window (); + DISABLE_COPY_AND_ASSIGN (tui_cmd_window); }; extern int tui_win_is_source_type (enum tui_win_type win_type); |