mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-01 12:49:54 +08:00
Add unique_ptr<TaskRunner>
This commit is contained in:
@@ -26,6 +26,10 @@ struct Event;
|
||||
using Component = std::shared_ptr<ComponentBase>;
|
||||
class ScreenInteractivePrivate;
|
||||
|
||||
namespace task {
|
||||
class TaskRunner;
|
||||
}
|
||||
|
||||
/// @brief ScreenInteractive is a `Screen` that can handle events, run a main
|
||||
/// loop, and manage components.
|
||||
///
|
||||
@@ -40,6 +44,9 @@ class ScreenInteractive : public Screen {
|
||||
static ScreenInteractive FitComponent();
|
||||
static ScreenInteractive TerminalOutput();
|
||||
|
||||
// Destructor.
|
||||
~ScreenInteractive();
|
||||
|
||||
// Options. Must be called before Loop().
|
||||
void TrackMouse(bool enable = true);
|
||||
|
||||
@@ -156,6 +163,8 @@ class ScreenInteractive : public Screen {
|
||||
std::unique_ptr<Selection> selection_;
|
||||
std::function<void()> selection_on_change_;
|
||||
|
||||
std::unique_ptr<task::TaskRunner> task_runner_;
|
||||
|
||||
friend class Loop;
|
||||
|
||||
public:
|
||||
|
@@ -20,6 +20,9 @@ class Image {
|
||||
Image() = delete;
|
||||
Image(int dimx, int dimy);
|
||||
|
||||
// Destructor:
|
||||
virtual ~Image() = default;
|
||||
|
||||
// Access a character in the grid at a given position.
|
||||
std::string& at(int x, int y);
|
||||
const std::string& at(int x, int y) const;
|
||||
|
@@ -11,7 +11,6 @@
|
||||
|
||||
#include "ftxui/screen/image.hpp" // for Pixel, Image
|
||||
#include "ftxui/screen/terminal.hpp" // for Dimensions
|
||||
#include "ftxui/util/autoreset.hpp" // for AutoReset
|
||||
|
||||
namespace ftxui {
|
||||
|
||||
@@ -31,6 +30,9 @@ class Screen : public Image {
|
||||
static Screen Create(Dimensions dimension);
|
||||
static Screen Create(Dimensions width, Dimensions height);
|
||||
|
||||
// Destructor:
|
||||
~Screen() override = default;
|
||||
|
||||
std::string ToString() const;
|
||||
|
||||
// Print the Screen on to the terminal.
|
||||
|
@@ -30,11 +30,12 @@
|
||||
#include "ftxui/component/loop.hpp" // for Loop
|
||||
#include "ftxui/component/receiver.hpp" // for ReceiverImpl, Sender, MakeReceiver, SenderImpl, Receiver
|
||||
#include "ftxui/component/terminal_input_parser.hpp" // for TerminalInputParser
|
||||
#include "ftxui/dom/node.hpp" // for Node, Render
|
||||
#include "ftxui/dom/requirement.hpp" // for Requirement
|
||||
#include "ftxui/screen/pixel.hpp" // for Pixel
|
||||
#include "ftxui/screen/terminal.hpp" // for Dimensions, Size
|
||||
#include "ftxui/screen/util.hpp" // for util::clamp
|
||||
#include "ftxui/core/task_runner.hpp"
|
||||
#include "ftxui/dom/node.hpp" // for Node, Render
|
||||
#include "ftxui/dom/requirement.hpp" // for Requirement
|
||||
#include "ftxui/screen/pixel.hpp" // for Pixel
|
||||
#include "ftxui/screen/terminal.hpp" // for Dimensions, Size
|
||||
#include "ftxui/screen/util.hpp" // for util::clamp
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define DEFINE_CONSOLEV2_PROPERTIES
|
||||
@@ -417,6 +418,8 @@ ScreenInteractive ScreenInteractive::TerminalOutput() {
|
||||
};
|
||||
}
|
||||
|
||||
ScreenInteractive::~ScreenInteractive() = default;
|
||||
|
||||
/// Create a ScreenInteractive whose width and height match the component being
|
||||
/// drawn.
|
||||
// static
|
||||
|
Reference in New Issue
Block a user