#pragma once #include "../renderable/Renderable.h" #include "Axis_Types.h" #include #include #include namespace renderive::detail { template class Axis_Renderable_Builder { public: using Self = Axis_Renderable_Builder; Axis_Renderable_Builder(std::shared_ptr parent, Orientation orientation) : parent_(std::move(parent)) { properties_.orientation = orientation; } Self& set_x(int value) { properties_.x = value; return *this; } Self& set_y(int value) { properties_.y = value; return *this; } Self& set_orientation(Orientation value) { properties_.orientation = value; return *this; } Self& set_pixel_length(std::size_t value) { properties_.pixel_length = value; return *this; } Self& set_tick_length(int value) { properties_.tick_length = value; return *this; } Self& set_sub_tick_length(int value) { properties_.sub_tick_length = value; return *this; } Self& set_color(Color value) { properties_.color = value; return *this; } Self& set_locale(Number_Locale value) { properties_.locale = value; return *this; } Self& set_unit_text(std::string value) { properties_.unit_text = std::move(value); return *this; } Self& set_unit_text_font(Font value) { properties_.unit_text_font = value; return *this; } Self& set_unit_text_pen(Pen value) { properties_.unit_text_pen = value; return *this; } Self& set_unit_text_background_brush(Brush value) { properties_.unit_text_background_brush = value; return *this; } Self& set_label_rotation_degrees(int value) { properties_.label_rotation_degrees = value; return *this; } Self& set_coord_range(Range value) requires requires(Properties properties) { properties.coordinates = value; } { properties_.coordinates = value; return *this; } Self& set_label_precision(int value) requires requires(Properties properties) { properties.precision = value; } { properties_.precision = value; return *this; } Self& set_use_wheel(bool value) requires requires(Properties properties) { properties.wheel = value; } { properties_.wheel = value; return *this; } Self& set_use_drag(bool value) requires requires(Properties properties) { properties.drag = value; } { properties_.drag = value; return *this; } Self& set_visible_time_point_count(int value) requires requires(Properties properties) { properties.visible_count = value; } { properties_.visible_count = value; return *this; } Self& set_tick_label_spacing_px(int value) requires requires(Properties properties) { properties.tick_label_spacing_px = value; } { properties_.tick_label_spacing_px = value; return *this; } Self& set_time_format(std::string value) requires requires(Properties properties) { properties.format = value; } { properties_.format = std::move(value); return *this; } Self& set_font(Font value) requires requires(Properties properties) { properties.unit_text_font = value; } { properties_.unit_text_font = value; return *this; } Self& set_newest_at_axis_start(bool value) requires requires(Properties properties) { properties.newest_at_start = value; } { properties_.newest_at_start = value; return *this; } std::shared_ptr build() const { if (!parent_) return {}; auto result = parent_->scene().template make_renderable(properties_); attach_renderable_child(parent_->scene(), result, parent_); return result; } private: std::shared_ptr parent_; Properties properties_; }; } // namespace renderive::detail