From 8a51f305335810d52d3633f8b1cc910b84c5f0e6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 4 Aug 2019 14:40:01 -0700 Subject: GLK: Create an intermediate TextWindow base class for text windows This will make it easier to check whether a window is textual without having to check for both the grid & buffer classes explicitly --- engines/glk/window_text_buffer.cpp | 2 +- engines/glk/window_text_buffer.h | 2 +- engines/glk/window_text_grid.cpp | 2 +- engines/glk/window_text_grid.h | 2 +- engines/glk/windows.h | 11 +++++++++++ 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/engines/glk/window_text_buffer.cpp b/engines/glk/window_text_buffer.cpp index b182643644..6c312be607 100644 --- a/engines/glk/window_text_buffer.cpp +++ b/engines/glk/window_text_buffer.cpp @@ -36,7 +36,7 @@ namespace Glk { #define SLOP (2 * GLI_SUBPIX) -TextBufferWindow::TextBufferWindow(Windows *windows, uint rock) : Window(windows, rock), +TextBufferWindow::TextBufferWindow(Windows *windows, uint rock) : TextWindow(windows, rock), _font(g_conf->_propInfo), _historyPos(0), _historyFirst(0), _historyPresent(0), _lastSeen(0), _scrollPos(0), _scrollMax(0), _scrollBack(SCROLLBACK), _width(-1), _height(-1), _inBuf(nullptr), _lineTerminators(nullptr), _echoLineInput(true), _ladjw(0), _radjw(0), diff --git a/engines/glk/window_text_buffer.h b/engines/glk/window_text_buffer.h index 9020c1a871..2e1e2ff653 100644 --- a/engines/glk/window_text_buffer.h +++ b/engines/glk/window_text_buffer.h @@ -35,7 +35,7 @@ namespace Glk { /** * Text Buffer window */ -class TextBufferWindow : public Window, Speech { +class TextBufferWindow : public TextWindow, Speech { /** * Structure for a row within the window */ diff --git a/engines/glk/window_text_grid.cpp b/engines/glk/window_text_grid.cpp index 226b2f1acd..fb5a3a4bc6 100644 --- a/engines/glk/window_text_grid.cpp +++ b/engines/glk/window_text_grid.cpp @@ -28,7 +28,7 @@ namespace Glk { -TextGridWindow::TextGridWindow(Windows *windows, uint rock) : Window(windows, rock), +TextGridWindow::TextGridWindow(Windows *windows, uint rock) : TextWindow(windows, rock), _font(g_conf->_monoInfo) { _type = wintype_TextGrid; _width = _height = 0; diff --git a/engines/glk/window_text_grid.h b/engines/glk/window_text_grid.h index de64ab3801..c9c4b0364c 100644 --- a/engines/glk/window_text_grid.h +++ b/engines/glk/window_text_grid.h @@ -31,7 +31,7 @@ namespace Glk { /** * Text Grid window */ -class TextGridWindow : public Window { +class TextGridWindow : public TextWindow { /** * Structure for a row within the grid window */ diff --git a/engines/glk/windows.h b/engines/glk/windows.h index 1974b3e4a4..f3edbb2069 100644 --- a/engines/glk/windows.h +++ b/engines/glk/windows.h @@ -595,6 +595,17 @@ public: BlankWindow(Windows *windows, uint rock); }; +/** + * Abstract common base for the text window classes + */ +class TextWindow : public Window { +public: + /** + * Constructor + */ + TextWindow(Windows *windows, uint rock) : Window(windows, rock) {} +}; + } // End of namespace Glk #endif -- cgit v1.2.3