[FR] About LnF

Hi Jules,

 

Would it be possible to add some ref counting to the LookAndFeel at some point ?

Right now each time you want a widget with a custom look, you have to setup a new LnF class (so far no biggie) but you have to keep a reference of it somewhere and this is painfull.

 

Thanks,

It's something I've thought about, but would probably break a few things, as everyone at the moment is deleting them manually, so if something began using a ref-count, that could cause a conflict. I've also found it annoying sometimes though, so would like to figure out some way of making it easier to do.

Thanks !

Much appreciated.

In my case I've made a LookAndFeelManager singleton class that holds some dedicated lookandfeel objects for the current project. The LnFs are created on it's first reference and deleted at shutdown.. Anywhere in my project where i need to set a lookandfeel  i can simply call something like popupMenu.setLookAndFeel (LookAndFeelManager::getInstance()->getDarkPopupMenu()); and don't worry about keeping a reference.. 

You can also just use a SharedResourcePointer

Well the point was not to keep any reference as the actual component could do it for me :)

well if you change the signature of Component::setLookAndFeel then people will notice the difference :)

Not sure this is the kind of code which is used often in a projet though.