]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/msw/moviectrl.h | |
3 | // Purpose: DirectX7+ wxMovieCtrl MSW | |
4 | // Author: Ryan Norton <wxprojects@comcast.net> | |
5 | // Modified by: | |
6 | // Created: 11/07/04 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Ryan Norton | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #include "wx/defs.h" | |
13 | ||
14 | #if wxUSE_MOVIECTRL | |
15 | ||
16 | #include "wx/datetime.h" | |
17 | #include "wx/control.h" | |
18 | ||
19 | enum wxMovieCtrlState | |
20 | { | |
21 | wxMOVIECTRL_STOPPED, | |
22 | wxMOVIECTRL_PAUSED, | |
23 | wxMOVIECTRL_PLAYING | |
24 | }; | |
25 | ||
26 | class wxMovieCtrl : public wxControl | |
27 | { | |
28 | public: | |
29 | wxMovieCtrl() | |
30 | { } | |
31 | ||
32 | wxMovieCtrl(wxWindow* parent, wxWindowID id, const wxString& fileName, const wxString& label = wxT(""), | |
33 | const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, | |
34 | long style = 0, const wxString& name = wxPanelNameStr) | |
35 | { Create(parent, id, fileName, label, pos, size, style, name); } | |
36 | ||
37 | ~wxMovieCtrl(); | |
38 | ||
39 | bool Create(wxWindow* parent, wxWindowID id, const wxString& fileName, const wxString& label = wxT(""), | |
40 | const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, | |
41 | long style = 0, const wxString& name = wxPanelNameStr); | |
42 | ||
43 | bool Play(); | |
44 | bool Pause(); | |
45 | bool Stop(); | |
46 | ||
47 | wxMovieCtrlState GetState(); | |
48 | ||
49 | double GetPlaybackRate(); | |
50 | bool SetPlaybackRate(double dRate); | |
51 | ||
52 | #if wxUSE_DATETIME | |
53 | bool Seek(const wxTimeSpan& where); | |
54 | wxTimeSpan Tell(); | |
55 | wxTimeSpan Length(); | |
56 | #endif | |
57 | ||
58 | virtual void SetLabel(const wxString& label); | |
59 | ||
60 | protected: | |
61 | void OnSize(wxSizeEvent& evt); | |
62 | wxSize DoGetBestSize() const; | |
63 | bool m_bVideo; | |
64 | ||
65 | //msw-specific - we need to overload the window proc | |
66 | WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); | |
67 | ||
68 | void* m_pGB; | |
69 | void* m_pMC; | |
70 | void* m_pME; | |
71 | void* m_pVW; | |
72 | void* m_pBA; | |
73 | void* m_pBV; | |
74 | void* m_pMS; | |
75 | ||
76 | wxSize m_bestSize; | |
77 | ||
78 | DECLARE_DYNAMIC_CLASS(wxMovieCtrl); | |
79 | }; | |
80 | ||
81 | //Event stuff | |
82 | class WXDLLEXPORT wxMovieEvent : public wxNotifyEvent | |
83 | { | |
84 | public: | |
85 | wxMovieEvent(wxEventType commandType = wxEVT_NULL, int id = 0) | |
86 | : wxNotifyEvent(commandType, id) | |
87 | { } | |
88 | ||
89 | wxMovieEvent(const wxMovieEvent &clone) | |
90 | : wxNotifyEvent(clone.GetEventType(), clone.GetId()) | |
91 | { } | |
92 | ||
93 | wxEvent *Clone() { return new wxMovieEvent(*this); } | |
94 | ||
95 | DECLARE_DYNAMIC_CLASS(wxMovieEvent) | |
96 | }; | |
97 | ||
98 | #define wxMOVIE_FINISHED_ID 13000 | |
99 | DECLARE_EVENT_TYPE(wxEVT_MOVIE_FINISHED, wxMOVIE_FINISHED_ID) | |
100 | typedef void (wxEvtHandler::*wxMovieEventFunction)(wxMovieEvent&); | |
101 | #define EVT_MOVIE_FINISHED(winid, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MOVIE_FINISHED, winid, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxMovieEventFunction) & fn, (wxObject *) NULL ), | |
102 | ||
103 | #endif // wxUSE_MOVIECTRL |