18class SelectionStyleReset :
public NodeDecorator {
20 explicit SelectionStyleReset(
Element child)
21 : NodeDecorator(std::move(child)) {}
23 void Render(Screen& screen)
final {
24 auto old_style = screen.GetSelectionStyle();
25 screen.SetSelectionStyle([](Cell&) {});
26 NodeDecorator::Render(screen);
27 screen.SetSelectionStyle(old_style);
31class SelectionStyle :
public NodeDecorator {
33 SelectionStyle(
Element child,
const std::function<
void(Cell&)>& style)
34 : NodeDecorator(std::move(child)),
style_(style) {}
36 void Render(Screen& screen)
final {
37 auto old_style = screen.GetSelectionStyle();
38 auto new_style = [&, old_style](Cell& pixel) {
42 screen.SetSelectionStyle(new_style);
43 NodeDecorator::Render(screen);
44 screen.SetSelectionStyle(old_style);
56 return std::make_shared<SelectionStyleReset>(std::move(child));
63 pixel.background_color = foreground;
71 pixel.foreground_color = foreground;
88 return std::make_shared<SelectionStyle>(std::move(child), style);
L'espace de noms FTXUI ftxui::
std::shared_ptr< Node > Element
Decorator selectionForegroundColor(Color foreground)
Définit la couleur de premier plan d'un élément lorsqu'il est sélectionné. Notez que le style est app...
Decorator selectionBackgroundColor(Color foreground)
Définit la couleur d'arrière-plan d'un élément lorsqu'il est sélectionné. Notez que le style est appl...
std::function< Element(Element)> Decorator
Decorator selectionColor(Color foreground)
Définit la couleur d'un élément lorsqu'il est sélectionné.
Element selectionStyleReset(Element child)
Réinitialise le style de sélection d'un élément.
void Render(Screen &screen, Node *node, Selection &selection)
Decorator selectionStyle(std::function< void(Cell &)> style)
Définit le style d'un élément lorsqu'il est sélectionné.
std::function< void(Cell &)> style_