2025-01-10 01:38:58 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <widgets/container_widget.hpp>
|
|
|
|
#include "ScenarioComponent.hpp"
|
|
|
|
|
|
|
|
namespace Hardware
|
|
|
|
{
|
2025-01-11 21:13:44 +00:00
|
|
|
struct EventWidget final : Nano::Observer
|
|
|
|
, ScenarioComponentSpec<Scenario::EventModel,
|
2025-01-11 11:56:26 +00:00
|
|
|
bugui::container_widget>
|
2025-01-10 01:38:58 +00:00
|
|
|
{
|
|
|
|
explicit EventWidget(Scenario::EventModel& event,
|
2025-01-11 11:56:26 +00:00
|
|
|
ScenarioWidget* scenario,
|
2025-01-10 01:38:58 +00:00
|
|
|
bugui::container_widget* parent);
|
|
|
|
|
|
|
|
|
|
|
|
int y() const override;
|
|
|
|
int height() const override;
|
|
|
|
|
2025-01-14 00:04:35 +00:00
|
|
|
void set_y_height(int state_y);
|
2025-01-11 11:56:26 +00:00
|
|
|
void set_y_height();
|
2025-01-10 01:38:58 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
bool contains(int px, int py) const override;
|
2025-01-11 11:56:26 +00:00
|
|
|
|
2025-01-13 18:49:21 +00:00
|
|
|
void paint(bugui::painter& painter) const override;
|
|
|
|
|
|
|
|
void on_press(int x, int y, bool pressed) override;
|
2025-01-11 11:56:26 +00:00
|
|
|
void on_state_added(Scenario::StateModel& state);
|
|
|
|
void on_state_removed(const Scenario::StateModel& state);
|
|
|
|
|
2025-01-14 00:04:35 +00:00
|
|
|
int m_y{std::numeric_limits<int>::max()};
|
|
|
|
int m_height{std::numeric_limits<int>::lowest()};
|
2025-01-10 01:38:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} //namespace Hardware
|
|
|
|
|