Creating and Using custom look and feel


#1

Hi everyone!
After playing around with JUCE and checking out the examples and the forum for some time I’ve got the idea that the key to customizing the UI elements like knobs and such, is to use a custom look and feel class.
I’m familiar with the theory (c++ and classes and stuff), and i have checked out the laf demo, but a working example or a step by step tutorial would be great.
To be honest im overwhelmed by how time consuming is to figure out and do basic stuff like designing a decent GUI with JUCE.
Thanks.


#2

non sense, making a great GUI with JUCE is far easier than other environments.

Take a look into the Look and Feel classes. Find an object you want to customize. Say you want to customize a rotary slider.

make a new class

class customSlider : public LookAndFeel_V3
{
void drawRotarySlider (Graphics& g, int x, int y, int width, int height, float sliderPos,
float rotaryStartAngle, float rotaryEndAngle, Slider& slider) override
{
Put your custom drawing code here. Look inside the base class for a place to start
}
}

Then instantiate this custom look and feel in your application, and apply it to your knob.

customKnob->setLookAndFeel(customLookAndFeel)

you can also apply your custom look and feel to your entire application so you don’t need to apply it to every knob individually


#3

Thanks i think i got it. I added the class to plugineditor.h and the following to .cpp file:

customSlider* lafobjct = new customSlider();
setLookAndFeel(lafobjct);

It kinda works but im not sure its a right way to do it.
Also “MySlider1->setLookAndFeel(lafobjct)” didn’t work for the specific slider. I’ll look around more for the answer.


#4

One thing that might be useful for learning curve is understand the usage of ColourIds.
Since, if you comply to ColourIds in your Look&Feel you can use single LookAndFeel for multiple knobs in different colors for example.