focus.cpp
memory
utility
ftxui/dom/elements.hpp
ftxui/dom/node_decorator.hpp
ftxui/dom/requirement.hpp
ftxui/screen/box.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/focus.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

    //Copyright2020ArthurSonzogni.Allrightsreserved.
    //UseofthissourcecodeisgovernedbytheMITlicensethatcanbefoundin
    //theLICENSEfile.
    #include<memory>//formake_shared
    #include<utility>//formove

    #include"ftxui/dom/elements.hpp"//forDecorator,Element,focusPosition,focusPositionRelative
    #include"ftxui/dom/node_decorator.hpp"//forNodeDecorator
    #include"ftxui/dom/requirement.hpp"//forRequirement,Requirement::NORMAL,Requirement::Selection
    #include"ftxui/screen/box.hpp"//forBox

    namespaceftxui{

    ///@briefUsedinsidea`frame`,thisforcetheviewtobescrolledtowarda
    ///agivenposition.Thepositionisexpressedinproportionoftherequested
    ///size.
    ///
    ///Forinstance:
    ///-(0,0)meansthattheviewisscrolledtowardtheupperleft.
    ///-(1,0)meansthattheviewisscrolledtowardtheupperright.
    ///-(0,1)meansthattheviewisscrolledtowardthebottomleft.
    ///@ingroupdom
    ///
    ///###Example
    ///
    ///```cpp
    ///Elementdocument=huge_document()
    ///|focusPositionRelative(0.f,1.f)
    ///|frame;
    ///```
    DecoratorfocusPositionRelative(floatx,floaty){
    classImpl:publicNodeDecorator{
    public:
    Impl(Elementchild,floatx,floaty)
    :NodeDecorator(std::move(child)),x_(x),y_(y){}

    voidComputeRequirement()override{
    NodeDecorator::ComputeRequirement();
    requirement_.focused.enabled=true;
    requirement_.focused.node=this;
    requirement_.focused.box.x_min=int(float(requirement_.min_x)*x_);
    requirement_.focused.box.y_min=int(float(requirement_.min_y)*y_);
    requirement_.focused.box.x_max=int(float(requirement_.min_x)*x_);
    requirement_.focused.box.y_max=int(float(requirement_.min_y)*y_);
    }

    private:
    constfloatx_;
    constfloaty_;
    };

    return[x,y](Elementchild){
    returnstd::make_shared<Impl>(std::move(child),x,y);
    };
    }

    ///@briefUsedinsidea`frame`,thisforcetheviewtobescrolledtowarda
    ///agivenposition.Thepositionisexpressedinthenumbersofcells.
    ///
    ///@ingroupdom
    ///
    ///###Example
    ///
    ///```cpp
    ///Elementdocument=huge_document()
    ///|focusPosition(10,10)
    ///|frame;
    ///```
    DecoratorfocusPosition(intx,inty){
    classImpl:publicNodeDecorator{
    public:
    Impl(Elementchild,intx,inty)
    :NodeDecorator(std::move(child)),x_(x),y_(y){}

    voidComputeRequirement()override{
    NodeDecorator::ComputeRequirement();
    requirement_.focused.enabled=false;

    Box&box=requirement_.focused.box;
    box.x_min=x_;
    box.y_min=y_;
    box.x_max=x_;
    box.y_max=y_;
    }

    private:
    constintx_;
    constinty_;
    };

    return[x,y](Elementchild){
    returnstd::make_shared<Impl>(std::move(child),x,y);
    };
    }

    }//namespaceftxui