hyperlink.cpp
cstdint
memory
string
utility
ftxui/dom/elements.hpp
ftxui/dom/node_decorator.hpp
ftxui/screen/box.hpp
ftxui/screen/screen.hpp
ftxui/dom/canvas.hpp
ftxui/dom/deprecated.hpp
ftxui/dom/direction.hpp
ftxui/dom/elements.hpp
ftxui/dom/flexbox_config.hpp
ftxui/dom/linear_gradient.hpp
ftxui/dom/node.hpp
ftxui/dom/requirement.hpp
ftxui/dom/selection.hpp
ftxui/screen/box.hpp
ftxui/screen/color.hpp
ftxui/screen/image.hpp
ftxui/screen/pixel.hpp
ftxui/screen/screen.hpp
ftxui/screen/string.hpp
ftxui/screen/terminal.hpp
ftxui/util/autoreset.hpp
ftxui/util/ref.hpp
src/ftxui/dom/hyperlink.cpp
ftxui/dom/node_decorator.hpp
cstddef
cstdint
ftxui/dom/take_any_args.hpp
functional
memory
optional
sstream
string
unordered_map
utility
variant
vector
ftxui

    //Copyright2023ArthurSonzogni.Allrightsreserved.
    //UseofthissourcecodeisgovernedbytheMITlicensethatcanbefoundin
    //theLICENSEfile.
    #include<cstdint>//foruint8_t
    #include<memory>//formake_shared
    #include<string>//forstring
    #include<utility>//formove

    #include"ftxui/dom/elements.hpp"//forElement,Decorator,hyperlink
    #include"ftxui/dom/node_decorator.hpp"//forNodeDecorator
    #include"ftxui/screen/box.hpp"//forBox
    #include"ftxui/screen/screen.hpp"//forScreen,Pixel

    namespaceftxui{

    namespace{
    classHyperlink:publicNodeDecorator{
    public:
    Hyperlink(Elementchild,std::stringlink)
    :NodeDecorator(std::move(child)),link_(std::move(link)){}

    voidRender(Screen&screen)override{
    constuint8_thyperlink_id=screen.RegisterHyperlink(link_);
    for(inty=box_.y_min;y<=box_.y_max;++y){
    for(intx=box_.x_min;x<=box_.x_max;++x){
    screen.PixelAt(x,y).hyperlink=hyperlink_id;
    }
    }
    NodeDecorator::Render(screen);
    }

    std::stringlink_;
    };
    }//namespace

    ///@briefMaketherenderedareaclickableusingawebbrowser.
    ///Thelinkwillbeopenedwhentheuserclickonit.
    ///Thisissupportedonlyonalimitedsetofterminalemulator.
    ///List:https://github.com/Alhadis/OSC8-Adoption/
    ///@paramlinkThelink
    ///@paramchildTheinputelement.
    ///@returnTheoutputelementwiththelink.
    ///@ingroupdom
    ///
    ///###Example
    ///
    ///```cpp
    ///Elementdocument=
    ///hyperlink("https://github.com/ArthurSonzogni/FTXUI","link");
    ///```
    Elementhyperlink(std::stringlink,Elementchild){
    returnstd::make_shared<Hyperlink>(std::move(child),std::move(link));
    }

    ///@briefDecorateusinganhyperlink.
    ///Thelinkwillbeopenedwhentheuserclickonit.
    ///Thisissupportedonlyonalimitedsetofterminalemulator.
    ///List:https://github.com/Alhadis/OSC8-Adoption/
    ///@paramlinkThelinktoredirecttheusersto.
    ///@returnTheDecoratorapplyingthehyperlink.
    ///@ingroupdom
    ///
    ///###Example
    ///
    ///```cpp
    ///Elementdocument=
    ///text("red")|hyperlink("https://github.com/Arthursonzogni/FTXUI");
    ///```
    //NOLINTNEXTLINE
    Decoratorhyperlink(std::stringlink){
    return[link](Elementchild){returnhyperlink(link,std::move(child));};
    }

    }//namespaceftxui