1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-10-13 21:02:07 +00:00
serenity/Applications/VisualBuilder/VBProperty.h
Andreas Kling 3a33b8ea08 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.
2019-04-19 01:05:59 +02:00

33 lines
883 B
C++

#pragma once
#include <AK/AKString.h>
#include <AK/Function.h>
#include <LibGUI/GVariant.h>
class GWidget;
class VBWidget;
class VBProperty {
friend class VBWidget;
public:
VBProperty(VBWidget&, const String& name, const GVariant& value);
VBProperty(VBWidget&, const String& name, Function<GVariant(const GWidget&)>&& getter, Function<void(GWidget&, const GVariant&)>&& setter);
~VBProperty();
String name() const { return m_name; }
const GVariant& value() const { return m_value; }
void set_value(const GVariant&);
bool is_readonly() const { return m_readonly; }
void set_readonly(bool b) { m_readonly = b; }
void sync();
private:
VBWidget& m_widget;
String m_name;
GVariant m_value;
Function<GVariant(const GWidget&)> m_getter;
Function<void(GWidget&, const GVariant&)> m_setter;
bool m_readonly { false };
};