1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 14:25:08 +00:00

LibGUI: Implement GWindow::rect().

This commit is contained in:
Andreas Kling 2019-02-08 00:13:35 +01:00
parent 2ac697ca09
commit bf766fc12c

View file

@ -103,6 +103,17 @@ String GWindow::title() const
return m_title_when_windowless;
}
Rect GWindow::rect() const
{
if (m_window_id) {
GUI_Rect buffer;
int rc = gui_get_window_rect(m_window_id, &buffer);
ASSERT(rc >= 0);
return buffer;
}
return m_rect_when_windowless;
}
void GWindow::set_rect(const Rect& a_rect)
{
m_rect_when_windowless = a_rect;
@ -191,6 +202,7 @@ void GWindow::set_main_widget(GWidget* widget)
if (m_main_widget == widget)
return;
m_main_widget = widget;
m_main_widget->set_relative_rect({ 0, 0, width(), height() });
if (widget)
widget->set_window(this);
update();