Files
Renderive/render_2D/plottable/Hover_Tooltip.h
T
2026-08-11 17:48:32 +08:00

30 lines
807 B
C++

#pragma once
#include "../event/Event.h"
#include "../render/Blend2D_Cache.h"
namespace renderive {
struct Hover_Tooltip_Properties {
bool tooltip_enabled = true;
Font tooltip_font;
Pen tooltip_text_pen{Color::white()};
Brush tooltip_background_brush{Color{20, 20, 20, 220}, Brush_Style::Solid};
};
namespace detail {
struct Hover_Tooltip_Runtime {
bool active{};
PointF position{};
};
inline bool update_hover_tooltip(Hover_Tooltip_Runtime& tooltip, const Event& event) {
if(event.type == Event_Type::Pointer_Move) {
tooltip.active = true;
tooltip.position = static_cast<const Pointer_Event&>(event).position;
return true;
}
if(event.type == Event_Type::Leave) {
tooltip.active = false;
return true;
}
return false;
}
}
}