mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:57:43 +00:00
LibGUI: Add FontsChanged event and deliver it to windows and widgets
This commit is contained in:
parent
9318d9f284
commit
b40d771512
7 changed files with 39 additions and 0 deletions
|
@ -511,6 +511,21 @@ void Window::handle_theme_change_event(ThemeChangeEvent& event)
|
|||
dispatch_theme_change(*m_main_widget.ptr(), dispatch_theme_change);
|
||||
}
|
||||
|
||||
void Window::handle_fonts_change_event(FontsChangeEvent& event)
|
||||
{
|
||||
if (!m_main_widget)
|
||||
return;
|
||||
auto dispatch_fonts_change = [&](auto& widget, auto recursive) {
|
||||
widget.dispatch_event(event, this);
|
||||
widget.for_each_child_widget([&](auto& widget) -> IterationDecision {
|
||||
widget.dispatch_event(event, this);
|
||||
recursive(widget, recursive);
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
};
|
||||
dispatch_fonts_change(*m_main_widget.ptr(), dispatch_fonts_change);
|
||||
}
|
||||
|
||||
void Window::handle_screen_rects_change_event(ScreenRectsChangeEvent& event)
|
||||
{
|
||||
if (!m_main_widget)
|
||||
|
@ -594,6 +609,9 @@ void Window::event(Core::Event& event)
|
|||
if (event.type() == Event::ThemeChange)
|
||||
return handle_theme_change_event(static_cast<ThemeChangeEvent&>(event));
|
||||
|
||||
if (event.type() == Event::FontsChange)
|
||||
return handle_fonts_change_event(static_cast<FontsChangeEvent&>(event));
|
||||
|
||||
if (event.type() == Event::ScreenRectsChange)
|
||||
return handle_screen_rects_change_event(static_cast<ScreenRectsChangeEvent&>(event));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue