FTXUI 6.1.9
C++ functional terminal UI.
Loading...
Searching...
No Matches
selection.hpp
Go to the documentation of this file.
1// Copyright 2024 Arthur Sonzogni. All rights reserved.
2// このソースコードの使用は、LICENSEファイルにあるMITライセンスに準拠します。
3
4#ifndef FTXUI_DOM_SELECTION_HPP
5#define FTXUI_DOM_SELECTION_HPP
6
7#include <functional>
8
9#include <sstream>
10#include "ftxui/screen/box.hpp" // for Box
11#include "ftxui/screen/pixel.hpp" // for Pixel
12
13namespace ftxui {
14
15/// @brief ターミナルユーザーインターフェースにおける選択範囲を表します。
16///
17/// Selectionは、ターミナルユーザーインターフェースにおける選択範囲の2つのエンドポイントを表すクラスです。
18///
19/// @ingroup dom
20class Selection {
21 public:
22 Selection(); // 空の選択。
23 Selection(int start_x, int start_y, int end_x, int end_y);
24
25 const Box& GetBox() const;
26
29 bool IsEmpty() const { return empty_; }
30
31 void AddPart(const std::string& part, int y, int left, int right);
32 std::string GetParts() { return parts_.str(); }
33
34 private:
35 Selection(int start_x, int start_y, int end_x, int end_y, Selection* parent);
36
37 const int start_x_ = 0;
38 const int start_y_ = 0;
39 const int end_x_ = 0;
40 const int end_y_ = 0;
41 const Box box_ = {};
42 Selection* const parent_ = this;
43 const bool empty_ = true;
44 std::stringstream parts_;
45
46 // 最後に挿入された部分の位置。
47 int x_ = 0;
48 int y_ = 0;
49};
50
51} // namespace ftxui
52
53#endif /* end of include guard: FTXUI_DOM_SELECTION_HPP */
const Box & GetBox() const
選択範囲のボックスを取得します。
std::string GetParts()
Definition selection.hpp:32
bool IsEmpty() const
Definition selection.hpp:29
void AddPart(const std::string &part, int y, int left, int right)
Selection SaturateVertical(Box box)
選択範囲をボックス内に収めます。 これはvboxによって、選択範囲をその子に伝播するために呼び出されます。
Selection()
空の選択を作成します。
Selection SaturateHorizontal(Box box)
選択範囲をボックス内に収めます。 これはhboxによって、選択範囲をその子に伝播するために呼び出されます。
ターミナルユーザーインターフェースにおける選択範囲を表します。
Definition selection.hpp:20
Boxは、2D空間における矩形領域を表す構造体です。
Definition box.hpp:14
FTXUI ftxui:: 名前空間
Definition animation.hpp:9
std::uint8_t left
Definition screen.cpp:129
std::uint8_t right
Definition screen.cpp:131