mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-09 19:10:48 +00:00
b5d8549bb3
This is to make it possible, in the future, to create multiple instances of `NotCurses` for multiple terminals. The first instance of `NotCurses` becomes the default one, so that any instances of other classes that aren't explicitly created with a pointer to another `NotCurses` instance still work as expected. Note that currently trying to call `notcurses_init` twice results in the following error for me: 0x55555559bfc0 is already registered for signals Couldn't drop signals: 0x55555559bfc0 != 0x5555555b6720 terminate called after throwing an instance of 'ncpp::init_error*' Program received signal SIGABRT, Aborted. The error is signalled by `setup_signals` and the pointer shown in the message points to the first `struct notcurses` instance created.
40 lines
751 B
C++
40 lines
751 B
C++
#ifndef __NCPP_UTILITIES_HH
|
|
#define __NCPP_UTILITIES_HH
|
|
|
|
#include <notcurses/notcurses.h>
|
|
|
|
#include "_helpers.hh"
|
|
|
|
namespace ncpp
|
|
{
|
|
class NotCurses;
|
|
class Plane;
|
|
class Root;
|
|
|
|
class NCPP_API_EXPORT Utilities
|
|
{
|
|
public:
|
|
static ncplane* to_ncplane (const Plane *plane) noexcept;
|
|
|
|
static ncplane* to_ncplane (const Plane &plane) noexcept
|
|
{
|
|
return to_ncplane (&plane);
|
|
}
|
|
|
|
static NotCurses* get_notcurses_cpp (const Root *o) noexcept;
|
|
|
|
static NotCurses* get_notcurses_cpp (const Root &o) noexcept
|
|
{
|
|
return get_notcurses_cpp (&o);
|
|
}
|
|
|
|
static NotCurses* get_notcurses_cpp (const Plane *plane) noexcept;
|
|
|
|
static NotCurses* get_notcurses_cpp (const Plane &plane) noexcept
|
|
{
|
|
return get_notcurses_cpp (&plane);
|
|
}
|
|
};
|
|
}
|
|
#endif
|