]>
Commit | Line | Data |
---|---|---|
1a680109 RN |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/msw/mediactrl.h | |
3 | // Purpose: DirectX7+ wxMediaCtrl 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_MEDIACTRL | |
15 | ||
16 | #include "wx/control.h" | |
17 | #include "wx/uri.h" | |
18 | ||
19 | enum wxMediaState | |
20 | { | |
21 | wxMEDIASTATE_STOPPED, | |
22 | wxMEDIASTATE_PAUSED, | |
23 | wxMEDIASTATE_PLAYING | |
24 | }; | |
25 | ||
26 | class wxMediaCtrl : public wxControl | |
27 | { | |
28 | public: | |
29 | wxMediaCtrl() : m_imp(NULL) | |
30 | { } | |
31 | ||
32 | wxMediaCtrl(wxWindow* parent, wxWindowID id, const wxString& fileName, | |
33 | const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, | |
34 | long style = 0, long driver = 0, const wxString& name = wxPanelNameStr) : m_imp(NULL) | |
35 | { Create(parent, id, fileName, pos, size, style, driver, name); } | |
36 | ||
37 | ||
38 | wxMediaCtrl(wxWindow* parent, wxWindowID id, const wxURI& location, | |
39 | const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, | |
40 | long style = 0, long driver = 0, const wxString& name = wxPanelNameStr) : m_imp(NULL) | |
41 | { Create(parent, id, location, pos, size, style, driver, name); } | |
42 | ||
43 | ~wxMediaCtrl(); | |
44 | ||
45 | bool Create(wxWindow* parent, wxWindowID id, const wxString& fileName, | |
46 | const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, | |
47 | long style = 0, long driver = 0, const wxString& name = wxPanelNameStr); | |
48 | ||
49 | bool Create(wxWindow* parent, wxWindowID id, const wxURI& location, | |
50 | const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, | |
51 | long style = 0, long driver = 0, const wxString& name = wxPanelNameStr); | |
52 | ||
53 | bool Play(); | |
54 | bool Pause(); | |
55 | bool Stop(); | |
56 | ||
57 | bool Load(const wxString& fileName); | |
58 | bool Load(const wxURI& location); | |
59 | ||
60 | wxMediaState GetState(); | |
61 | ||
62 | double GetPlaybackRate(); | |
63 | bool SetPlaybackRate(double dRate); | |
64 | ||
65 | bool SetPosition(long where); | |
66 | long GetPosition(); | |
67 | long GetDuration(); | |
68 | ||
69 | protected: | |
70 | virtual void DoMoveWindow(int x, int y, int w, int h); | |
71 | wxSize DoGetBestSize() const; | |
72 | ||
73 | //msw-specific - we need to overload the window proc | |
74 | WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); | |
75 | ||
76 | class wxMediaCtrlImpl* m_imp; | |
77 | bool m_bLoaded; | |
78 | ||
79 | DECLARE_DYNAMIC_CLASS(wxMediaCtrl); | |
80 | }; | |
81 | ||
82 | //Event stuff | |
83 | class WXDLLEXPORT wxMediaEvent : public wxNotifyEvent | |
84 | { | |
85 | public: | |
86 | wxMediaEvent(wxEventType commandType = wxEVT_NULL, int id = 0) | |
87 | : wxNotifyEvent(commandType, id) | |
88 | { } | |
89 | ||
90 | wxMediaEvent(const wxMediaEvent &clone) | |
91 | : wxNotifyEvent(clone.GetEventType(), clone.GetId()) | |
92 | { } | |
93 | ||
94 | wxEvent *Clone() { return new wxMediaEvent(*this); } | |
95 | ||
96 | DECLARE_DYNAMIC_CLASS(wxMediaEvent) | |
97 | }; | |
98 | ||
99 | #define wxMEDIA_FINISHED_ID 13000 | |
100 | DECLARE_EVENT_TYPE(wxEVT_MEDIA_FINISHED, wxMEDIA_FINISHED_ID) | |
101 | typedef void (wxEvtHandler::*wxMediaEventFunction)(wxMediaEvent&); | |
102 | #define EVT_MEDIA_FINISHED(winid, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_FINISHED, winid, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxMediaEventFunction) & fn, (wxObject *) NULL ), | |
103 | ||
104 | #endif // wxUSE_MEDIACTRL |