17class SelectionStyleReset :
public NodeDecorator {
19 explicit SelectionStyleReset(
Element child)
20 : NodeDecorator(std::move(child)) {}
22 void Render(Screen& screen)
final {
23 auto old_style = screen.GetSelectionStyle();
24 screen.SetSelectionStyle([](Pixel&) {});
26 screen.SetSelectionStyle(old_style);
30class SelectionStyle :
public NodeDecorator {
32 SelectionStyle(
Element child,
const std::function<
void(Pixel&)>& style)
33 : NodeDecorator(std::move(child)),
style_(style) {}
35 void Render(Screen& screen)
final {
36 auto old_style = screen.GetSelectionStyle();
37 auto new_style = [&, old_style](Pixel& pixel) {
41 screen.SetSelectionStyle(new_style);
43 screen.SetSelectionStyle(old_style);
55 return std::make_shared<SelectionStyleReset>(std::move(child));
87 return std::make_shared<SelectionStyle>(std::move(child), style);
friend void Render(Screen &screen, Node *node, Selection &selection)
void Render(Screen &screen, const Element &element)
要素をftxui::Screenに表示します。
Colorは、ターミナルユーザーインターフェースにおける色を表すクラスです。
Unicode文字とそれに関連付けられたスタイル。
std::function< Element(Element)> Decorator
std::shared_ptr< Node > Element
Decorator selectionStyle(std::function< void(Pixel &)> style)
要素が選択されたときのスタイルを設定します。
Decorator selectionForegroundColor(Color foreground)
要素が選択されたときの描画色を設定します。 スタイルは既存のスタイルに重ねて適用されることに注意してください。
Decorator selectionBackgroundColor(Color foreground)
要素が選択されたときの背景色を設定します。 スタイルは既存のスタイルに重ねて適用されることに注意してください。
Decorator selectionColor(Color foreground)
要素が選択されたときの色を設定します。
Element selectionStyleReset(Element)
要素の選択スタイルをリセットします。
std::function< void(Pixel &)> style_