Files
Renderive/render_2D/plottable/Selection_Rectangle_Overlay.h
T
2026-08-12 00:06:44 +08:00

29 lines
1.2 KiB
C++

#pragma once
#include "Plottable.h"
#include "../axis/Axis.h"
namespace renderive {
struct Selection_Rectangle_Overlay_Properties {
Font label_font;
Pen label_pen{Color::white()};
Brush selection_brush{Color{0, 0, 255, 50}, Brush_Style::Solid};
Pen selection_border_pen{Color::white(), 1.0, Line_Style::Dash};
};
namespace detail {
class LIB_DECL Selection_Rectangle_Overlay_Control : public Plottable_State<Selection_Rectangle_Overlay_Properties>, public Paint_Overlay, public Event_Handler {
public:
Selection_Rectangle_Overlay_Control(Plot_Core& plot, const Selection_Rectangle_Overlay_Properties& properties, std::shared_ptr<Abs_Axis> horizontal_axis, std::shared_ptr<Abs_Axis> vertical_axis);
~Selection_Rectangle_Overlay_Control() override;
[[nodiscard]] std::vector<RectF> selected_regions() const;
void clear_selected_regions();
void handle_event(const Event& event) override;
protected:
void paint(Painter& painter, const Render_State_View& state) override;
private:
struct Impl;
std::unique_ptr<Impl> impl_;
void publish() override;
};
}
using Selection_Rectangle_Overlay = detail::Attach_Plottable<detail::Selection_Rectangle_Overlay_Control, Selection_Rectangle_Overlay_Properties>;
}