2024-12-02 00:40:19 +08:00
|
|
|
// Copyright 2024 Arthur Sonzogni. All rights reserved.
|
|
|
|
// Use of this source code is governed by the MIT license that can be found in
|
|
|
|
// the LICENSE file.
|
|
|
|
|
|
|
|
#ifndef FTXUI_DOM_SELECTION_HPP
|
|
|
|
#define FTXUI_DOM_SELECTION_HPP
|
|
|
|
|
2024-12-02 20:34:27 +08:00
|
|
|
#include <functional>
|
|
|
|
|
2024-12-23 00:19:50 +08:00
|
|
|
#include "ftxui/screen/box.hpp" // for Box
|
2024-12-02 20:34:27 +08:00
|
|
|
#include "ftxui/screen/pixel.hpp" // for Pixel
|
2024-12-02 00:40:19 +08:00
|
|
|
|
|
|
|
namespace ftxui {
|
|
|
|
|
|
|
|
/// @brief Represent a selection in the terminal.
|
|
|
|
class Selection {
|
|
|
|
public:
|
2024-12-23 00:19:50 +08:00
|
|
|
Selection(int start_x, int start_y, int end_x, int end_y);
|
2024-12-02 00:40:19 +08:00
|
|
|
const Box& GetBox() const;
|
|
|
|
|
|
|
|
Selection SaturateHorizontal(Box box);
|
|
|
|
Selection SaturateVertical(Box box);
|
|
|
|
|
|
|
|
private:
|
|
|
|
Selection* const parent_ = nullptr;
|
|
|
|
const int start_x_;
|
|
|
|
const int start_y_;
|
|
|
|
const int end_x_;
|
|
|
|
const int end_y_;
|
|
|
|
const Box box_;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace ftxui
|
|
|
|
|
|
|
|
#endif /* end of include guard: FTXUI_DOM_SELECTION_HPP */
|