I’m just about to start another JUCE based project and I’ve some questions about how best to update the look and feel. Right now I have a ValueTree that holds string versions of all the colours I need in my look and feel. Whenever a user updates one of these colours I call a method that passes the updated ValueTree to my LookAndFeel class. I then do something like this for each appropriate method:
//======== Update value tree ======================================================================
void CabbageIDELookAndFeel::refreshLookAndFeel(ValueTree valueTree)
{
colourTree = valueTree;
}
//======== Menubar background ======================================================================
void CabbageIDELookAndFeel::drawMenuBarBackground(Graphics &g, int width, int height, bool isMouseOverBar, MenuBarComponent &menuBar)
{
const String bgColourString = colourTree.getChildWithName("Colours").getProperty(ColourIds::menuBarBackground, Colours::grey.toString()).toString();
const Colour bgColour(Colour::fromString(bgColourString));
g.setColour (bgColour);
g.fillAll();
}
Each time a look and feel method is called it will need to query the ValueTree. Is this acceptable, or should I avoid such queries in these methods? What say you a fellow JUCEticians?