mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
VisualBuilder: Hook up everything needed for widget property editing.
It's now possible to edit widget properties inline in the properties window. We're currently relying on the basic GVariant conversion functions to do all the "parsing" but that's not gonna be good enough.
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
#include "VBProperty.h"
|
||||
#include "VBWidget.h"
|
||||
|
||||
VBProperty::VBProperty(const String& name, const GVariant& value)
|
||||
: m_name(name)
|
||||
VBProperty::VBProperty(VBWidget& widget, const String& name, const GVariant& value)
|
||||
: m_widget(widget)
|
||||
, m_name(name)
|
||||
, m_value(value)
|
||||
{
|
||||
}
|
||||
|
||||
VBProperty::VBProperty(const String& name, Function<GVariant(const GWidget&)>&& getter, Function<void(GWidget&, const GVariant&)>&& setter)
|
||||
: m_name(name)
|
||||
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))
|
||||
{
|
||||
@@ -18,3 +21,13 @@ VBProperty::VBProperty(const String& name, Function<GVariant(const GWidget&)>&&
|
||||
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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user