DatePicker.h 767 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * Copyright (c) 2023, David Ganz <david.g.ganz@gmail.com>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/String.h>
  8. #include <LibCore/DateTime.h>
  9. #include <LibGUI/Calendar.h>
  10. #include <LibGUI/Dialog.h>
  11. #include <LibGUI/Model.h>
  12. namespace GUI {
  13. class DatePicker : public Dialog {
  14. C_OBJECT(DatePicker)
  15. public:
  16. virtual ~DatePicker() override = default;
  17. static Optional<Core::DateTime> show(Window* parent_window, String title, Core::DateTime focused_date = Core::DateTime::now());
  18. private:
  19. explicit DatePicker(Window* parent_window, String const& title, Core::DateTime focused_date = Core::DateTime::now());
  20. Core::DateTime m_selected_date;
  21. RefPtr<ComboBox> m_month_box;
  22. RefPtr<SpinBox> m_year_box;
  23. };
  24. }