mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:48:11 +00:00
LibGUI: Add a GStackWidget for many widgets sharing a single location.
Call set_active_widget(GWidget*) to put a new widget on top.
This commit is contained in:
parent
ab92252ee6
commit
497300c492
10 changed files with 157 additions and 5 deletions
|
@ -91,6 +91,8 @@ void GWidget::handle_paint_event(GPaintEvent& event)
|
|||
paint_event(event);
|
||||
for (auto* ch : children()) {
|
||||
auto* child = (GWidget*)ch;
|
||||
if (!child->is_visible())
|
||||
continue;
|
||||
if (child->relative_rect().intersects(event.rect())) {
|
||||
auto local_rect = event.rect();
|
||||
local_rect.intersect(child->relative_rect());
|
||||
|
@ -303,3 +305,14 @@ void GWidget::invalidate_layout()
|
|||
return;
|
||||
w->main_widget()->do_layout();
|
||||
}
|
||||
|
||||
void GWidget::set_visible(bool visible)
|
||||
{
|
||||
if (visible == m_visible)
|
||||
return;
|
||||
m_visible = visible;
|
||||
if (auto* parent = parent_widget())
|
||||
parent->invalidate_layout();
|
||||
if (m_visible)
|
||||
update();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue