blob: 1ce4ba0dca233b9a19997cc998ae593361bf5391 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#include "VBProperty.h"
#include "VBWidget.h"
VBProperty::VBProperty(VBWidget& widget, const String& name, const GVariant& value)
: m_widget(widget)
, m_name(name)
, m_value(value)
{
}
VBProperty::VBProperty(VBWidget& widget, const String& name, Function<GVariant(const GWidget&)>&& getter, Function<void(GWidget&, const GVariant&)>&& setter)
: m_widget(widget)
, m_name(name)
, m_getter(move(getter))
, m_setter(move(setter))
{
ASSERT(m_getter);
ASSERT(m_setter);
}
VBProperty::~VBProperty()
{
}
void VBProperty::set_value(const GVariant& value)
{
if (m_value == value)
return;
m_value = value;
if (m_setter)
m_setter(*m_widget.gwidget(), value);
m_widget.property_did_change();
}
|