diff --git a/SDL2pp/Window.cc b/SDL2pp/Window.cc index 9417094..900ae48 100644 --- a/SDL2pp/Window.cc +++ b/SDL2pp/Window.cc @@ -264,6 +264,24 @@ Window& Window::SetResizable(bool resizable) { SDL_SetWindowResizable(window_, resizable ? SDL_TRUE : SDL_FALSE); 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; + + if (SDL_GetWindowBordersSize(window_, &top, &left, &bottom, &right) != 0) { + throw SDL2pp::Exception("SDL_GetWindowBordersSize"); + } + + return Borders{ top, left, bottom, right }; +} #endif } diff --git a/SDL2pp/Window.hh b/SDL2pp/Window.hh index 4ebf000..139b630 100644 --- a/SDL2pp/Window.hh +++ b/SDL2pp/Window.hh @@ -578,6 +578,64 @@ 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 + /// + /// \ingroup windows + /// + //////////////////////////////////////////////////////////// + struct Borders { + //////////////////////////////////////////////////////////// + /// \brief The size of the top border of a window + /// + //////////////////////////////////////////////////////////// + const int Top; + + //////////////////////////////////////////////////////////// + /// \brief The size of the left border of a window + /// + //////////////////////////////////////////////////////////// + const int Left; + + //////////////////////////////////////////////////////////// + /// \brief The size of the bottom border of a window + /// + //////////////////////////////////////////////////////////// + const int Bottom; + + //////////////////////////////////////////////////////////// + /// \brief The size of the right border of a window + /// + //////////////////////////////////////////////////////////// + const int Right; + }; + + //////////////////////////////////////////////////////////// + /// \brief Get the size of the borders (decorations) around the window + /// + /// \returns An object with the size of each border of the window + /// + /// \throws SDL2pp::Exception + /// + /// \see https://wiki.libsdl.org/SDL_GetWindowBordersSize + /// + //////////////////////////////////////////////////////////// + Borders GetBordersSize() const; #endif };