add Length, Tell, SetPlaybackRate and GetPlaybackRate - use Connect instead of message maps - on MSW don't assert if the file has no video and only sound - add event for when the movie finishes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30336 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Ryan Norton
2004-11-07 10:56:06 +00:00
parent fe27303f7a
commit 0568fd59ca
4 changed files with 160 additions and 58 deletions

View File

@@ -14,6 +14,7 @@
#if wxUSE_MOVIECTRL
#include "wx/datetime.h"
#include "wx/control.h"
enum wxMovieCtrlState
{
@@ -45,12 +46,15 @@ public:
wxMovieCtrlState GetState();
double GetPlaybackRate();
bool SetPlaybackRate(double dRate);
#if wxUSE_DATETIME
bool Seek(const wxTimeSpan& where);
wxTimeSpan Tell();
wxTimeSpan Length();
#endif
virtual void SetLabel(const wxString& label);
protected:
void OnSize(wxSizeEvent& evt);
wxSize DoGetBestSize() const;
@@ -59,9 +63,32 @@ protected:
struct MovieRecord* m_movie;
wxSize m_bestSize;
class _wxQTTimer* m_timer;
friend class _wxQTTimer;
DECLARE_DYNAMIC_CLASS(wxMovieCtrl);
DECLARE_EVENT_TABLE()
};
//Event stuff
class WXDLLEXPORT wxMovieEvent : public wxNotifyEvent
{
public:
wxMovieEvent(wxEventType commandType = wxEVT_NULL, int id = 0)
: wxNotifyEvent(commandType, id)
{ }
wxMovieEvent(const wxMovieEvent &clone)
: wxNotifyEvent(clone.GetEventType(), clone.GetId())
{ }
wxEvent *Clone() { return new wxMovieEvent(*this); }
DECLARE_DYNAMIC_CLASS(wxMovieEvent)
};
#define wxMOVIE_FINISHED_ID 13000
DECLARE_EVENT_TYPE(wxEVT_MOVIE_FINISHED, wxMOVIE_FINISHED_ID)
typedef void (wxEvtHandler::*wxMovieEventFunction)(wxMovieEvent&);
#define EVT_MOVIE_FINISHED(winid, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MOVIE_FINISHED, winid, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxMovieEventFunction) & fn, (wxObject *) NULL ),
#endif // wxUSE_MOVIECTRL

View File

@@ -14,6 +14,7 @@
#if wxUSE_MOVIECTRL
#include "wx/datetime.h"
#include "wx/control.h"
enum wxMovieCtrlState
{
@@ -45,8 +46,13 @@ public:
wxMovieCtrlState GetState();
double GetPlaybackRate();
bool SetPlaybackRate(double dRate);
#if wxUSE_DATETIME
bool Seek(const wxTimeSpan& where);
wxTimeSpan Tell();
wxTimeSpan Length();
#endif
virtual void SetLabel(const wxString& label);
@@ -54,11 +60,10 @@ public:
protected:
void OnSize(wxSizeEvent& evt);
wxSize DoGetBestSize() const;
// void OnActivate(wxActivateEvent& evt);
bool m_bVideo;
//msw-specific - we need to overload the window proc
// WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
void* m_pGB;
void* m_pMC;
@@ -71,7 +76,28 @@ protected:
wxSize m_bestSize;
DECLARE_DYNAMIC_CLASS(wxMovieCtrl);
DECLARE_EVENT_TABLE()
};
//Event stuff
class WXDLLEXPORT wxMovieEvent : public wxNotifyEvent
{
public:
wxMovieEvent(wxEventType commandType = wxEVT_NULL, int id = 0)
: wxNotifyEvent(commandType, id)
{ }
wxMovieEvent(const wxMovieEvent &clone)
: wxNotifyEvent(clone.GetEventType(), clone.GetId())
{ }
wxEvent *Clone() { return new wxMovieEvent(*this); }
DECLARE_DYNAMIC_CLASS(wxMovieEvent)
};
#define wxMOVIE_FINISHED_ID 13000
DECLARE_EVENT_TYPE(wxEVT_MOVIE_FINISHED, wxMOVIE_FINISHED_ID)
typedef void (wxEvtHandler::*wxMovieEventFunction)(wxMovieEvent&);
#define EVT_MOVIE_FINISHED(winid, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MOVIE_FINISHED, winid, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxMovieEventFunction) & fn, (wxObject *) NULL ),
#endif // wxUSE_MOVIECTRL