14class Unselectable :
public NodeDecorator {
18 void Select(Selection& ignored)
override {
19 std::ignore = ignored;
39 std::min(start_x, end_x),
40 std::max(start_x, end_x),
41 std::min(start_y, end_y),
42 std::max(start_y, end_y),
56 std::min(start_x, end_x),
57 std::max(start_x, end_x),
58 std::min(start_y, end_y),
59 std::max(start_y, end_y),
75 int start_x = start_x_;
76 int start_y = start_y_;
80 const bool start_outside = !box.
Contain(start_x, start_y);
81 const bool end_outside = !box.
Contain(end_x, end_y);
82 const bool properly_ordered =
83 start_y < end_y || (start_y == end_y && start_x <= end_x);
84 if (properly_ordered) {
104 start_x, start_y, end_x, end_y, parent_,
113 int start_x = start_x_;
114 int start_y = start_y_;
118 const bool start_outside = !box.
Contain(start_x, start_y);
119 const bool end_outside = !box.
Contain(end_x, end_y);
120 const bool properly_ordered =
121 start_y < end_y || (start_y == end_y && start_x <= end_x);
123 if (properly_ordered) {
142 return {start_x, start_y, end_x, end_y, parent_};
146 if (parent_ !=
this) {
151 if (parts_.str().empty()) {
157 parts_ <<
'\n' << part;
161 if (x_ ==
left + 1) {
NodeDecorator(Element child)
const Box & GetBox() const
获取选择框。
void AddPart(const std::string &part, int y, int left, int right)
Selection SaturateVertical(Box box)
将选择饱和到框内。 这由 vbox 调用,以将选择传播到其子级。
Selection SaturateHorizontal(Box box)
将选择饱和到框内。 这由 hbox 调用,以将选择传播到其子级。
bool Contain(int x, int y) const
#include "ftxui/component/component_base.hpp" // 用于 ComponentBase