diff options
author | Paul Gilbert | 2018-10-25 19:03:40 -0700 |
---|---|---|
committer | Paul Gilbert | 2018-12-08 19:05:59 -0800 |
commit | e14424c2b944ae9a9c5ce34158bd5e7e361ee994 (patch) | |
tree | 6ffcb338f879b2f4a0f3db6e0d07d3d3af764d56 | |
parent | 4266f3af130ddeddbed5da9d6c7aa4826ad94d96 (diff) | |
download | scummvm-rg350-e14424c2b944ae9a9c5ce34158bd5e7e361ee994.tar.gz scummvm-rg350-e14424c2b944ae9a9c5ce34158bd5e7e361ee994.tar.bz2 scummvm-rg350-e14424c2b944ae9a9c5ce34158bd5e7e361ee994.zip |
GLK: Adding more window glk methods
-rw-r--r-- | engines/gargoyle/events.h | 9 | ||||
-rw-r--r-- | engines/gargoyle/glk.cpp | 30 | ||||
-rw-r--r-- | engines/gargoyle/window_graphics.cpp | 2 | ||||
-rw-r--r-- | engines/gargoyle/window_graphics.h | 12 | ||||
-rw-r--r-- | engines/gargoyle/window_text_buffer.cpp | 2 | ||||
-rw-r--r-- | engines/gargoyle/window_text_buffer.h | 10 | ||||
-rw-r--r-- | engines/gargoyle/window_text_grid.cpp | 2 | ||||
-rw-r--r-- | engines/gargoyle/window_text_grid.h | 38 | ||||
-rw-r--r-- | engines/gargoyle/windows.cpp | 2 | ||||
-rw-r--r-- | engines/gargoyle/windows.h | 11 |
10 files changed, 85 insertions, 33 deletions
diff --git a/engines/gargoyle/events.h b/engines/gargoyle/events.h index 939e691f78..f49d9ffa1a 100644 --- a/engines/gargoyle/events.h +++ b/engines/gargoyle/events.h @@ -101,6 +101,15 @@ struct Event { * Constructor */ Event() : type(evtype_None), window(nullptr), val1(0), val2(0) {} + + /** + * Clear + */ + void clear() { + type = evtype_None; + window = nullptr; + val1 = val2 = 0; + } }; typedef Event event_t; diff --git a/engines/gargoyle/glk.cpp b/engines/gargoyle/glk.cpp index 43ba646851..c309f727ae 100644 --- a/engines/gargoyle/glk.cpp +++ b/engines/gargoyle/glk.cpp @@ -409,19 +409,35 @@ void Glk::glk_request_char_event(winid_t win) { } void Glk::glk_request_mouse_event(winid_t win) { - // TODO + if (!win) { + warning("request_mouse_event: invalid ref"); + } else { + win->requestMouseEvent(); + } } void Glk::glk_cancel_line_event(winid_t win, event_t *event) { - // TODO + if (!win) { + warning("cancel_line_event: invalid ref"); + } else { + win->cancelLineEvent(event); + } } void Glk::glk_cancel_char_event(winid_t win) { - // TODO + if (!win) { + warning("glk_cancel_char_event: invalid ref"); + } else { + win->cancelCharEvent(); + } } void Glk::glk_cancel_mouse_event(winid_t win) { - // TODO + if (!win) { + warning("cancel_mouse_event: invalid ref"); + } else { + win->cancelMouseEvent(); + } } #ifdef GLK_MODULE_LINE_ECHO @@ -685,7 +701,11 @@ void Glk::glk_set_hyperlink_stream(strid_t str, glui32 linkval) { } void Glk::glk_request_hyperlink_event(winid_t win) { - // TODO + if (!win) { + warning("request_hyperlink_event: invalid ref"); + } else { + win->requestHyperlinkEvent(); + } } void Glk::glk_cancel_hyperlink_event(winid_t win) { diff --git a/engines/gargoyle/window_graphics.cpp b/engines/gargoyle/window_graphics.cpp index 3af2555c3a..0ec2beef18 100644 --- a/engines/gargoyle/window_graphics.cpp +++ b/engines/gargoyle/window_graphics.cpp @@ -244,7 +244,7 @@ void GraphicsWindow::drawPicture(Picture *src, int x0, int y0, int width, int h _surface->blitFrom(*g_vm->_screen, Common::Rect(sx0, sy0, sx0 + w, sy0 + h), Common::Point(0, 0)); } -void GraphicsWindow::getSize(glui32 *width, glui32 *height) { +void GraphicsWindow::getSize(glui32 *width, glui32 *height) const { *width = _bbox.width(); *height = _bbox.height(); } diff --git a/engines/gargoyle/window_graphics.h b/engines/gargoyle/window_graphics.h index 5d08125697..166b03a4f2 100644 --- a/engines/gargoyle/window_graphics.h +++ b/engines/gargoyle/window_graphics.h @@ -55,6 +55,9 @@ public: */ virtual ~GraphicsWindow(); + glui32 drawPicture(glui32 image, glsi32 xpos, glsi32 ypos, int scale, + glui32 imagewidth, glui32 imageheight); + /** * Rearranges the window */ @@ -77,15 +80,16 @@ public: */ virtual void cancelHyperlinkEvent() override { _hyperRequest = false; } + virtual void requestMouseEvent() override { _mouseRequest = true; } + + virtual void requestHyperlinkEvent() override { _hyperRequest = true; } + /** * Redraw the window */ virtual void redraw() override; - virtual void getSize(glui32 *width, glui32 *height) override; - - glui32 drawPicture(glui32 image, glsi32 xpos, glsi32 ypos, int scale, - glui32 imagewidth, glui32 imageheight); + virtual void getSize(glui32 *width, glui32 *height) const override; }; } // End of namespace Gargoyle diff --git a/engines/gargoyle/window_text_buffer.cpp b/engines/gargoyle/window_text_buffer.cpp index 43688834e0..c428dac516 100644 --- a/engines/gargoyle/window_text_buffer.cpp +++ b/engines/gargoyle/window_text_buffer.cpp @@ -1633,7 +1633,7 @@ void TextBufferWindow::copyTextToClipboard(const glui32 *text, size_t len) { // TODO } -void TextBufferWindow::getSize(glui32 *width, glui32 *height) { +void TextBufferWindow::getSize(glui32 *width, glui32 *height) const { if (width) *width = (_bbox.width() - g_conf->_tMarginX * 2) / g_conf->_cellW; if (height) diff --git a/engines/gargoyle/window_text_buffer.h b/engines/gargoyle/window_text_buffer.h index 094d6d0eec..774bd66221 100644 --- a/engines/gargoyle/window_text_buffer.h +++ b/engines/gargoyle/window_text_buffer.h @@ -147,6 +147,10 @@ public: */ virtual ~TextBufferWindow(); + int acceptScroll(glui32 arg); + + glui32 drawPicture(glui32 image, glui32 align, glui32 scaled, glui32 width, glui32 height); + /** * Rearranges the window */ @@ -206,7 +210,7 @@ public: virtual void acceptReadChar(glui32 arg) override; - virtual void getSize(glui32 *width, glui32 *height) override; + virtual void getSize(glui32 *width, glui32 *height) const override; virtual void requestCharEvent() override { _charRequest = true; } @@ -214,9 +218,9 @@ public: virtual void setEchoLineEvent(glui32 val) override { _echoLineInput = val != 0; } - int acceptScroll(glui32 arg); + virtual void requestHyperlinkEvent() override { _hyperRequest = true; } - glui32 drawPicture(glui32 image, glui32 align, glui32 scaled, glui32 width, glui32 height); + virtual void cancelCharEvent() override { _charRequest = _charRequestUni = false; } }; } // End of namespace Gargoyle diff --git a/engines/gargoyle/window_text_grid.cpp b/engines/gargoyle/window_text_grid.cpp index b249223712..01c31937c9 100644 --- a/engines/gargoyle/window_text_grid.cpp +++ b/engines/gargoyle/window_text_grid.cpp @@ -645,7 +645,7 @@ void TextGridWindow::redraw() { } } -void TextGridWindow::getSize(glui32 *width, glui32 *height) { +void TextGridWindow::getSize(glui32 *width, glui32 *height) const { if (width) *width = _bbox.width() / g_conf->_cellW; if (height) diff --git a/engines/gargoyle/window_text_grid.h b/engines/gargoyle/window_text_grid.h index 17fa96f5cc..9ff588b82e 100644 --- a/engines/gargoyle/window_text_grid.h +++ b/engines/gargoyle/window_text_grid.h @@ -123,6 +123,24 @@ public: virtual void click(const Common::Point &newPos) override; /** + * Cancel a hyperlink event + */ + virtual void cancelHyperlinkEvent() override { _hyperRequest = false; } + + /** + * Redraw the window + */ + virtual void redraw() override; + + virtual void acceptReadLine(glui32 arg) override; + + virtual void acceptReadChar(glui32 arg) override; + + virtual void getSize(glui32 *width, glui32 *height) const override; + + virtual void requestCharEvent() override { _charRequest = true; } + + /** * Prepare for inputing a line */ virtual void requestLineEvent(char *buf, glui32 maxlen, glui32 initlen) override; @@ -142,25 +160,13 @@ public: */ virtual void cancelMouseEvent() override { _mouseRequest = false; } - /** - * Cancel a hyperlink event - */ - virtual void cancelHyperlinkEvent() override { _hyperRequest = false; } - - /** - * Redraw the window - */ - virtual void redraw() override; - - virtual void acceptReadLine(glui32 arg) override; - - virtual void acceptReadChar(glui32 arg) override; + virtual void requestCharEventUni() override { _charRequestUni = true; } - virtual void getSize(glui32 *width, glui32 *height) override; + virtual void requestMouseEvent() override { _mouseRequest = true; } - virtual void requestCharEvent() override { _charRequest = true; } + virtual void requestHyperlinkEvent() override { _hyperRequest = true; } - virtual void requestCharEventUni() override { _charRequestUni = true; } + virtual void cancelCharEvent() override { _charRequest = _charRequestUni = false; } }; } // End of namespace Gargoyle diff --git a/engines/gargoyle/windows.cpp b/engines/gargoyle/windows.cpp index 7c5b259aba..cc23e477d8 100644 --- a/engines/gargoyle/windows.cpp +++ b/engines/gargoyle/windows.cpp @@ -531,7 +531,7 @@ bool Window::imageDraw(glui32 image, glui32 align, glsi32 val1, glsi32 val2) { return false; } -void Window::getSize(glui32 *width, glui32 *height) { +void Window::getSize(glui32 *width, glui32 *height) const { if (width) *width = 0; if (height) diff --git a/engines/gargoyle/windows.h b/engines/gargoyle/windows.h index 3c419e5604..b7d701f1f9 100644 --- a/engines/gargoyle/windows.h +++ b/engines/gargoyle/windows.h @@ -344,6 +344,11 @@ public: virtual void cancelLineEvent(Event *ev); /** + * Cancel a character event + */ + virtual void cancelCharEvent() {} + + /** * Cancel a mouse event */ virtual void cancelMouseEvent() {} @@ -374,13 +379,17 @@ public: virtual void setArrangement(glui32 method, glui32 size, Window *keyWin); - virtual void getSize(glui32 *width, glui32 *height); + virtual void getSize(glui32 *width, glui32 *height) const; virtual void requestCharEvent(); virtual void requestCharEventUni(); virtual void setEchoLineEvent(glui32 val) {} + + virtual void requestMouseEvent() {} + + virtual void requestHyperlinkEvent() {} }; typedef Window *winid_t; |