mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 17:45:09 +00:00
LibGUI: Add Window::center_within(Window)
This allows you to easily center one window within another window.
This commit is contained in:
parent
4a2da10e38
commit
04e3bcfa75
2 changed files with 10 additions and 0 deletions
|
@ -239,6 +239,15 @@ void Window::center_on_screen()
|
|||
set_rect(window_rect);
|
||||
}
|
||||
|
||||
void Window::center_within(const Window& other)
|
||||
{
|
||||
if (this == &other)
|
||||
return;
|
||||
auto window_rect = rect();
|
||||
window_rect.center_within(other.rect());
|
||||
set_rect(window_rect);
|
||||
}
|
||||
|
||||
void Window::set_window_type(WindowType window_type)
|
||||
{
|
||||
m_window_type = window_type;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue