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