1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:27:45 +00:00

LibGUI+Calendar: Inherit from Frame class

Fixes incorrect painting with variable thickness and cuts down
on some layout boilerplate.
This commit is contained in:
thankyouverycool 2021-04-02 12:13:43 -04:00 committed by Andreas Kling
parent 7d8d45e757
commit 14e074cd24
4 changed files with 46 additions and 62 deletions

View file

@ -139,15 +139,11 @@ ClockWidget::ClockWidget()
auto& separator1 = root_container.add<GUI::HorizontalSeparator>();
separator1.set_fixed_height(2);
auto& calendar_frame_container = root_container.add<GUI::Widget>();
calendar_frame_container.set_layout<GUI::HorizontalBoxLayout>();
calendar_frame_container.layout()->set_margins({ 4, 4, 5, 4 });
auto& calendar_container = root_container.add<GUI::Widget>();
calendar_container.set_layout<GUI::HorizontalBoxLayout>();
calendar_container.layout()->set_margins({ 4, 4, 5, 4 });
auto& calendar_frame = calendar_frame_container.add<GUI::Frame>();
calendar_frame.set_layout<GUI::VerticalBoxLayout>();
calendar_frame.layout()->set_margins({ 2, 2, 2, 2 });
m_calendar = calendar_frame.add<GUI::Calendar>();
m_calendar = calendar_container.add<GUI::Calendar>();
m_selected_calendar_button->set_text(m_calendar->formatted_date());
m_calendar->on_tile_click = [&] {