// SPDX-License-Identifier: GPL-3.0-only // Season calendar screen (July to June grid) including the reschedule-match mode. // CalendarScreen renders a CalendarState (built in calendar_state.cpp) and raises a RescheduleAction // (move or undo a league match to a target day) through pending_reschedule(); the owner applies it and // answers with acknowledge_reschedule() or reject_reschedule(). calendar_cell() gives the cell geometry. // Implementation: calendar.cpp; the read-only projection lives in calendar_state.hpp/calendar_state.cpp. #pragma once #include "formats/font.hpp" #include "formats/textd.hpp" #include "ui/calendar_state.hpp" #include "ui/desktop.hpp" #include "ui/sprite_font.hpp" namespace bmh::ui { enum class RescheduleActionKind : uint8_t { move, undo }; struct RescheduleAction { DeskRequest owner{}; RescheduleActionKind kind = RescheduleActionKind::move; LeagueMatchRef match{}; int target_day = -1; bool operator==(const RescheduleAction&) const = default; }; struct CalendarCell { int x = 0, y = 0, width = 11, height = 8; }; // CalendarCell: weekdays descend, weeks advance horizontally, July through June. CalendarCell calendar_cell(const CalendarDayProjection& day); class CalendarScreen { public: CalendarScreen(const std::filesystem::path& data, CalendarState state, std::string manager_name = {}, bool decorated_background = true, int runtime_club = -1, DeskRequest owner = {}); Image render() const; bool move(int x, int y); bool click(int x, int y, bool right = false); bool key(std::string_view value); bool close_requested() const { return close_requested_; } const CalendarState& state() const { return state_; } int selected_day() const { return selected_day_; } const std::optional& pending_reschedule() const { return pending_reschedule_; } const DeskRequest& owner() const { return owner_; } void acknowledge_reschedule(CalendarState state, DeskRequest owner); void reject_reschedule(); std::string state_json() const; private: CalendarState state_; Image background_, atlas_; Font font_; SpriteFont sprite_font_; LeImage exe_; TextDb texts_; bool decorated_background_ = true, close_requested_ = false; int selected_day_ = -1, active_calendar_class_ = -1; DeskRequest owner_{}; int selected_source_day_ = -1; std::optional pending_reschedule_; void text(Image&, int x, int baseline, std::string_view bytes, uint8_t color) const; std::string information(const CalendarDayProjection&) const; }; } // namespace bmh::ui