+ // Media Control events
+ //
+ this->Connect(wxID_MEDIACTRL, wxEVT_MEDIA_PLAY,
+ wxMediaEventHandler(wxMediaPlayerNotebookPage::OnMediaPlay));
+ this->Connect(wxID_MEDIACTRL, wxEVT_MEDIA_PAUSE,
+ wxMediaEventHandler(wxMediaPlayerNotebookPage::OnMediaPause));
+ this->Connect(wxID_MEDIACTRL, wxEVT_MEDIA_STOP,
+ wxMediaEventHandler(wxMediaPlayerNotebookPage::OnMediaStop));
+ this->Connect(wxID_MEDIACTRL, wxEVT_MEDIA_FINISHED,
+ wxMediaEventHandler(wxMediaPlayerNotebookPage::OnMediaFinished));
+ this->Connect(wxID_MEDIACTRL, wxEVT_MEDIA_LOADED,
+ wxMediaEventHandler(wxMediaPlayerFrame::OnMediaLoaded),
+ (wxObject*)0, parentFrame);
+
+ //
+ // Button events
+ //
+ this->Connect( wxID_BUTTONPREV, wxEVT_COMMAND_BUTTON_CLICKED,
+ wxCommandEventHandler(wxMediaPlayerFrame::OnPrev),
+ (wxObject*)0, parentFrame);
+ this->Connect( wxID_BUTTONPLAY, wxEVT_COMMAND_BUTTON_CLICKED,
+ wxCommandEventHandler(wxMediaPlayerFrame::OnPlay),
+ (wxObject*)0, parentFrame);
+ this->Connect( wxID_BUTTONSTOP, wxEVT_COMMAND_BUTTON_CLICKED,
+ wxCommandEventHandler(wxMediaPlayerFrame::OnStop),
+ (wxObject*)0, parentFrame);
+ this->Connect( wxID_BUTTONNEXT, wxEVT_COMMAND_BUTTON_CLICKED,
+ wxCommandEventHandler(wxMediaPlayerFrame::OnNext),
+ (wxObject*)0, parentFrame);
+ this->Connect( wxID_BUTTONVD, wxEVT_COMMAND_BUTTON_CLICKED,
+ wxCommandEventHandler(wxMediaPlayerFrame::OnVolumeDown),
+ (wxObject*)0, parentFrame);
+ this->Connect( wxID_BUTTONVU, wxEVT_COMMAND_BUTTON_CLICKED,
+ wxCommandEventHandler(wxMediaPlayerFrame::OnVolumeUp),
+ (wxObject*)0, parentFrame);
+}
+
+// ----------------------------------------------------------------------------
+// MyNotebook::OnBeginSeek
+//
+// Sets m_bIsBeingDragged to true to stop the timer from changing the position
+// of our slider
+// ----------------------------------------------------------------------------
+void wxMediaPlayerNotebookPage::OnBeginSeek(wxScrollEvent& WXUNUSED(event))
+{
+ m_bIsBeingDragged = true;
+}
+
+// ----------------------------------------------------------------------------
+// MyNotebook::OnEndSeek
+//
+// Called from file->seek.
+// Called when the user moves the slider -
+// seeks to a position within the media
+// then sets m_bIsBeingDragged to false to ok the timer to change the position
+// ----------------------------------------------------------------------------
+void wxMediaPlayerNotebookPage::OnEndSeek(wxScrollEvent& WXUNUSED(event))
+{
+ if( m_mediactrl->Seek(
+ m_slider->GetValue() * 1000
+ ) == wxInvalidOffset )
+ wxMessageBox(wxT("Couldn't seek in movie!"));
+
+ m_bIsBeingDragged = false;
+}
+
+// ----------------------------------------------------------------------------
+// wxMediaPlayerNotebookPage::IsBeingDragged
+//
+// Returns true if the user is dragging the slider
+// ----------------------------------------------------------------------------
+bool wxMediaPlayerNotebookPage::IsBeingDragged()
+{
+ return m_bIsBeingDragged;
+}
+
+// ----------------------------------------------------------------------------
+// wxMediaPlayerNotebookPage::OnVolChange
+//
+// Called when the user is done dragging the volume-changing slider
+// ----------------------------------------------------------------------------
+void wxMediaPlayerNotebookPage::OnVolChange(wxScrollEvent& WXUNUSED(event))
+{
+ if( m_mediactrl->SetVolume(
+ m_volSlider->GetValue() / 100.0
+ ) == false )
+ wxMessageBox(wxT("Couldn't set volume!"));
+
+}
+
+// ----------------------------------------------------------------------------
+// wxMediaPlayerNotebookPage::OnPBChange
+//
+// Called when the user is done dragging the speed-changing slider
+// ----------------------------------------------------------------------------
+void wxMediaPlayerNotebookPage::OnPBChange(wxScrollEvent& WXUNUSED(event))
+{
+ if( m_mediactrl->SetPlaybackRate(
+ m_pbSlider->GetValue() * .25
+ ) == false )
+ wxMessageBox(wxT("Couldn't set playbackrate!"));
+
+}
+
+// ----------------------------------------------------------------------------
+// wxMediaPlayerNotebookPage::OnMediaPlay
+//
+// Called when the media plays.
+// ----------------------------------------------------------------------------
+void wxMediaPlayerNotebookPage::OnMediaPlay(wxMediaEvent& WXUNUSED(event))
+{
+ m_playlist->SetItem(m_nLastFileId, 0, wxT(">"));
+}