# FTXUI: clear_under.cpp Source File

Loading...
Searching...
No Matches
clear_under.cpp
Go to the documentation of this file.
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <memory> // for make_shared
#include <utility> // for move
#include "ftxui/dom/elements.hpp" // for Element, clear_under
#include "ftxui/dom/node.hpp" // for Node
#include "ftxui/dom/node_decorator.hpp" // for NodeDecorator
#include "ftxui/screen/box.hpp" // for Box
#include "ftxui/screen/screen.hpp" // for Pixel, Screen
namespace ftxui {
namespace {
using ftxui::Screen;
class ClearUnder : public NodeDecorator {
public:
using NodeDecorator::NodeDecorator;
void Render(Screen& screen) override {
for (int y = box_.y_min; y <= box_.y_max; ++y) {
for (int x = box_.x_min; x <= box_.x_max; ++x) {
screen.PixelAt(x, y) = Pixel();
screen.PixelAt(x, y).character = " "; // Consider the pixel written.
}
}
Node::Render(screen);
}
};
} // namespace
/// @brief Before drawing |child|, clear the pixels below. This is useful in
/// combination with dbox.
/// @see ftxui::dbox
/// @ingroup dom
Element clear_under(Element element) {
return std::make_shared<ClearUnder>(std::move(element));
}
} // namespace ftxui
box.hpp
ftxui::NodeDecorator::NodeDecorator
NodeDecorator(Element child)
Definition node_decorator.hpp:18
elements.hpp
ftxui::Node::Render
friend void Render(Screen &screen, Node *node, Selection &selection)
Definition node.cpp:96
ftxui::clear_under
Element clear_under(Element element)
Before drawing |child|, clear the pixels below. This is useful in combination with dbox.
Definition clear_under.cpp:38
ftxui::Render
void Render(Screen &screen, const Element &element)
Display an element on a ftxui::Screen.
Definition node.cpp:84
ftxui::Screen
A rectangular grid of Pixel.
Definition screen.hpp:26
ftxui
The FTXUI ftxui:: namespace.
Definition animation.hpp:10
ftxui::Element
std::shared_ptr< Node > Element
Definition elements.hpp:22
node.hpp
node_decorator.hpp
screen.hpp