]>
Commit | Line | Data |
---|---|---|
256c055e RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: media.i | |
3 | // Purpose: SWIG definitions for the wxMediaCtrl | |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 23-Nov-2004 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 2004 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | %define DOCSTRING | |
e3f1b5b5 | 14 | "Classes for a media player control" |
256c055e RD |
15 | %enddef |
16 | ||
17 | %module(package="wx", docstring=DOCSTRING) media | |
18 | ||
19 | ||
20 | %{ | |
21 | #include "wx/wxPython/wxPython.h" | |
22 | #include "wx/wxPython/pyclasses.h" | |
23 | ||
24 | #include <wx/mediactrl.h> | |
4d5009f9 | 25 | #include <wx/uri.h> |
256c055e RD |
26 | %} |
27 | ||
28 | //---------------------------------------------------------------------- | |
29 | ||
30 | %import core.i | |
31 | %pythoncode { wx = _core } | |
32 | %pythoncode { __docfilter__ = wx.__DocFilter(globals()) } | |
33 | ||
34 | %include _media_rename.i | |
35 | ||
36 | //--------------------------------------------------------------------------- | |
37 | ||
38 | %typemap(in) wxLongLong { | |
39 | $1 = PyLong_AsLongLong($input); | |
40 | } | |
41 | ||
42 | ||
43 | %typemap(out) wxLongLong { | |
44 | $result = PyLong_FromLongLong($1.GetValue()); | |
45 | } | |
46 | ||
47 | //--------------------------------------------------------------------------- | |
48 | // Make a stubbed out class for platforms that don't have wxMediaCtrl | |
49 | %{ | |
50 | #if !wxUSE_MEDIACTRL | |
51 | enum wxMediaState | |
52 | { | |
53 | wxMEDIASTATE_STOPPED=0, | |
54 | wxMEDIASTATE_PAUSED=0, | |
55 | wxMEDIASTATE_PLAYING=0 | |
56 | }; | |
57 | ||
02b800ce RD |
58 | enum wxMediaCtrlPlayerControls |
59 | { | |
60 | wxMEDIACTRLPLAYERCONTROLS_NONE, | |
61 | wxMEDIACTRLPLAYERCONTROLS_STEP, | |
62 | wxMEDIACTRLPLAYERCONTROLS_VOLUME, | |
63 | wxMEDIACTRLPLAYERCONTROLS_DEFAULT | |
64 | }; | |
256c055e | 65 | |
02b800ce | 66 | |
63cd6e0b | 67 | class wxMediaEvent : public wxNotifyEvent |
256c055e RD |
68 | { |
69 | public: | |
4d5009f9 | 70 | wxMediaEvent(wxEventType, int ) { wxPyRaiseNotImplemented(); } |
256c055e RD |
71 | }; |
72 | ||
73 | class wxMediaCtrl : public wxControl | |
74 | { | |
75 | public: | |
6ed7f20d | 76 | wxMediaCtrl() { wxPyRaiseNotImplemented(); } |
256c055e RD |
77 | |
78 | wxMediaCtrl(wxWindow* , wxWindowID , | |
79 | const wxString& , | |
80 | const wxPoint& , | |
81 | const wxSize& , | |
82 | long style , | |
83 | const wxString& , | |
84 | const wxValidator& , | |
85 | const wxString& ) { wxPyRaiseNotImplemented(); } | |
86 | ||
256c055e RD |
87 | bool Create(wxWindow* , wxWindowID , |
88 | const wxString& , | |
89 | const wxPoint& , | |
90 | const wxSize& , | |
91 | long style , | |
92 | const wxString& , | |
93 | const wxValidator& , | |
94 | const wxString& ) { return false; } | |
95 | ||
256c055e RD |
96 | bool Play() { return false; } |
97 | bool Pause() { return false; } | |
98 | bool Stop() { return false; } | |
99 | ||
256c055e RD |
100 | wxMediaState GetState() { return wxMEDIASTATE_STOPPED; } |
101 | ||
e3f1b5b5 | 102 | double GetPlaybackRate() { return 0.0; } |
256c055e RD |
103 | bool SetPlaybackRate(double dRate) { return false; } |
104 | ||
e3f1b5b5 RD |
105 | wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart) |
106 | { return 0; } | |
107 | ||
108 | wxFileOffset Tell() { return 0; } | |
109 | wxFileOffset Length() { return 0; } | |
6c75a4cf RD |
110 | |
111 | double GetVolume() { return 0.0; } | |
112 | bool SetVolume(double dVolume) { return false; } | |
02b800ce RD |
113 | |
114 | bool ShowPlayerControls( | |
115 | wxMediaCtrlPlayerControls flags = wxMEDIACTRLPLAYERCONTROLS_DEFAULT) | |
116 | { return false; } | |
117 | ||
118 | bool Load(const wxString& fileName) { return false; } | |
119 | bool LoadURI(const wxString& fileName) { return false; } | |
120 | bool LoadURIWithProxy(const wxString& fileName, const wxString& proxy) { return false; } | |
256c055e | 121 | }; |
4d5009f9 RD |
122 | |
123 | const wxEventType wxEVT_MEDIA_FINISHED = 0; | |
124 | const wxEventType wxEVT_MEDIA_STOP = 0; | |
125 | ||
256c055e RD |
126 | #endif |
127 | %} | |
128 | ||
129 | ||
130 | ||
131 | //--------------------------------------------------------------------------- | |
132 | ||
133 | enum wxMediaState | |
134 | { | |
135 | wxMEDIASTATE_STOPPED, | |
136 | wxMEDIASTATE_PAUSED, | |
137 | wxMEDIASTATE_PLAYING | |
138 | }; | |
139 | ||
256c055e RD |
140 | |
141 | ||
4d5009f9 RD |
142 | // MAKE_CONST_WXSTRING(MEDIABACKEND_DIRECTSHOW); |
143 | // MAKE_CONST_WXSTRING(MEDIABACKEND_MCI ); | |
144 | // MAKE_CONST_WXSTRING(MEDIABACKEND_QUICKTIME ); | |
256c055e RD |
145 | |
146 | //--------------------------------------------------------------------------- | |
147 | ||
148 | class wxMediaEvent : public wxNotifyEvent | |
149 | { | |
150 | public: | |
151 | wxMediaEvent(wxEventType commandType = wxEVT_NULL, int id = 0); | |
152 | }; | |
153 | ||
154 | ||
155 | //--------------------------------------------------------------------------- | |
156 | ||
157 | MAKE_CONST_WXSTRING_NOSWIG(EmptyString); | |
4d5009f9 | 158 | MAKE_CONST_WXSTRING2(MediaCtrlNameStr, wxT("mediaCtrl")); |
256c055e RD |
159 | MustHaveApp(wxMediaCtrl); |
160 | ||
161 | ||
162 | class wxMediaCtrl : public wxControl | |
163 | { | |
164 | public: | |
165 | %pythonAppend wxMediaCtrl "self._setOORInfo(self)" | |
166 | %pythonAppend wxMediaCtrl() "" | |
167 | ||
168 | ||
95262b5f RD |
169 | wxMediaCtrl(wxWindow* parent, |
170 | wxWindowID id=-1, | |
256c055e RD |
171 | const wxString& fileName = wxPyEmptyString, |
172 | const wxPoint& pos = wxDefaultPosition, | |
173 | const wxSize& size = wxDefaultSize, | |
174 | long style = 0, | |
175 | const wxString& szBackend = wxPyEmptyString, | |
176 | const wxValidator& validator = wxDefaultValidator, | |
177 | const wxString& name = wxPyMediaCtrlNameStr); | |
178 | ||
1b8c7ba6 | 179 | %RenameCtor(PreMediaCtrl, wxMediaCtrl()); |
256c055e | 180 | |
95262b5f RD |
181 | bool Create(wxWindow* parent, |
182 | wxWindowID id=-1, | |
256c055e RD |
183 | const wxString& fileName = wxPyEmptyString, |
184 | const wxPoint& pos = wxDefaultPosition, | |
185 | const wxSize& size = wxDefaultSize, | |
186 | long style = 0, | |
187 | const wxString& szBackend = wxPyEmptyString, | |
188 | const wxValidator& validator = wxDefaultValidator, | |
189 | const wxString& name = wxPyMediaCtrlNameStr); | |
190 | ||
191 | ||
192 | bool Play(); | |
193 | bool Pause(); | |
194 | bool Stop(); | |
195 | ||
256c055e RD |
196 | wxMediaState GetState(); |
197 | ||
198 | double GetPlaybackRate(); | |
199 | bool SetPlaybackRate(double dRate); | |
200 | ||
e3f1b5b5 RD |
201 | wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart); |
202 | wxFileOffset Tell(); | |
203 | wxFileOffset Length(); | |
02b800ce RD |
204 | |
205 | double GetVolume(); | |
206 | bool SetVolume(double dVolume); | |
207 | ||
208 | bool ShowPlayerControls( | |
209 | wxMediaCtrlPlayerControls flags = wxMEDIACTRLPLAYERCONTROLS_DEFAULT); | |
210 | ||
211 | bool Load(const wxString& fileName); | |
212 | bool LoadURI(const wxString& fileName); | |
213 | bool LoadURIWithProxy(const wxString& fileName, const wxString& proxy); | |
214 | %pythoncode { LoadFromURI = LoadURI } | |
256c055e RD |
215 | }; |
216 | ||
217 | ||
218 | ||
219 | %constant wxEventType wxEVT_MEDIA_FINISHED; | |
220 | %constant wxEventType wxEVT_MEDIA_STOP; | |
221 | ||
222 | %pythoncode { | |
223 | EVT_MEDIA_FINISHED = wx.PyEventBinder( wxEVT_MEDIA_FINISHED, 1) | |
224 | EVT_MEDIA_STOP = wx.PyEventBinder( wxEVT_MEDIA_STOP, 1) | |
225 | } | |
226 | ||
227 | //--------------------------------------------------------------------------- | |
228 | ||
229 | %init %{ | |
230 | %} | |
231 | ||
232 | //--------------------------------------------------------------------------- | |
233 |