mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:07:35 +00:00
Calendar: Move MonthListModel into Calendar.h
Previously, we had two versions of MonthListModel for the AddEventDialog and the DatePickerDialog. Now, a unified version is in the Calendar.h file, which can be used easily by anyone. Since that model and the MeridiemListModel weren't used anymore in the AddEventDialog, I have also removed them from there.
This commit is contained in:
parent
5ed334e13a
commit
039114b728
5 changed files with 91 additions and 55 deletions
33
Userland/Libraries/LibGUI/DatePicker.h
Normal file
33
Userland/Libraries/LibGUI/DatePicker.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) 2023, David Ganz <david.g.ganz@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/DateTime.h>
|
||||
#include <LibGUI/Calendar.h>
|
||||
#include <LibGUI/Dialog.h>
|
||||
#include <LibGUI/Model.h>
|
||||
|
||||
namespace GUI {
|
||||
|
||||
class DatePicker : public Dialog {
|
||||
C_OBJECT(DatePicker)
|
||||
|
||||
public:
|
||||
virtual ~DatePicker() override = default;
|
||||
|
||||
static Optional<Core::DateTime> show(Window* parent_window, String title, Core::DateTime focused_date = Core::DateTime::now());
|
||||
|
||||
private:
|
||||
explicit DatePicker(Window* parent_window, String const& title, Core::DateTime focused_date = Core::DateTime::now());
|
||||
|
||||
Core::DateTime m_selected_date;
|
||||
RefPtr<ComboBox> m_month_box;
|
||||
RefPtr<SpinBox> m_year_box;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue