16class Hyperlink :
public NodeDecorator {
18 Hyperlink(
Element child, std::string link)
19 : NodeDecorator(std::move(child)),
link_(std::move(link)) {}
21 void Render(Screen& screen)
override {
22 const uint8_t hyperlink_id = screen.RegisterHyperlink(link_);
23 for (
int y = box_.y_min; y <= box_.y_max; ++y) {
24 for (
int x = box_.x_min; x <= box_.x_max; ++x) {
25 screen.PixelAt(x, y).hyperlink = hyperlink_id;
51 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)
使用超链接进行装饰。 当用户点击时,链接将被打开。 这仅在有限的终端模拟器中受支持。 列表:https://github.com/Alhadis/OSC8-Adoption/
void Render(Screen &screen, const Element &element)
在 ftxui::Screen 上显示元素。
#include "ftxui/component/component_base.hpp" // 用于 ComponentBase
std::function< Element(Element)> Decorator
std::shared_ptr< Node > Element