Notcurses
3.0.13
a blingful library for TUIs and character graphics
Loading...
Searching...
No Matches
Tablet.hh
Go to the documentation of this file.
1
#ifndef __NCPP_TABLET_HH
2
#define __NCPP_TABLET_HH
3
4
#include <map>
5
#include <mutex>
6
7
#include <
notcurses/notcurses.h
>
8
9
#include "
Root.hh
"
10
11
namespace
ncpp
12
{
13
class
Plane;
14
class
NotCurses;
15
16
class
NCPP_API_EXPORT
NcTablet
:
public
Root
17
{
18
protected
:
19
explicit
NcTablet
(
nctablet
*t,
NotCurses
*ncinst)
20
:
Root
(ncinst),
21
_tablet (t)
22
{
23
if
(t ==
nullptr
)
24
throw
invalid_argument
(
"'t' must be a valid pointer"
);
25
};
26
27
public
:
28
template
<
typename
T>
29
T*
get_userptr
() const noexcept
30
{
31
return
static_cast<
T*
>
(
nctablet_userptr
(_tablet));
32
}
33
34
operator
nctablet
* ()
const
noexcept
35
{
36
return
_tablet;
37
}
38
39
operator
nctablet
const
* ()
const
noexcept
40
{
41
return
_tablet;
42
}
43
44
Plane
*
get_plane
() const noexcept;
45
static
NcTablet
* map_tablet (
nctablet
*t,
NotCurses
*ncinst =
nullptr
) noexcept;
46
47
protected:
48
static
void
unmap_tablet (
NcTablet
*p) noexcept;
49
50
nctablet
* get_tablet () const noexcept
51
{
52
return
_tablet;
53
}
54
55
private
:
56
nctablet
*_tablet =
nullptr
;
57
static
std::map<nctablet*,NcTablet*> *tablet_map;
58
static
std::mutex tablet_map_mutex;
59
60
friend
class
NcReel
;
61
};
62
}
63
#endif
NCPP_API_EXPORT
#define NCPP_API_EXPORT
Definition
_helpers.hh:9
Root.hh
ncpp::NcReel
Definition
Reel.hh:15
ncpp::NcTablet
Definition
Tablet.hh:17
ncpp::NcTablet::get_userptr
T * get_userptr() const noexcept
Definition
Tablet.hh:29
ncpp::NcTablet::NcTablet
NcTablet(nctablet *t, NotCurses *ncinst)
Definition
Tablet.hh:19
ncpp::NcTablet::get_plane
Plane * get_plane() const noexcept
ncpp::NotCurses
Definition
NotCurses.hh:22
ncpp::Plane
Definition
Plane.hh:22
ncpp::Root
Definition
Root.hh:21
ncpp::invalid_argument
Definition
_exceptions.hh:35
ncpp
Definition
_exceptions.hh:9
notcurses.h
nctablet_userptr
void * nctablet_userptr(nctablet *t)
Definition
reel.c:893
nctablet
Definition
internal.h:169
include
ncpp
Tablet.hh
Generated by
1.9.8