17class Hyperlink :
public NodeDecorator {
19 Hyperlink(
Element child, std::string link)
20 : NodeDecorator(std::move(child)),
link_(std::move(link)) {}
22 void Render(Screen& screen)
override {
23 const uint8_t hyperlink_id = screen.RegisterHyperlink(link_);
24 for (
int y = box_.y_min; y <= box_.y_max; ++y) {
25 for (
int x = box_.x_min; x <= box_.x_max; ++x) {
26 screen.PixelAt(x, y).hyperlink = hyperlink_id;
52 return std::make_shared<Hyperlink>(std::move(child), std::move(link));
friend void Render(Screen &screen, Node *node, Selection &selection)
Decorator hyperlink(std::string link)
使用超連結裝飾。 當用戶點擊時,連結將被開啟。 此功能僅在有限的終端模擬器中受支援。 List: https://github.com/Alhadis/OSC8-Adoption/
std::function< Element(Element)> Decorator
std::shared_ptr< Node > Element
void Render(Screen &screen, const Element &element)