Toggle navigation
ivorium
iv_components
Example project
GitHub
Main Page
Modules
Classes
Files
File List
File Members
ivorium_core
Attribute
Attributes
FunctorActivatorAttribute.cpp
Go to the documentation of this file.
1
#include "
FunctorActivatorAttribute.hpp
"
2
3
namespace
iv
4
{
5
6
FunctorActivatorAttribute::FunctorActivatorAttribute
(
ClientMarker
* cm, std::function<
void
() >
const
& on_activated ) :
7
Local_AEP
(),
8
Attr
<
Activator
>( cm, this, false ),
9
activator(),
10
_on_activated( on_activated )
11
{
12
this->
SetAttributeMode
(
Attribute::ValueMode::ValueModify
);
13
this->
Notify_Activated
();
14
}
15
16
FunctorActivatorAttribute::~FunctorActivatorAttribute
()
17
{
18
this->
Notify_Deactivated
();
19
}
20
21
void
FunctorActivatorAttribute::on_activated
( std::function<
void
() >
const
& val )
22
{
23
this->_on_activated = val;
24
}
25
26
void
FunctorActivatorAttribute::SetAttributeMode
(
Attribute::ValueMode
mode )
27
{
28
this->
Attr< Activator >::SetAttributeMode
( mode );
29
}
30
31
void
FunctorActivatorAttribute::GetSourceValue
(
Activator
& out )
const
32
{
33
out = this->activator;
34
}
35
36
void
FunctorActivatorAttribute::ModifySource
(
Activator
const
& val )
37
{
38
if
( val.
CopyActivations
( this->activator ) && this->_on_activated )
39
this->_on_activated();
40
41
this->
Attr< Activator >::SourceValueChanged
();
42
}
43
44
}