FTXUI 6.1.9
C++ functional terminal UI.
Loading...
Searching...
No Matches
strikethrough.cpp
Go to the documentation of this file.
1// 版權所有 2023 Arthur Sonzogni. 保留所有權利。
2// 本原始碼的使用受 MIT 授權約束,可在 LICENSE 檔案中找到。
3#include <memory> // for make_shared
4#include <utility> // for move
5
6#include "ftxui/dom/elements.hpp" // for Element, strikethrough
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
14/// @brief 對文字應用刪除線。
15/// @ingroup dom
17 class Impl : public NodeDecorator {
18 public:
19 using NodeDecorator::NodeDecorator;
20
21 void Render(Screen& screen) override {
22 for (int y = box_.y_min; y <= box_.y_max; ++y) {
23 for (int x = box_.x_min; x <= box_.x_max; ++x) {
24 screen.PixelAt(x, y).strikethrough = true;
25 }
26 }
27 Node::Render(screen);
28 }
29 };
30
31 return std::make_shared<Impl>(std::move(child));
32}
33
34} // namespace ftxui
Element strikethrough(Element)
對文字應用刪除線。
void Render(Screen &screen, const Element &element)
在 ftxui::Screen 上顯示元素。
Definition node.cpp:82
bool strikethrough
Definition pixel.hpp:34
Pixel & PixelAt(int x, int y)
存取給定位置的單元格 (Pixel)。
Definition image.cpp:43
像素的矩形網格。
Definition screen.hpp:26
FTXUI 的 ftxui:: 命名空間
Definition animation.hpp:10
std::shared_ptr< Node > Element
Definition elements.hpp:22