juce_Button.cpp uses legacy typedef


#1

juce_Button.cpp (and possibly other files) use ButtonListener instead of the latest term Button::Listener.


#2

Yes, I’d love to get rid of that, but it has to be written that way for VC6 compatibility, and sadly some people still need that.

Glad to see you’re having a good dig around in the codebase! One of my goals this year has been to trawl through and modernise all the creaky old code that has accumulated in the library over the years, so I do appreciate it if you want to flag up bits that don’t look quite as pristine as they could be!


#3

Heh well thanks, I’m glad you appreciate the feedback. It reassures me that Juce will continue to be robust and reliable for commercial uses.

I’m not suggesting removing the typedef from the header, I’m just saying that in the .cpp file it uses ButtonListener instead of Button::Listener. You’re saying this would break VS6?

The only reason I found this out is because I made a copy of parts of juce_Button.cpp for my own custom implementation purposes, so I ended up replicating the use of the legacy typedef in my own code.


#4

Yep. It doesn’t take much to break VC6. I won’t be supporting it for too much longer, but have a couple of users who still need it.


#5

To be honest, it’s not ButtonListener that breaks VS6. It’s mixing the Listener declaration in the base class.
For example, previous code used to read: "class A : public ButtonListener, public ValueListener"
But with new code, it became "class A : public Button::Listener, public Value::Listener"
Then VS6 got confused, since when you where declaring another Listener “inner” the class, it couldn’t figure out which one you speaked of and broke.

This is probably because VS6 doesn’t consider full namespace but only relative.
By the way (stupid reason) it’s longer to type Button::Listener than ButtonListener.