2025-01-10 01:38:58 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "widgets/base_widget.hpp"
|
|
|
|
#include <Process/Style/ScenarioStyle.hpp>
|
|
|
|
#include <Scenario/Document/Interval/IntervalModel.hpp>
|
|
|
|
|
|
|
|
namespace Hardware
|
|
|
|
{
|
2025-01-10 10:12:29 +00:00
|
|
|
template <typename T = bugui::base_widget>
|
|
|
|
requires (std::same_as<T, bugui::base_widget> ||
|
|
|
|
std::derived_from<T, bugui::base_widget>)
|
|
|
|
struct ScenarioComponent : T
|
2025-01-10 01:38:58 +00:00
|
|
|
{
|
|
|
|
virtual bool this_model(const Scenario::IntervalModel&) const { return false; };
|
|
|
|
virtual bool this_model(const Scenario::TimeSyncModel&) const { return false; };
|
|
|
|
virtual bool this_model(const Scenario::EventModel&) const { return false; };
|
|
|
|
virtual bool this_model(const Scenario::StateModel&) const { return false; };
|
|
|
|
|
|
|
|
protected:
|
|
|
|
explicit ScenarioComponent(bugui::container_widget* parent)
|
2025-01-10 10:12:29 +00:00
|
|
|
: T{parent}
|
2025-01-10 01:38:58 +00:00
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
2025-01-10 10:12:29 +00:00
|
|
|
template <typename T, typename Base = bugui::base_widget>
|
2025-01-10 01:38:58 +00:00
|
|
|
requires (std::same_as<T, Scenario::IntervalModel> ||
|
|
|
|
std::same_as<T, Scenario::TimeSyncModel> ||
|
|
|
|
std::same_as<T, Scenario::EventModel> ||
|
|
|
|
std::same_as<T, Scenario::StateModel>)
|
2025-01-10 10:12:29 +00:00
|
|
|
struct ScenarioComponentSpec : ScenarioComponent<Base>
|
2025-01-10 01:38:58 +00:00
|
|
|
{
|
|
|
|
bool this_model(const T& m) const override { return m.id() == model.id(); };
|
|
|
|
|
|
|
|
protected:
|
|
|
|
explicit ScenarioComponentSpec(T& m,
|
|
|
|
bugui::container_widget* parent)
|
2025-01-10 10:12:29 +00:00
|
|
|
: ScenarioComponent<Base>{parent}
|
2025-01-10 01:38:58 +00:00
|
|
|
, model{m}
|
|
|
|
, skin{Process::Style::instance()}
|
|
|
|
{ }
|
|
|
|
|
|
|
|
T& model;
|
|
|
|
const Process::Style& skin;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // hardware
|