Toggle navigation
ivorium
iv_components
Example project
GitHub
Main Page
Modules
Classes
Files
File List
File Members
ivorium_UI
LumaSystem.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <
ivorium_graphics/ivorium_graphics.hpp
>
4
5
namespace
iv
6
{
7
8
class
LumaSystem;
9
12
class
LumaStyleId
:
public
iv::RuntimeId
< LumaStyleId >
13
{
14
public
:
15
static
constexpr
char
TypeName
[] =
"LumaStyleId"
;
16
using
iv::RuntimeId< LumaStyleId >::RuntimeId
;
17
static
iv::RuntimeIdDictionary
Dictionary
;
18
};
19
20
}
21
22
namespace
std
23
{
24
template
<>
25
struct
hash<
iv
::LumaStyleId > :
public
iv::hash
< iv::LumaStyleId >{};
26
}
27
28
namespace
iv
29
{
30
33
struct
LumaStyle
34
{
35
public
:
36
LumaStyle
();
37
38
iv::float4
surface
;
39
iv::float4
highlight
;
40
iv::float4
error
;
41
42
iv::float4
on_surface
;
43
iv::float4
on_highlight
;
44
iv::float4
on_error
;
45
46
ResourcePath
font_normal
;
47
ResourcePath
font_monospace
;
48
};
49
53
class
LumaListener
54
{
55
public
:
56
ClientMarker
cm
;
57
58
LumaListener
(
Instance
* inst,
LumaStyleId
);
59
~LumaListener
();
60
Instance
*
instance
()
const
;
61
62
LumaStyleId
style_id
()
const
;
63
LumaStyle
const
&
style
()
const
;
64
65
virtual
void
LumaStyleChanged
(
LumaStyle
const
& ) = 0;
66
67
68
private
:
69
Instance
* inst;
70
LumaStyleId
id;
71
};
72
75
class
LumaStyler
76
{
77
public
:
78
ClientMarker
cm
;
79
LumaStyler
(
Instance
* inst );
80
Instance
*
instance
()
const
;
81
84
void
current_style
(
LumaStyleId
);
85
LumaStyleId
current_style
()
const
;
86
89
void
style
(
LumaStyleId
,
LumaStyle
const
& );
90
LumaStyle
const
&
style
(
LumaStyleId
)
const
;
91
92
private
:
93
Instance
* inst;
94
LumaSystem
* ls;
95
};
96
99
class
LumaSystem
:
public
iv::System
100
{
101
public
:
102
LumaSystem
(
SystemContainer
* sc );
103
virtual
std::string
debug_name
()
const override
{
return
"LumaSystem"
; }
104
108
void
current_style
(
LumaStyleId
);
109
LumaStyleId
current_style
()
const
;
110
113
void
style
(
LumaStyleId
,
LumaStyle
const
& );
114
LumaStyle
const
&
style
(
LumaStyleId
)
const
;
115
119
void
AddListener
(
LumaListener
* );
120
void
RemoveListener
(
LumaListener
* );
121
122
private
:
123
LumaStyleId
_current_style;
124
std::unordered_map< LumaStyleId, LumaStyle > _styles;
125
iv::volatile_set< LumaListener * >
_listeners;
126
};
127
128
}