]> git.saurik.com Git - wxWidgets.git/commitdiff
added wxAnimateCtrl test (rest of the patch 1581391)
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 22 Oct 2006 12:12:41 +0000 (12:12 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 22 Oct 2006 12:12:41 +0000 (12:12 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42235 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/xrc/myframe.cpp
samples/xrc/myframe.h
samples/xrc/rc/controls.xrc
samples/xrc/xrcdemo.bkl

index 29296978d96038252ea73ef812d80d33aa5bf72d..546667440cf7b67ac266252b2622e32e872ab6e5 100644 (file)
@@ -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();
 }
index 4ed521d9d412b6a89ef007b48c520c56c0e4a188..c9f4ac97619e2245b1ffd70df18a2ed6331caa61 100644 (file)
@@ -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()
index f1b5a3f559567f08999bb097f51871f39ef082f3..71c4e565d6c990a11bdb750f7ad832f8a0976bc5 100644 (file)
                     </object>
                 </object>
 
+                <object class="notebookpage">
+                    <label>wxAnimationCtrl</label>
+                    <object class="wxPanel" name="animctrl">
+                        <object class="wxFlexGridSizer">
+                            <cols>2</cols>
+                            <rows>1</rows>
+                            <vgap>0</vgap>
+                            <hgap>0</hgap>
+                            <growablecols>0,1</growablecols>
+                            <growablerows>0</growablerows>
+
+                            <object class="sizeritem">
+                                <flag>wxALIGN_CENTRE|wxALL</flag>
+                                <border>5</border>
+                                <object class="wxButton" name="controls_animation_button_play">
+                                    <size>200,180</size>
+                                    <label>Play</label>
+                                </object>
+                            </object>
+
+                            <object class="sizeritem">
+                                <flag>wxALIGN_CENTRE|wxALL</flag>
+                                <border>5</border>
+                                <object class="wxAnimationCtrl" name="controls_animation_ctrl">
+                                    <animation>throbber.gif</animation>
+                                    <inactive-bitmap>stop.xpm</inactive-bitmap>
+                                </object>
+                            </object>
+
+                        </object>
+                    </object>
+                </object>
+
                 <object class="notebookpage">
                     <label>The Rest</label>
                     <object class="wxPanel" name="Rest">
index 8133e86db0e440e366edfdfeb38bfdff6fd7e280..f4ed1e156881577d45f0c28078bc428c47f4dde5 100644 (file)
@@ -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
         </files>
     </wx-data>