]>
Commit | Line | Data |
---|---|---|
4ad7af2b RN |
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" | |
0568fd59 | 17 | #include "wx/control.h" |
4ad7af2b RN |
18 | |
19 | enum wxMovieCtrlState | |
20 | { | |
21 | wxMOVIECTRL_STOPPED, | |
22 | wxMOVIECTRL_PAUSED, | |
23 | wxMOVIECTRL_PLAYING | |
24 | }; | |
25 | ||
26 | class wxMovieCtrl : public wxControl | |
27 | { | |
28 | public: | |
3a774635 | 29 | wxMovieCtrl() : m_bLoaded(false) |
4ad7af2b RN |
30 | { } |
31 | ||
32 | wxMovieCtrl(wxWindow* parent, wxWindowID id, const wxString& fileName, const wxString& label = wxT(""), | |
33 | const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, | |
3a774635 | 34 | long style = 0, const wxString& name = wxPanelNameStr) : m_bLoaded(false) |
4ad7af2b RN |
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(); | |
3a774635 RN |
46 | |
47 | bool Load(const wxString& fileName); | |
4ad7af2b RN |
48 | |
49 | wxMovieCtrlState GetState(); | |
50 | ||
0568fd59 RN |
51 | double GetPlaybackRate(); |
52 | bool SetPlaybackRate(double dRate); | |
53 | ||
4ad7af2b RN |
54 | #if wxUSE_DATETIME |
55 | bool Seek(const wxTimeSpan& where); | |
0568fd59 RN |
56 | wxTimeSpan Tell(); |
57 | wxTimeSpan Length(); | |
4ad7af2b RN |
58 | #endif |
59 | ||
60 | virtual void SetLabel(const wxString& label); | |
61 | ||
62 | protected: | |
63 | void OnSize(wxSizeEvent& evt); | |
64 | wxSize DoGetBestSize() const; | |
3a774635 RN |
65 | void Cleanup(); |
66 | ||
0568fd59 | 67 | bool m_bVideo; |
3a774635 | 68 | bool m_bLoaded; |
4ad7af2b RN |
69 | |
70 | //msw-specific - we need to overload the window proc | |
0568fd59 | 71 | WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); |
4ad7af2b RN |
72 | |
73 | void* m_pGB; | |
74 | void* m_pMC; | |
75 | void* m_pME; | |
76 | void* m_pVW; | |
77 | void* m_pBA; | |
78 | void* m_pBV; | |
79 | void* m_pMS; | |
80 | ||
81 | wxSize m_bestSize; | |
82 | ||
83 | DECLARE_DYNAMIC_CLASS(wxMovieCtrl); | |
4ad7af2b RN |
84 | }; |
85 | ||
0568fd59 RN |
86 | //Event stuff |
87 | class WXDLLEXPORT wxMovieEvent : public wxNotifyEvent | |
88 | { | |
89 | public: | |
90 | wxMovieEvent(wxEventType commandType = wxEVT_NULL, int id = 0) | |
91 | : wxNotifyEvent(commandType, id) | |
92 | { } | |
93 | ||
94 | wxMovieEvent(const wxMovieEvent &clone) | |
95 | : wxNotifyEvent(clone.GetEventType(), clone.GetId()) | |
96 | { } | |
97 | ||
98 | wxEvent *Clone() { return new wxMovieEvent(*this); } | |
99 | ||
100 | DECLARE_DYNAMIC_CLASS(wxMovieEvent) | |
101 | }; | |
102 | ||
103 | #define wxMOVIE_FINISHED_ID 13000 | |
104 | DECLARE_EVENT_TYPE(wxEVT_MOVIE_FINISHED, wxMOVIE_FINISHED_ID) | |
105 | typedef void (wxEvtHandler::*wxMovieEventFunction)(wxMovieEvent&); | |
106 | #define EVT_MOVIE_FINISHED(winid, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MOVIE_FINISHED, winid, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxMovieEventFunction) & fn, (wxObject *) NULL ), | |
107 | ||
4ad7af2b | 108 | #endif // wxUSE_MOVIECTRL |