mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:37:36 +00:00
LibGUI+Calendar: Move date control logic to the calendar widget
This commit is contained in:
parent
c625ba34fe
commit
9a1018389c
4 changed files with 39 additions and 48 deletions
|
@ -82,6 +82,38 @@ void Calendar::toggle_mode()
|
|||
invalidate_layout();
|
||||
}
|
||||
|
||||
void Calendar::show_previous_date()
|
||||
{
|
||||
unsigned view_month = m_view_month;
|
||||
unsigned view_year = m_view_year;
|
||||
if (m_mode == GUI::Calendar::Month) {
|
||||
--view_month;
|
||||
if (view_month == 0) {
|
||||
view_month = 12;
|
||||
--view_year;
|
||||
}
|
||||
} else {
|
||||
--view_year;
|
||||
}
|
||||
update_tiles(view_year, view_month);
|
||||
}
|
||||
|
||||
void Calendar::show_next_date()
|
||||
{
|
||||
unsigned view_month = m_view_month;
|
||||
unsigned view_year = m_view_year;
|
||||
if (m_mode == GUI::Calendar::Month) {
|
||||
++view_month;
|
||||
if (view_month == 13) {
|
||||
view_month = 1;
|
||||
++view_year;
|
||||
}
|
||||
} else {
|
||||
++view_year;
|
||||
}
|
||||
update_tiles(view_year, view_month);
|
||||
}
|
||||
|
||||
void Calendar::resize_event(GUI::ResizeEvent& event)
|
||||
{
|
||||
m_event_size.set_width(event.size().width() - (frame_thickness() * 2));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue