mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 00:08: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
|
@ -28,6 +28,9 @@ void GObject::event(GEvent& event)
|
|||
case GEvent::DeferredDestroy:
|
||||
delete this;
|
||||
break;
|
||||
case GEvent::ChildAdded:
|
||||
case GEvent::ChildRemoved:
|
||||
return child_event(static_cast<GChildEvent&>(event));
|
||||
case GEvent::Invalid:
|
||||
ASSERT_NOT_REACHED();
|
||||
break;
|
||||
|
@ -39,6 +42,7 @@ void GObject::event(GEvent& event)
|
|||
void GObject::add_child(GObject& object)
|
||||
{
|
||||
m_children.append(&object);
|
||||
GEventLoop::main().post_event(*this, make<GChildEvent>(GEvent::ChildAdded, object));
|
||||
}
|
||||
|
||||
void GObject::remove_child(GObject& object)
|
||||
|
@ -46,6 +50,7 @@ void GObject::remove_child(GObject& object)
|
|||
for (ssize_t i = 0; i < m_children.size(); ++i) {
|
||||
if (m_children[i] == &object) {
|
||||
m_children.remove(i);
|
||||
GEventLoop::main().post_event(*this, make<GChildEvent>(GEvent::ChildRemoved, object));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -55,6 +60,10 @@ void GObject::timer_event(GTimerEvent&)
|
|||
{
|
||||
}
|
||||
|
||||
void GObject::child_event(GChildEvent&)
|
||||
{
|
||||
}
|
||||
|
||||
void GObject::start_timer(int ms)
|
||||
{
|
||||
if (m_timer_id) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue