Style sheet inheritance
jurihock opened this issue · comments
I'm trying to apply a custom style to a component tree. Here is a condensed sketch based on my current AudioProcessorEditor implementation:
juce::String style(
R"({
".footer": {
"background": "#ff00ff"
}
})");
juce::String xml(
R"(
<Component width="550" height="600" padding="10">
<Component>
...
</Component>
<Component class="footer">
...
</Component>
</Component>
)");
jive::Interpreter interpreter;
auto tree = jive::parseXML(xml);
tree.setProperty("style", style, nullptr);
auto view = interpreter.interpret(tree);
The JIVE_GUI_ITEMS_HAVE_STYLE_SHEETS
flag is set to 1
.
According to https://github.com/ImJimmi/JIVE/blob/main/jive_style_sheets/README.md
Style sheets are hereditary, meaning that if a style property isn't explicitly defined for a component, the style sheet will inherit the style from the component's parent instead.
I was expecting the "footer" component to change the background color. However, this is not the case.
In this case, the background color is set successfully, but that's not what I actually want:
juce::String xml(
R"(
<Component class="footer" width="550" height="600" padding="10">
<Component>
...
</Component>
<Component>
...
</Component>
</Component>
)");
Is there something I am missing?
Hi, yes this is a bug that I've fixed here on the plugin demo branch.
I'm just updating the docs to be a bit more verbose and then I'll merge
I've now merged that fix, could you let me know if it's fixed your problem?
It works perfectly now. Thanks for fixing it!