While JIVE can use pure juce::ValueTree objects to define a UI, jive::View allows you to attach additional behavior to a view without losing control or needing to manually pass pointers/references.
To create a custom view, inherit from jive::View and override the initialise() method to return the juce::ValueTree that defines the view's initial state. You can then use jive::makeView<T>() to convert your custom view type into a juce::ValueTree that the jive::Interpreter can process.
class MyView : public jive::View
{
protected:
juce::ValueTree initialise() final
{
return juce::ValueTree{
"Component",
{
{ "width", 300 },
{ "height", 200 },
},
};
}
};
// Construct a ValueTree from our custom View type
const juce::ValueTree view = jive::makeView<MyView>();
jive::Interpreter interpreter;
const auto guiItem = interpreter.interpret(view);