Merge branch 'xrc-generic-animation-ctrl'

Extend wxAnimationCtrl XRC handler to cover wxGenericAnimationCtrl too.

Also fix a bug with wxGenericAnimationCtrl inactive bitmap background.

See https://github.com/wxWidgets/wxWidgets/pull/1889
This commit is contained in:
Vadim Zeitlin
2020-06-10 00:02:59 +02:00
26 changed files with 137 additions and 200 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...");

View File

@@ -68,7 +68,7 @@
<object class="wxPanel" name="animctrl">
<object class="wxFlexGridSizer">
<cols>2</cols>
<rows>1</rows>
<rows>2</rows>
<vgap>0</vgap>
<hgap>0</hgap>
<growablecols>0,1</growablecols>
@@ -91,6 +91,17 @@
</object>
</object>
<object class="spacer"/>
<object class="sizeritem">
<flag>wxALIGN_CENTRE|wxALL</flag>
<border>5</border>
<object class="wxGenericAnimationCtrl" name="controls_generic_animation_ctrl">
<animation>throbber.gif</animation>
<inactive-bitmap>stop.xpm</inactive-bitmap>
</object>
</object>
</object>
</object>
</object>