Testing for Whether Control or Style Implemented

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
beadsland
In need of some credit
In need of some credit
Posts: 5
Joined: Mon Nov 30, 2015 3:11 pm

Testing for Whether Control or Style Implemented

Post by beadsland »

So, I'm looking at docs for wxSpinButton, and note recommendation that cross-platform safe applications use wxSpinCtrl, as it devolves nicely where wxSpinButton isn't implemented. Okay, good.

My question is, how might one test at run-time whether wxSpinButton is implemented? Is it reasonable to assume that the class is not declared at all, or that it is but its constructor returns void (so, nil under wxLua)? Not having a platform where it isn't implemented to test, I'm hoping someone has experience with this and can advise.

A related question is how to determine at run-time if a given style (here, wxSP_HORIZONTAL) is implemented? I suppose there's a way to test if running as wxGTK (which doesn't support horizontal spin style) and assume it is implemented otherwise, but if there's a more general programmatic solution for confirming whether styles are implemented that'd be nice. I'd prefer to write tests that allow for future partial implementations, rather than hard-coding tests for contemporaneously known partials only.

I'm working on creating a derived class in wxLua that emulates wxSpinButton with a pair of vanilla buttons. I want it to default to the preferred wx implementation on those platforms where wxSpinButton happens to be implemented at the desired orientation, and to present the Lua emulation otherwise. Hence my question.

Any musings on this topic would be appreciated!
Post Reply