1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 03:57:44 +00:00

LibGUI: Make the calendar widget scrollable

This commit is contained in:
implicitfield 2023-06-20 19:37:28 +04:00 committed by Ali Mohammad Pur
parent 28b5438395
commit e504b63406
3 changed files with 20 additions and 1 deletions

View file

@ -39,6 +39,7 @@ Calendar::Calendar(Core::DateTime date_time, Mode mode)
m_weekend_length = weekend_length;
set_fill_with_background_color(true);
set_scrollbars_enabled(false);
for (int i = 0; i < 7; i++) {
Day day;
@ -777,6 +778,17 @@ void Calendar::mousedown_event(GUI::MouseEvent& event)
}
}
void Calendar::mousewheel_event(GUI::MouseEvent& event)
{
if (event.wheel_delta_y() > 0)
show_next_date();
else
show_previous_date();
if (on_scroll)
on_scroll();
}
void Calendar::doubleclick_event(GUI::MouseEvent& event)
{
int months;