FTXUI 6.1.9
C++ functional terminal UI.
载入中...
搜索中...
未找到
dim.cpp
浏览该文件的文档.
1// 版权所有 2020 Arthur Sonzogni。保留所有权利。
2// 本源代码的使用受可在 LICENSE 文件中找到的 MIT 许可的约束。
3#include <memory> // for make_shared
4#include <utility> // for move
5
6#include "ftxui/dom/elements.hpp" // for Element, dim
7#include "ftxui/dom/node.hpp" // for Node
8#include "ftxui/dom/node_decorator.hpp" // for NodeDecorator
9#include "ftxui/screen/box.hpp" // for Box
10#include "ftxui/screen/screen.hpp" // for Pixel, Screen
11
12namespace ftxui {
13
14namespace {
15class Dim : public NodeDecorator {
16 public:
18
19 void Render(Screen& screen) override {
20 Node::Render(screen);
21 for (int y = box_.y_min; y <= box_.y_max; ++y) {
22 for (int x = box_.x_min; x <= box_.x_max; ++x) {
23 screen.PixelAt(x, y).dim = true;
24 }
25 }
26 }
27};
28} // namespace
29
30/// @brief 使用浅色字体,用于不那么重要的元素。
31/// @ingroup dom
33 return std::make_shared<Dim>(std::move(child));
34}
35
36} // namespace ftxui
friend void Render(Screen &screen, Node *node, Selection &selection)
Element dim(Element)
使用浅色字体,用于不那么重要的元素。
定义 dim.cpp:32
void Render(Screen &screen, const Element &element)
在 ftxui::Screen 上显示元素。
#include "ftxui/component/component_base.hpp" // 用于 ComponentBase
std::shared_ptr< Node > Element