diff options
-rw-r--r-- | engines/glk/utils.h | 9 | ||||
-rw-r--r-- | engines/glk/windows.cpp | 18 | ||||
-rw-r--r-- | engines/glk/windows.h | 10 |
3 files changed, 37 insertions, 0 deletions
diff --git a/engines/glk/utils.h b/engines/glk/utils.h index 0da981abe3..636a12962e 100644 --- a/engines/glk/utils.h +++ b/engines/glk/utils.h @@ -67,6 +67,15 @@ public: return -1; } + + /** + * Remove an item from an array by value + */ + void remove(T val) { + int index = indexOf(val); + if (index != -1) + Common::Array<T>::remove_at(index); + } }; /** diff --git a/engines/glk/windows.cpp b/engines/glk/windows.cpp index 7b6833ff59..32f2868b7e 100644 --- a/engines/glk/windows.cpp +++ b/engines/glk/windows.cpp @@ -735,6 +735,24 @@ void Window::getSize(uint *width, uint *height) const { *height = 0; } +void Window::bringToFront() { + PairWindow *pairWin = dynamic_cast<PairWindow *>(_parent); + + if (pairWin && pairWin->_dir == winmethod_Arbitrary && pairWin->_children.back() != this) { + pairWin->_children.remove(this); + pairWin->_children.push_back(this); + } +} + +void Window::sendToBack() { + PairWindow *pairWin = dynamic_cast<PairWindow *>(_parent); + + if (pairWin && pairWin->_dir == winmethod_Arbitrary && pairWin->_children.front() != this) { + pairWin->_children.remove(this); + pairWin->_children.insert_at(0, this); + } +} + /*--------------------------------------------------------------------------*/ BlankWindow::BlankWindow(Windows *windows, uint rock) : Window(windows, rock) { diff --git a/engines/glk/windows.h b/engines/glk/windows.h index f3edbb2069..8d713036e7 100644 --- a/engines/glk/windows.h +++ b/engines/glk/windows.h @@ -581,6 +581,16 @@ public: * Returns a pointer to the styles for the window */ virtual const WindowStyle *getStyles() const; + + /** + * In arbitrary window positioning mode, brings a window to the front of all other windows + */ + void bringToFront(); + + /** + * In arbitrary window positioning mode, sends a window to the back of all other windows + */ + void sendToBack(); }; typedef Window *winid_t; |