What I would like to do is to add a condition for the button to toggle, if the condition isn't met the button does nothing. I tried to create this setting with a normal wxwidgets button first but couldn't find an easy way to change the style of the button after my condition was met.
While not pretty I fixed it by setting the togglebutton value through the SetValue(bool) function and set it to false to un-toggle the button if the condition failed:
void MyButton::onPressed(wxCommandEvent& event) {
if (CONDITION) {
SetValue(false);
}
}