diff --git a/samples/xrc/myframe.cpp b/samples/xrc/myframe.cpp
index 29296978d9..546667440c 100644
--- a/samples/xrc/myframe.cpp
+++ b/samples/xrc/myframe.cpp
@@ -178,6 +178,27 @@ void MyFrame::OnDerivedDialogToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
preferencesDialog.ShowModal();
}
+void MyFrame::OnAnimationCtrlPlay(wxCommandEvent& event)
+{
+#if wxUSE_ANIMATIONCTRL
+ // get the pointers we need
+ wxButton *btn = wxDynamicCast(event.GetEventObject(), wxButton);
+ if (!btn || !btn->GetParent()) return;
+
+ wxWindow *win = btn->GetParent();
+ wxAnimationCtrl *ctrl = XRCCTRL(*win, "controls_animation_ctrl", wxAnimationCtrl);
+ if (ctrl->IsPlaying())
+ {
+ ctrl->Stop();
+ btn->SetLabel(wxT("Play"));
+ }
+ else
+ {
+ ctrl->Play();
+ btn->SetLabel(wxT("Stop"));
+ }
+#endif
+}
void MyFrame::OnControlsToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
{
@@ -219,6 +240,13 @@ void MyFrame::OnControlsToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
treectrl->AppendItem(treectrl->GetRootItem(), _("Evil accountant"));
#endif
+#if wxUSE_ANIMATIONCTRL
+ // dynamically connect our event handler for the "clicked" event of the "play" button
+ // in the animation ctrl page of our dialog
+ dlg.Connect(XRCID("controls_animation_button_play"), wxEVT_COMMAND_BUTTON_CLICKED,
+ wxCommandEventHandler(MyFrame::OnAnimationCtrlPlay));
+#endif
+
// All done. Show the dialog.
dlg.ShowModal();
}
diff --git a/samples/xrc/myframe.h b/samples/xrc/myframe.h
index 4ed521d9d4..c9f4ac9761 100644
--- a/samples/xrc/myframe.h
+++ b/samples/xrc/myframe.h
@@ -48,6 +48,7 @@ private:
void OnPlatformPropertyToolOrMenuCommand(wxCommandEvent& event);
void OnArtProviderToolOrMenuCommand(wxCommandEvent& event);
void OnVariableExpansionToolOrMenuCommand(wxCommandEvent& event);
+ void OnAnimationCtrlPlay(wxCommandEvent& event);
// Any class wishing to process wxWidgets events must use this macro
DECLARE_EVENT_TABLE()
diff --git a/samples/xrc/rc/controls.xrc b/samples/xrc/rc/controls.xrc
index f1b5a3f559..71c4e565d6 100644
--- a/samples/xrc/rc/controls.xrc
+++ b/samples/xrc/rc/controls.xrc
@@ -1057,6 +1057,39 @@
+
+
diff --git a/samples/xrc/xrcdemo.bkl b/samples/xrc/xrcdemo.bkl
index 8133e86db0..f4ed1e1568 100644
--- a/samples/xrc/xrcdemo.bkl
+++ b/samples/xrc/xrcdemo.bkl
@@ -29,6 +29,7 @@
fuzzy.gif menu.xrc platform.xpm platform.xrc quotes.gif
resource.xrc toolbar.xrc uncenter.xpm
uncenter.xrc update.gif variable.xpm variable.xrc
+ throbber.gif stop.xpm