yard class
#include <nxtio/process.hpp>
A yard is a drawable process scope context, or something.
Constructors, destructors, conversion operators
-
yard(nxt::
scope<ProcessContext>& sc) explicit
Public functions
- void cancel() const noexcept
- Cancel this process's scope. Child processes inherit and observe.
- auto cancelled() const → bool noexcept
-
template <typename L>void draw(L&& layout) const
-
auto next_input() const → nxt::
task<std:: optional<nxt:: input:: KeyEvent>> -
void print(std::
string_view text) const - Print without a trailing newline.
-
template <typename L>void print(L&& layout) const
-
void print(tui::
Span span) const -
void println(std::
string_view line) const - Print a line to the scroll region above the HUD.
- void request_shutdown() const noexcept
- Request the whole application to shut down.
- auto runtime() const → UIRuntime& noexcept
-
auto scope() const → nxt::
scope<ProcessContext>& noexcept - Cancellation scope for this process.
- void set_output(OutputPublisher output) const
- void signal_damage() const noexcept
-
template <typename Rep, typename Period>auto sleep(std::
chrono:: duration<Rep, Period> duration) const → nxt:: task - Suspend this coroutine for
duration. -
template <typename Body>auto spawn(Body body) const → ProcessHandle
-
auto surface() const → const tui::
Slot<tui:: AnyLayout>& noexcept
Function documentation
bool nxt:: ui:: yard:: cancelled() const noexcept
True once this process has been asked to stop. Bodies should check this at suspension points or in their loop guards.
template <typename L>
void nxt:: ui:: yard:: draw(L&& layout) const
Publish a new layout into this process's surface. The slot wakes the render loop automatically.
nxt:: task<std:: optional<nxt:: input:: KeyEvent>> nxt:: ui:: yard:: next_input() const
Await the next keyboard event from the global input queue. Returns nullopt if the input stream has been shut down.
void nxt:: ui:: yard:: set_output(OutputPublisher output) const
Replace this process's output publisher. Child processes inherit the replacement.
void nxt:: ui:: yard:: signal_damage() const noexcept
Explicitly wake the render loop. Rarely needed — draw() already does this — but useful when state outside a slot changed.
template <typename Body>
ProcessHandle nxt:: ui:: yard:: spawn(Body body) const
Spawn a child process bound to this scope. See free spawn(self,
body) for the implementation; this is the canonical entry point.
const tui:: Slot<tui:: AnyLayout>& nxt:: ui:: yard:: surface() const noexcept
The surface, suitable for embedding in a parent's layout. Cheap to copy (shared_ptr bump).