19using Charset = std::array<std::string, 2>;
20using Charsets = std::array<Charset, 6>;
31class Separator :
public Node {
33 explicit Separator(std::string value) : value_(
std::
move(value)) {}
35 void ComputeRequirement()
override {
36 requirement_.min_x = 1;
37 requirement_.min_y = 1;
41 for (
int y = box_.y_min; y <= box_.y_max; ++y) {
42 for (
int x = box_.x_min; x <= box_.x_max; ++x) {
44 pixel.character = value_;
45 pixel.automerge =
true;
53class SeparatorAuto :
public Node {
57 void ComputeRequirement()
override {
58 requirement_.min_x = 1;
59 requirement_.min_y = 1;
63 const bool is_column = (box_.x_max == box_.x_min);
64 const bool is_line = (box_.y_min == box_.y_max);
68 for (
int y = box_.y_min; y <= box_.y_max; ++y) {
69 for (
int x = box_.x_min; x <= box_.x_max; ++x) {
72 pixel.automerge =
true;
80class SeparatorWithPixel :
public SeparatorAuto {
82 explicit SeparatorWithPixel(Pixel
pixel)
84 pixel_.automerge =
true;
87 for (
int y = box_.y_min; y <= box_.y_max; ++y) {
88 for (
int x = box_.x_min; x <= box_.x_max; ++x) {
89 screen.PixelAt(x, y) = pixel_;
133 return std::make_shared<SeparatorAuto>(
LIGHT);
171 return std::make_shared<SeparatorAuto>(
style);
208 return std::make_shared<SeparatorAuto>(
LIGHT);
245 return std::make_shared<SeparatorAuto>(
DASHED);
282 return std::make_shared<SeparatorAuto>(
HEAVY);
319 return std::make_shared<SeparatorAuto>(
DOUBLE);
356 return std::make_shared<SeparatorAuto>(
EMPTY);
394 return std::make_shared<Separator>(std::move(value));
425 return std::make_shared<SeparatorWithPixel>(std::move(
pixel));
451 void ComputeRequirement()
override {
452 requirement_.min_x = 1;
453 requirement_.min_y = 1;
457 if (box_.y_max < box_.y_min) {
465 const int y = box_.y_min;
466 for (
int x = box_.x_min; x <= box_.x_max; ++x) {
469 const int a = (x - box_.x_min) * 2;
476 pixel.automerge =
true;
479 pixel.automerge =
false;
521 void ComputeRequirement()
override {
522 requirement_.min_x = 1;
523 requirement_.min_y = 1;
527 if (box_.x_max < box_.x_min) {
535 const int x = box_.x_min;
536 for (
int y = box_.y_min; y <= box_.y_max; ++y) {
539 const int a = (y - box_.y_min) * 2;
546 pixel.automerge =
true;
549 pixel.automerge =
false;
A class representing terminal colors.
A rectangular grid of Pixel.
Element separatorStyled(BorderStyle)
Draw a vertical or horizontal separation in between two other elements.
Element separatorEmpty()
Draw a vertical or horizontal separation in between two other elements, using the EMPTY style.
Element separatorVSelector(float up, float down, Color unselected_color, Color selected_color)
Draw an vertical bar, with the area in between up/downcolored differently.
std::shared_ptr< Node > Element
Element separatorLight()
Draw a vertical or horizontal separation in between two other elements, using the LIGHT style.
Element separatorHSelector(float left, float right, Color unselected_color, Color selected_color)
Draw an horizontal bar, with the area in between left/right colored differently.
Element separatorDashed()
Draw a vertical or horizontal separation in between two other elements, using the DASHED style.
Element separatorCharacter(std::string)
Draw a vertical or horizontal separation in between two other elements.
Component Slider(SliderOption< T > options)
A slider in any direction.
Element separator()
Draw a vertical or horizontal separation in between two other elements.
void Render(Screen &screen, const Element &element)
Display an element on a ftxui::Screen.
Element separatorDouble()
Draw a vertical or horizontal separation in between two other elements, using the DOUBLE style.
Element separatorHeavy()
Draw a vertical or horizontal separation in between two other elements, using the HEAVY style.
A unicode character and its associated style.