Merge b1f4de7446148c35fccdd14168e1f2102b5254a3 into b00d3b9eb98be4fa2eca7ae9d88f96d28796e4f0

This commit is contained in:
Vraiment 2025-04-14 06:21:20 +00:00 committed by GitHub
commit 75d007236b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 76 additions and 0 deletions

View File

@ -264,6 +264,24 @@ Window& Window::SetResizable(bool resizable) {
SDL_SetWindowResizable(window_, resizable ? SDL_TRUE : SDL_FALSE); SDL_SetWindowResizable(window_, resizable ? SDL_TRUE : SDL_FALSE);
return *this; 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 #endif
} }

View File

@ -578,6 +578,64 @@ public:
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Window& SetResizable(bool resizable = true); 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 #endif
}; };