#include "tui/tui-data.h"
/* The TUI command window. */
-struct tui_cmd_window : public tui_win_info
+struct tui_cmd_window
+ : public tui_noscroll_window, tui_nobox_window, tui_norefresh_window,
+ tui_always_visible_window
{
tui_cmd_window () = default;
DISABLE_COPY_AND_ASSIGN (tui_cmd_window);
- void refresh_window () override
- {
- }
-
const char *name () const override
{
return CMD_NAME;
}
- bool can_scroll () const override
- {
- return false;
- }
-
- bool can_box () const override
- {
- return false;
- }
-
void resize (int height, int width, int origin_x, int origin_y) override;
- void make_visible (bool visible) override
- {
- /* The command window can't be made invisible. */
- }
-
int start_line = 0;
-
-protected:
-
- void do_scroll_vertical (int num_to_scroll) override
- {
- }
-
- void do_scroll_horizontal (int num_to_scroll) override
- {
- }
};
/* Refresh the command window. */
#include "tui/tui.h"
#include "gdb_curses.h"
#include "observable.h"
+#include "gdbsupport/gdb-checked-static-cast.h"
/* A deleter that calls delwin. */
struct curses_deleter
std::string m_title;
};
+/* A TUI window that doesn't scroll. */
+
+struct tui_noscroll_window : public virtual tui_win_info
+{
+public:
+ virtual bool can_scroll () const final override
+ {
+ return false;
+ }
+
+protected:
+ virtual void do_scroll_vertical (int num_to_scroll) final override
+ {
+ }
+
+ /* Scroll the contents horizontally. This is only called via
+ left_scroll and right_scroll. */
+ virtual void do_scroll_horizontal (int num_to_scroll) final override
+ {
+ }
+};
+
+/* A TUI window that cannot have focus. */
+
+struct tui_nofocus_window : public virtual tui_win_info
+{
+public:
+ virtual bool can_focus () const final override
+ {
+ return false;
+ }
+};
+
+/* A TUI window that occupies a single line. */
+
+struct tui_oneline_window : public virtual tui_win_info
+{
+ int max_height () const final override
+ {
+ return 1;
+ }
+
+ int min_height () const final override
+ {
+ return 1;
+ }
+};
+
+/* A TUI window that has no border. */
+
+struct tui_nobox_window : public virtual tui_win_info
+{
+ bool can_box () const final override
+ {
+ return false;
+ }
+};
+
+/* A TUI window that is not refreshed. */
+
+struct tui_norefresh_window : public virtual tui_win_info
+{
+ virtual void refresh_window () final override
+ {
+ }
+};
+
+/* A TUI window that is always visible. */
+
+struct tui_always_visible_window : public virtual tui_win_info
+{
+ virtual void make_visible (bool visible) final override
+ {
+ }
+};
+
/* Constant definitions. */
#define SRC_NAME "src"
#define CMD_NAME "cmd"
/* Global Data. */
extern struct tui_win_info *tui_win_list[MAX_MAJOR_WINDOWS];
-#define TUI_SRC_WIN ((tui_source_window *) tui_win_list[SRC_WIN])
-#define TUI_DISASM_WIN ((tui_disasm_window *) tui_win_list[DISASSEM_WIN])
-#define TUI_DATA_WIN ((tui_data_window *) tui_win_list[DATA_WIN])
-#define TUI_CMD_WIN ((tui_cmd_window *) tui_win_list[CMD_WIN])
-#define TUI_STATUS_WIN ((tui_locator_window *) tui_win_list[STATUS_WIN])
+#define TUI_SRC_WIN \
+ (gdb::checked_static_cast<tui_source_window *> (tui_win_list[SRC_WIN]))
+#define TUI_DISASM_WIN \
+ (gdb::checked_static_cast<tui_disasm_window *> (tui_win_list[DISASSEM_WIN]))
+#define TUI_DATA_WIN \
+ (gdb::checked_static_cast<tui_data_window *> (tui_win_list[DATA_WIN]))
+#define TUI_CMD_WIN \
+ (gdb::checked_static_cast<tui_cmd_window *> (tui_win_list[CMD_WIN]))
+#define TUI_STATUS_WIN \
+ (gdb::checked_static_cast<tui_locator_window *> (tui_win_list[STATUS_WIN]))
/* All the windows that are currently instantiated, in layout
order. */
/* Locator window class. */
-struct tui_locator_window : public tui_win_info
+struct tui_locator_window
+ : public tui_nofocus_window, tui_noscroll_window, tui_oneline_window,
+ tui_nobox_window
{
tui_locator_window () = default;
return STATUS_NAME;
}
- int max_height () const override
- {
- return 1;
- }
-
- int min_height () const override
- {
- return 1;
- }
-
- bool can_box () const override
- {
- return false;
- }
-
- bool can_focus () const override
- {
- return false;
- }
-
void rerender () override;
-protected:
-
- void do_scroll_vertical (int n) override
- {
- }
-
- void do_scroll_horizontal (int n) override
- {
- }
-
private:
/* Create the status line to display as much information as we can