]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/media.i
Added wxCB_FILENAME
[wxWidgets.git] / wxPython / src / media.i
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
14 "Classes for a media player control"
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>
25 #include <wx/uri.h>
26 %}
27
28 //----------------------------------------------------------------------
29
30 %import core.i
31 %pythoncode { wx = _core }
32 %pythoncode { __docfilter__ = wx.__DocFilter(globals()) }
33
34 //---------------------------------------------------------------------------
35
36 %typemap(in) wxLongLong {
37 $1 = PyLong_AsLongLong($input);
38 }
39
40
41 %typemap(out) wxLongLong {
42 $result = PyLong_FromLongLong($1.GetValue());
43 }
44
45 //---------------------------------------------------------------------------
46 // Make a stubbed out class for platforms that don't have wxMediaCtrl
47 %{
48 #if !wxUSE_MEDIACTRL
49 enum wxMediaState
50 {
51 wxMEDIASTATE_STOPPED=0,
52 wxMEDIASTATE_PAUSED=0,
53 wxMEDIASTATE_PLAYING=0
54 };
55
56 enum wxMediaCtrlPlayerControls
57 {
58 wxMEDIACTRLPLAYERCONTROLS_NONE,
59 wxMEDIACTRLPLAYERCONTROLS_STEP,
60 wxMEDIACTRLPLAYERCONTROLS_VOLUME,
61 wxMEDIACTRLPLAYERCONTROLS_DEFAULT
62 };
63
64 static wxString wxMEDIABACKEND_DIRECTSHOW(wxEmptyString);
65 static wxString wxMEDIABACKEND_MCI (wxEmptyString);
66 static wxString wxMEDIABACKEND_QUICKTIME (wxEmptyString);
67 static wxString wxMEDIABACKEND_GSTREAMER (wxEmptyString);
68 static wxString wxMEDIABACKEND_REALPLAYER(wxEmptyString);
69 static wxString wxMEDIABACKEND_WMP10 (wxEmptyString);
70
71
72 class wxMediaEvent : public wxNotifyEvent
73 {
74 public:
75 wxMediaEvent(wxEventType, int ) { wxPyRaiseNotImplemented(); }
76 };
77
78 class wxMediaCtrl : public wxControl
79 {
80 public:
81 wxMediaCtrl() { wxPyRaiseNotImplemented(); }
82
83 wxMediaCtrl(wxWindow* , wxWindowID ,
84 const wxString& ,
85 const wxPoint& ,
86 const wxSize& ,
87 long style ,
88 const wxString& ,
89 const wxValidator& ,
90 const wxString& ) { wxPyRaiseNotImplemented(); }
91
92 bool Create(wxWindow* , wxWindowID ,
93 const wxString& ,
94 const wxPoint& ,
95 const wxSize& ,
96 long style ,
97 const wxString& ,
98 const wxValidator& ,
99 const wxString& ) { return false; }
100
101 bool Play() { return false; }
102 bool Pause() { return false; }
103 bool Stop() { return false; }
104
105 wxMediaState GetState() { return wxMEDIASTATE_STOPPED; }
106
107 double GetPlaybackRate() { return 0.0; }
108 bool SetPlaybackRate(double dRate) { return false; }
109
110 wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart)
111 { return 0; }
112
113 wxFileOffset Tell() { return 0; }
114 wxFileOffset Length() { return 0; }
115
116 double GetVolume() { return 0.0; }
117 bool SetVolume(double dVolume) { return false; }
118
119 bool ShowPlayerControls(
120 wxMediaCtrlPlayerControls flags = wxMEDIACTRLPLAYERCONTROLS_DEFAULT)
121 { return false; }
122
123 bool Load(const wxString& fileName) { return false; }
124 bool LoadURI(const wxString& fileName) { return false; }
125 bool LoadURIWithProxy(const wxString& fileName, const wxString& proxy) { return false; }
126
127 wxFileOffset GetDownloadProgress() { return 0; }
128 wxFileOffset GetDownloadTotal() { return 0; }
129
130 };
131
132 const wxEventType wxEVT_MEDIA_FINISHED = 0;
133 const wxEventType wxEVT_MEDIA_STOP = 0;
134 const wxEventType wxEVT_MEDIA_LOADED = 0;
135 const wxEventType wxEVT_MEDIA_STATECHANGED = 0;
136 const wxEventType wxEVT_MEDIA_PLAY = 0;
137 const wxEventType wxEVT_MEDIA_PAUSE = 0;
138
139 #endif
140 %}
141
142
143
144 //---------------------------------------------------------------------------
145
146 enum wxMediaState
147 {
148 wxMEDIASTATE_STOPPED,
149 wxMEDIASTATE_PAUSED,
150 wxMEDIASTATE_PLAYING
151 };
152
153
154 enum wxMediaCtrlPlayerControls
155 {
156 wxMEDIACTRLPLAYERCONTROLS_NONE,
157 wxMEDIACTRLPLAYERCONTROLS_STEP,
158 wxMEDIACTRLPLAYERCONTROLS_VOLUME,
159 wxMEDIACTRLPLAYERCONTROLS_DEFAULT
160 };
161
162
163 MAKE_CONST_WXSTRING(MEDIABACKEND_DIRECTSHOW);
164 MAKE_CONST_WXSTRING(MEDIABACKEND_MCI );
165 MAKE_CONST_WXSTRING(MEDIABACKEND_QUICKTIME );
166 MAKE_CONST_WXSTRING(MEDIABACKEND_GSTREAMER );
167 MAKE_CONST_WXSTRING(MEDIABACKEND_REALPLAYER);
168 MAKE_CONST_WXSTRING(MEDIABACKEND_WMP10);
169
170 //---------------------------------------------------------------------------
171
172 class wxMediaEvent : public wxNotifyEvent
173 {
174 public:
175 wxMediaEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
176 };
177
178
179 //---------------------------------------------------------------------------
180
181 MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
182 MAKE_CONST_WXSTRING2(MediaCtrlNameStr, wxT("mediaCtrl"));
183 MustHaveApp(wxMediaCtrl);
184
185
186 class wxMediaCtrl : public wxControl
187 {
188 public:
189 %pythonAppend wxMediaCtrl "self._setOORInfo(self)"
190 %pythonAppend wxMediaCtrl() ""
191
192
193 wxMediaCtrl(wxWindow* parent,
194 wxWindowID id=-1,
195 const wxString& fileName = wxPyEmptyString,
196 const wxPoint& pos = wxDefaultPosition,
197 const wxSize& size = wxDefaultSize,
198 long style = 0,
199 const wxString& szBackend = wxPyEmptyString,
200 const wxValidator& validator = wxDefaultValidator,
201 const wxString& name = wxPyMediaCtrlNameStr);
202
203 %RenameCtor(PreMediaCtrl, wxMediaCtrl());
204
205 bool Create(wxWindow* parent,
206 wxWindowID id=-1,
207 const wxString& fileName = wxPyEmptyString,
208 const wxPoint& pos = wxDefaultPosition,
209 const wxSize& size = wxDefaultSize,
210 long style = 0,
211 const wxString& szBackend = wxPyEmptyString,
212 const wxValidator& validator = wxDefaultValidator,
213 const wxString& name = wxPyMediaCtrlNameStr);
214
215
216 bool Play();
217 bool Pause();
218 bool Stop();
219
220 wxMediaState GetState();
221
222 double GetPlaybackRate();
223 bool SetPlaybackRate(double dRate);
224
225 wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart);
226 wxFileOffset Tell();
227 wxFileOffset Length();
228
229 double GetVolume();
230 bool SetVolume(double dVolume);
231
232 bool ShowPlayerControls(
233 wxMediaCtrlPlayerControls flags = wxMEDIACTRLPLAYERCONTROLS_DEFAULT);
234
235 bool Load(const wxString& fileName);
236 bool LoadURI(const wxString& fileName);
237 bool LoadURIWithProxy(const wxString& fileName, const wxString& proxy);
238 %pythoncode { LoadFromURI = LoadURI }
239
240 wxFileOffset GetDownloadProgress(); // DirectShow only
241 wxFileOffset GetDownloadTotal(); // DirectShow only
242
243 };
244
245
246
247 %constant wxEventType wxEVT_MEDIA_FINISHED;
248 %constant wxEventType wxEVT_MEDIA_STOP;
249 %constant wxEventType wxEVT_MEDIA_LOADED;
250 %constant wxEventType wxEVT_MEDIA_STATECHANGED;
251 %constant wxEventType wxEVT_MEDIA_PLAY;
252 %constant wxEventType wxEVT_MEDIA_PAUSE;
253
254
255 %pythoncode {
256 EVT_MEDIA_FINISHED = wx.PyEventBinder( wxEVT_MEDIA_FINISHED, 1)
257 EVT_MEDIA_STOP = wx.PyEventBinder( wxEVT_MEDIA_STOP, 1)
258 EVT_MEDIA_LOADED = wx.PyEventBinder( wxEVT_MEDIA_LOADED, 1)
259 EVT_MEDIA_STATECHANGED = wx.PyEventBinder( wxEVT_MEDIA_STATECHANGED, 1)
260 EVT_MEDIA_PLAY = wx.PyEventBinder( wxEVT_MEDIA_PLAY, 1)
261 EVT_MEDIA_PAUSE = wx.PyEventBinder( wxEVT_MEDIA_PAUSE, 1)
262 }
263
264 //---------------------------------------------------------------------------
265
266 %init %{
267 %}
268
269 //---------------------------------------------------------------------------
270