Support wxGenericAnimationCtrl by the animation control XRC handler

This commit is contained in:
Ilya Sinitsyn
2020-06-09 01:43:40 +07:00
committed by Vadim Zeitlin
parent cc5fb63bf7
commit 2cdcd84928
3 changed files with 77 additions and 11 deletions

View File

@@ -52,6 +52,7 @@
#include "objrefdlg.h"
// For functions to manipulate the corresponding controls.
#include "wx/animate.h"
#include "wx/generic/animate.h"
#include "wx/infobar.h"
#include "wx/treectrl.h"
#include "wx/listctrl.h"
@@ -206,14 +207,17 @@ void MyFrame::OnAnimationCtrlPlay(wxCommandEvent& event)
wxWindow *win = btn->GetParent();
wxAnimationCtrl *ctrl = XRCCTRL(*win, "controls_animation_ctrl", wxAnimationCtrl);
wxGenericAnimationCtrl *generic =
XRCCTRL(*win, "controls_generic_animation_ctrl", wxGenericAnimationCtrl);
if (ctrl->IsPlaying())
{
ctrl->Stop();
generic->Stop();
btn->SetLabel("Play");
}
else
{
if (ctrl->Play())
if ( ctrl->Play() && generic->Play() )
btn->SetLabel("Stop");
else
wxLogError("Cannot play the animation...");