FTXUI
6.1.9
C++ functional terminal UI.
Toggle main menu visibility
Loading...
Searching...
No Matches
clear_under.cpp
Go to the documentation of this file.
1
// Copyright 2020 Arthur Sonzogni. All rights reserved.
2
// Use of this source code is governed by the MIT license that can be found in
3
// the LICENSE file.
4
#include <memory>
// for make_shared
5
#include <utility>
// for move
6
7
#include "
ftxui/dom/elements.hpp
"
// for Element, clear_under
8
#include "
ftxui/dom/node.hpp
"
// for Node
9
#include "
ftxui/dom/node_decorator.hpp
"
// for NodeDecorator
10
#include "
ftxui/screen/box.hpp
"
// for Box
11
#include "
ftxui/screen/screen.hpp
"
// for Pixel, Screen
12
13
namespace
ftxui
{
14
15
namespace
{
16
using
ftxui::Screen;
17
18
class
ClearUnder :
public
NodeDecorator
{
19
public
:
20
using
NodeDecorator::NodeDecorator
;
21
22
void
Render
(Screen& screen)
override
{
23
for
(
int
y = box_.y_min; y <= box_.y_max; ++y) {
24
for
(
int
x = box_.x_min; x <= box_.x_max; ++x) {
25
screen.PixelAt(x, y) = Pixel();
26
screen.PixelAt(x, y).character =
" "
;
// Consider the pixel written.
27
}
28
}
29
Node::Render
(screen);
30
}
31
};
32
}
// namespace
33
34
/// @brief Before drawing |child|, clear the pixels below. This is useful in
35
// combinaison with dbox.
36
/// @see ftxui::dbox
37
/// @ingroup dom
38
Element
clear_under
(
Element
element) {
39
return
std::make_shared<ClearUnder>(std::move(element));
40
}
41
42
}
// namespace ftxui
box.hpp
ftxui::NodeDecorator
Definition
node_decorator.hpp:16
ftxui::NodeDecorator::NodeDecorator
NodeDecorator(Element child)
Definition
node_decorator.hpp:18
ftxui::Node::Render
virtual void Render(Screen &screen)
Display an element on a ftxui::Screen.
Definition
node.cpp:63
elements.hpp
ftxui
Definition
animation.hpp:10
ftxui::clear_under
Element clear_under(Element element)
Before drawing |child|, clear the pixels below. This is useful in.
Definition
clear_under.cpp:38
ftxui::Element
std::shared_ptr< Node > Element
Definition
elements.hpp:22
ftxui::Render
void Render(Screen &screen, const Element &element)
Display an element on a ftxui::Screen.
Definition
node.cpp:88
node.hpp
node_decorator.hpp
screen.hpp