LibCore+LibGUI: Add is<T>(CObject&) and to<T>(CObject&) helpers.

This commit is contained in:
Andreas Kling 2019-05-27 04:06:01 +02:00
parent 723ba91f74
commit 0c85d3dba9
Notes: sideshowbarker 2024-07-19 13:55:24 +09:00
5 changed files with 53 additions and 30 deletions

View file

@ -50,9 +50,9 @@ Rect GTabWidget::child_rect_for_size(const Size& size) const
void GTabWidget::child_event(CChildEvent& event)
{
if (!event.child() || !event.child()->is_widget())
if (!event.child() || !is<GWidget>(*event.child()))
return GWidget::child_event(event);
auto& child = static_cast<GWidget&>(*event.child());
auto& child = to<GWidget>(*event.child());
if (event.type() == GEvent::ChildAdded) {
if (!m_active_widget)
set_active_widget(&child);