diff --git a/SDL2pp/Window.cc b/SDL2pp/Window.cc index 9be1fcb..dd51309 100644 --- a/SDL2pp/Window.cc +++ b/SDL2pp/Window.cc @@ -265,6 +265,14 @@ Window& Window::SetResizable(bool resizable) { return *this; } +Window& Window::SetModal(Window& parent) { + if (SDL_SetWindowModalFor(window_, parent.window_) != 0) { + throw SDL2pp::Exception("SDL_SetWindowModalFor"); + } + + return *this; +} + Window::Borders Window::GetBordersSize() const { int top = 0, left = 0, bottom = 0, right = 0; diff --git a/SDL2pp/Window.hh b/SDL2pp/Window.hh index bfbddee..e8d1ed3 100644 --- a/SDL2pp/Window.hh +++ b/SDL2pp/Window.hh @@ -578,6 +578,20 @@ public: /// //////////////////////////////////////////////////////////// Window& SetResizable(bool resizable = true); + + //////////////////////////////////////////////////////////// + /// \brief Sets the modal to the parent window + /// + /// \param[in] parent The window that should be the parent + /// + /// \returns Reference to self + /// + /// \throws SDL2pp::Exception + /// + /// \see https://wiki.libsdl.org/SDL_SetWindowModalFor + /// + //////////////////////////////////////////////////////////// + Window &SetModal(Window& parent); //////////////////////////////////////////////////////////// /// \brief Read only data structure to represent the size borders of a window