mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-16 00:13:00 +00:00
3e78dd7d1f
New classes: * MultiSelector (`ncmultiselector_*`) Added: * Direct: cursor_{enable,disable} * Plane: high_gradient (`ncplane_highgradient`) * Plane: high_gradient_sized (`ncplane_highgradient_sized`) * Plane: rotate_cw (`ncplane_rotate_cw`) * Plane: rotate_ccw (`ncplane_rotate_ccw`) Updated: * NotCurses: added all the margin initializers to the default options
68 lines
1.8 KiB
C++
68 lines
1.8 KiB
C++
#ifndef __NCPP_MULTI_SELECTOR_HH
|
|
#define __NCPP_MULTI_SELECTOR_HH
|
|
|
|
#include <notcurses/notcurses.h>
|
|
|
|
#include "Root.hh"
|
|
#include "NCAlign.hh"
|
|
|
|
namespace ncpp
|
|
{
|
|
class Plane;
|
|
|
|
class NCPP_API_EXPORT MultiSelector : public Root
|
|
{
|
|
public:
|
|
static multiselector_options default_options;
|
|
|
|
public:
|
|
explicit MultiSelector (Plane *plane, int y, int x, const multiselector_options *opts = nullptr)
|
|
: MultiSelector (reinterpret_cast<ncplane*>(plane), y, x, opts)
|
|
{}
|
|
|
|
explicit MultiSelector (Plane const* plane, int y, int x, const multiselector_options *opts = nullptr)
|
|
: MultiSelector (const_cast<Plane*>(plane), y, x, opts)
|
|
{}
|
|
|
|
explicit MultiSelector (Plane &plane, int y, int x, const multiselector_options *opts = nullptr)
|
|
: MultiSelector (reinterpret_cast<ncplane*>(&plane), y, x, opts)
|
|
{}
|
|
|
|
explicit MultiSelector (Plane const& plane, int y, int x, const multiselector_options *opts = nullptr)
|
|
: MultiSelector (const_cast<Plane*>(&plane), y, x, opts)
|
|
{}
|
|
|
|
explicit MultiSelector (ncplane *plane, int y, int x, const multiselector_options *opts = nullptr)
|
|
{
|
|
if (plane == nullptr)
|
|
throw invalid_argument ("'plane' must be a valid pointer");
|
|
|
|
multiselector = ncmultiselector_create (plane, y, x, opts == nullptr ? &default_options : opts);
|
|
if (multiselector == nullptr)
|
|
throw init_error ("notcurses failed to create a new multiselector");
|
|
}
|
|
|
|
~MultiSelector ()
|
|
{
|
|
if (!is_notcurses_stopped ())
|
|
ncmultiselector_destroy (multiselector, nullptr);
|
|
}
|
|
|
|
bool offer_input (const struct ncinput *nc) const noexcept
|
|
{
|
|
return ncmultiselector_offer_input (multiselector, nc);
|
|
}
|
|
|
|
const int get_selected (bool *selected, unsigned count) const noexcept
|
|
{
|
|
return ncmultiselector_selected (multiselector, selected, count);
|
|
}
|
|
|
|
Plane* get_plane () const noexcept;
|
|
|
|
private:
|
|
ncmultiselector *multiselector;
|
|
};
|
|
}
|
|
#endif
|