1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG definitions for the wxMediaCtrl
7 // Created: 23-Nov-2004
9 // Copyright: (c) 2004 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
14 "Classes for a medai player control"
17 %module(package="wx", docstring=DOCSTRING) media
21 #include "wx/wxPython/wxPython.h"
22 #include "wx/wxPython/pyclasses.h"
24 #include <wx/mediactrl.h>
28 //----------------------------------------------------------------------
31 %pythoncode { wx = _core }
32 %pythoncode { __docfilter__ = wx.__DocFilter(globals()) }
34 %include _media_rename.i
36 //---------------------------------------------------------------------------
38 %typemap(in) wxLongLong {
39 $1 = PyLong_AsLongLong($input);
43 %typemap(out) wxLongLong {
44 $result = PyLong_FromLongLong($1.GetValue());
47 //---------------------------------------------------------------------------
48 // Make a stubbed out class for platforms that don't have wxMediaCtrl
53 wxMEDIASTATE_STOPPED=0,
54 wxMEDIASTATE_PAUSED=0,
55 wxMEDIASTATE_PLAYING=0
58 enum wxMediaTimeFormat
60 wxMEDIATIMEFORMAT_TIME=0
63 class WXDLLIMPEXP_MEDIA wxMediaEvent : public wxNotifyEvent
66 wxMediaEvent(wxEventType, int ) { wxPyRaiseNotImplemented(); }
69 class wxMediaCtrl : public wxControl
72 wxMediaCtrl() { wxPyRaiseNotImplemented(); }
74 wxMediaCtrl(wxWindow* , wxWindowID ,
81 const wxString& ) { wxPyRaiseNotImplemented(); }
83 wxMediaCtrl(wxWindow* ,
91 const wxString& ) { wxPyRaiseNotImplemented(); }
93 bool Create(wxWindow* , wxWindowID ,
100 const wxString& ) { return false; }
102 bool Create(wxWindow* ,
110 const wxString& ) { return false; }
112 bool Play() { return false; }
113 bool Pause() { return false; }
114 bool Stop() { return false; }
116 bool Load(const wxString& fileName) { return false; }
117 bool Load(const wxURI& location) { return false; }
119 void Loop(bool bLoop = true) {}
120 bool IsLooped() { return false; }
122 wxMediaState GetState() { return wxMEDIASTATE_STOPPED; }
124 double GetPlaybackRate() { return 0.0; };
125 bool SetPlaybackRate(double dRate) { return false; }
127 bool SetPosition(wxLongLong where) { return false; }
128 wxLongLong GetPosition() { return 0; }
129 wxLongLong GetDuration() { return 0; }
132 const wxEventType wxEVT_MEDIA_FINISHED = 0;
133 const wxEventType wxEVT_MEDIA_STOP = 0;
140 //---------------------------------------------------------------------------
144 wxMEDIASTATE_STOPPED,
149 enum wxMediaTimeFormat
151 wxMEDIATIMEFORMAT_TIME
155 // MAKE_CONST_WXSTRING(MEDIABACKEND_DIRECTSHOW);
156 // MAKE_CONST_WXSTRING(MEDIABACKEND_MCI );
157 // MAKE_CONST_WXSTRING(MEDIABACKEND_QUICKTIME );
159 //---------------------------------------------------------------------------
161 class wxMediaEvent : public wxNotifyEvent
164 wxMediaEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
168 //---------------------------------------------------------------------------
170 MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
171 MAKE_CONST_WXSTRING2(MediaCtrlNameStr, wxT("mediaCtrl"));
172 MustHaveApp(wxMediaCtrl);
175 class wxMediaCtrl : public wxControl
178 %pythonAppend wxMediaCtrl "self._setOORInfo(self)"
179 %pythonAppend wxMediaCtrl() ""
182 wxMediaCtrl(wxWindow* parent, wxWindowID id=-1,
183 const wxString& fileName = wxPyEmptyString,
184 const wxPoint& pos = wxDefaultPosition,
185 const wxSize& size = wxDefaultSize,
187 const wxString& szBackend = wxPyEmptyString,
188 const wxValidator& validator = wxDefaultValidator,
189 const wxString& name = wxPyMediaCtrlNameStr);
191 %name(PreMediaCtrl) wxMediaCtrl();
194 %name(MediaCtrlFromURI)
195 wxMediaCtrl(wxWindow* parent, wxWindowID id=-1,
196 const wxString& location=wxPyEmptyString,
197 const wxPoint& pos = wxDefaultPosition,
198 const wxSize& size = wxDefaultSize,
200 const wxString& szBackend = wxPyEmptyString,
201 const wxValidator& validator = wxDefaultValidator,
202 const wxString& name = wxPyMediaCtrlNameStr)
204 return new wxMediaCtrl(parent, id, wxURI(location),
205 pos, size, style, szBackend, validator, name);
208 bool CreateFromURI(wxWindow* parent, wxWindowID id=-1,
209 const wxString& location=wxPyEmptyString,
210 const wxPoint& pos = wxDefaultPosition,
211 const wxSize& size = wxDefaultSize,
213 const wxString& szBackend = wxPyEmptyString,
214 const wxValidator& validator = wxDefaultValidator,
215 const wxString& name = wxPyMediaCtrlNameStr)
217 return self->Create(parent, id, wxURI(location),
218 pos, size, style, szBackend, validator, name);
223 bool Create(wxWindow* parent, wxWindowID id=-1,
224 const wxString& fileName = wxPyEmptyString,
225 const wxPoint& pos = wxDefaultPosition,
226 const wxSize& size = wxDefaultSize,
228 const wxString& szBackend = wxPyEmptyString,
229 const wxValidator& validator = wxDefaultValidator,
230 const wxString& name = wxPyMediaCtrlNameStr);
237 bool Load(const wxString& fileName);
239 bool LoadFromURI(const wxString& location) {
240 return self->Load(wxURI(location));
244 void Loop(bool bLoop = true);
247 wxMediaState GetState();
249 double GetPlaybackRate();
250 bool SetPlaybackRate(double dRate);
252 bool SetPosition(wxLongLong where);
253 wxLongLong GetPosition();
254 wxLongLong GetDuration();
259 %constant wxEventType wxEVT_MEDIA_FINISHED;
260 %constant wxEventType wxEVT_MEDIA_STOP;
263 EVT_MEDIA_FINISHED = wx.PyEventBinder( wxEVT_MEDIA_FINISHED, 1)
264 EVT_MEDIA_STOP = wx.PyEventBinder( wxEVT_MEDIA_STOP, 1)
267 //---------------------------------------------------------------------------
272 //---------------------------------------------------------------------------