FTXUI 7.0.3
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// Use of this source code is governed by the MIT license that can be found in
3// the LICENSE file.
4
5#ifndef FTXUI_DOM_SELECTION_HPP
6#define FTXUI_DOM_SELECTION_HPP
7
8#include <functional>
9
10#include <sstream>
11#include "ftxui/screen/box.hpp" // for Box
12#include "ftxui/screen/cell.hpp" // for Cell
13#include "ftxui/util/export.hpp" // for FTXUI_EXPORT
14
15namespace ftxui {
16
17/// @brief ターミナルユーザーインターフェースにおける選択範囲を表します。
18///
19/// Selectionは、ターミナルユーザーインターフェースにおける選択範囲の2つのエンドポイントを表すクラスです。
20///
21/// @ingroup dom
22class FTXUI_EXPORT(DOM) Selection {
23 public:
24 Selection(); // 空の選択。
25 Selection(int start_x, int start_y, int end_x, int end_y);
26
27 const Box& GetBox() const;
28
29 Selection SaturateHorizontal(Box box);
30 Selection SaturateVertical(Box box);
31 bool IsEmpty() const { return empty_; }
32
33 void AddPart(std::string_view part, int y, int left, int right);
34 std::string GetParts() { return parts_.str(); }
35
36 private:
37 Selection(int start_x, int start_y, int end_x, int end_y, Selection* parent);
38
39 const int start_x_ = 0;
40 const int start_y_ = 0;
41 const int end_x_ = 0;
42 const int end_y_ = 0;
43 const Box box_ = {};
44 Selection* const parent_ = this;
45 const bool empty_ = true;
46 std::stringstream parts_;
47
48 // 最後に挿入された部分の位置。
49 int x_ = 0;
50 int y_ = 0;
51};
52
53} // namespace ftxui
54
55#endif /* end of include guard: FTXUI_DOM_SELECTION_HPP */
FTXUI ftxui::名前空間
Definition animation.hpp:11
std::uint8_t left
Definition screen.cpp:147
std::uint8_t right
Definition screen.cpp:149