]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/media.i
get the default encoding from the default locale.
[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 medai 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 %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
58 enum wxMediaTimeFormat
59 {
60 wxMEDIATIMEFORMAT_TIME=0
61 };
62
63 class wxMediaEvent : public wxNotifyEvent
64 {
65 public:
66 wxMediaEvent(wxEventType, int ) { wxPyRaiseNotImplemented(); }
67 };
68
69 class wxMediaCtrl : public wxControl
70 {
71 public:
72 wxMediaCtrl() { wxPyRaiseNotImplemented(); }
73
74 wxMediaCtrl(wxWindow* , wxWindowID ,
75 const wxString& ,
76 const wxPoint& ,
77 const wxSize& ,
78 long style ,
79 const wxString& ,
80 const wxValidator& ,
81 const wxString& ) { wxPyRaiseNotImplemented(); }
82
83 wxMediaCtrl(wxWindow* ,
84 wxWindowID ,
85 const wxURI& ,
86 const wxPoint&,
87 const wxSize& ,
88 long style,
89 const wxString& ,
90 const wxValidator& ,
91 const wxString& ) { wxPyRaiseNotImplemented(); }
92
93 bool Create(wxWindow* , wxWindowID ,
94 const wxString& ,
95 const wxPoint& ,
96 const wxSize& ,
97 long style ,
98 const wxString& ,
99 const wxValidator& ,
100 const wxString& ) { return false; }
101
102 bool Create(wxWindow* ,
103 wxWindowID ,
104 const wxURI& ,
105 const wxPoint&,
106 const wxSize& ,
107 long style,
108 const wxString& ,
109 const wxValidator& ,
110 const wxString& ) { return false; }
111
112 bool Play() { return false; }
113 bool Pause() { return false; }
114 bool Stop() { return false; }
115
116 bool Load(const wxString& fileName) { return false; }
117 bool Load(const wxURI& location) { return false; }
118
119 void Loop(bool bLoop = true) {}
120 bool IsLooped() { return false; }
121
122 wxMediaState GetState() { return wxMEDIASTATE_STOPPED; }
123
124 double GetPlaybackRate() { return 0.0; };
125 bool SetPlaybackRate(double dRate) { return false; }
126
127 bool SetPosition(wxLongLong where) { return false; }
128 wxLongLong GetPosition() { return 0; }
129 wxLongLong GetDuration() { return 0; }
130 };
131
132 const wxEventType wxEVT_MEDIA_FINISHED = 0;
133 const wxEventType wxEVT_MEDIA_STOP = 0;
134
135 #endif
136 %}
137
138
139
140 //---------------------------------------------------------------------------
141
142 enum wxMediaState
143 {
144 wxMEDIASTATE_STOPPED,
145 wxMEDIASTATE_PAUSED,
146 wxMEDIASTATE_PLAYING
147 };
148
149 enum wxMediaTimeFormat
150 {
151 wxMEDIATIMEFORMAT_TIME
152 };
153
154
155 // MAKE_CONST_WXSTRING(MEDIABACKEND_DIRECTSHOW);
156 // MAKE_CONST_WXSTRING(MEDIABACKEND_MCI );
157 // MAKE_CONST_WXSTRING(MEDIABACKEND_QUICKTIME );
158
159 //---------------------------------------------------------------------------
160
161 class wxMediaEvent : public wxNotifyEvent
162 {
163 public:
164 wxMediaEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
165 };
166
167
168 //---------------------------------------------------------------------------
169
170 MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
171 MAKE_CONST_WXSTRING2(MediaCtrlNameStr, wxT("mediaCtrl"));
172 MustHaveApp(wxMediaCtrl);
173
174
175 class wxMediaCtrl : public wxControl
176 {
177 public:
178 %pythonAppend wxMediaCtrl "self._setOORInfo(self)"
179 %pythonAppend wxMediaCtrl() ""
180
181
182 wxMediaCtrl(wxWindow* parent,
183 wxWindowID id=-1,
184 const wxString& fileName = wxPyEmptyString,
185 const wxPoint& pos = wxDefaultPosition,
186 const wxSize& size = wxDefaultSize,
187 long style = 0,
188 const wxString& szBackend = wxPyEmptyString,
189 const wxValidator& validator = wxDefaultValidator,
190 const wxString& name = wxPyMediaCtrlNameStr);
191
192 %name(PreMediaCtrl) wxMediaCtrl();
193
194 %extend {
195 %name(MediaCtrlFromURI)
196 wxMediaCtrl(wxWindow* parent,
197 wxWindowID id=-1,
198 const wxString& location=wxPyEmptyString,
199 const wxPoint& pos = wxDefaultPosition,
200 const wxSize& size = wxDefaultSize,
201 long style = 0,
202 const wxString& szBackend = wxPyEmptyString,
203 const wxValidator& validator = wxDefaultValidator,
204 const wxString& name = wxPyMediaCtrlNameStr)
205 {
206 return new wxMediaCtrl(parent, id, wxURI(location),
207 pos, size, style, szBackend, validator, name);
208 }
209
210 bool CreateFromURI(wxWindow* parent,
211 wxWindowID id=-1,
212 const wxString& location=wxPyEmptyString,
213 const wxPoint& pos = wxDefaultPosition,
214 const wxSize& size = wxDefaultSize,
215 long style = 0,
216 const wxString& szBackend = wxPyEmptyString,
217 const wxValidator& validator = wxDefaultValidator,
218 const wxString& name = wxPyMediaCtrlNameStr)
219 {
220 return self->Create(parent, id, wxURI(location),
221 pos, size, style, szBackend, validator, name);
222 }
223 }
224
225
226 bool Create(wxWindow* parent,
227 wxWindowID id=-1,
228 const wxString& fileName = wxPyEmptyString,
229 const wxPoint& pos = wxDefaultPosition,
230 const wxSize& size = wxDefaultSize,
231 long style = 0,
232 const wxString& szBackend = wxPyEmptyString,
233 const wxValidator& validator = wxDefaultValidator,
234 const wxString& name = wxPyMediaCtrlNameStr);
235
236
237 bool Play();
238 bool Pause();
239 bool Stop();
240
241 bool Load(const wxString& fileName);
242 %extend {
243 bool LoadFromURI(const wxString& location) {
244 return self->Load(wxURI(location));
245 }
246 }
247
248 void Loop(bool bLoop = true);
249 bool IsLooped();
250
251 wxMediaState GetState();
252
253 double GetPlaybackRate();
254 bool SetPlaybackRate(double dRate);
255
256 %name(SetMediaPosition) bool SetPosition(wxLongLong where);
257 %name(GetMediaPosition) wxLongLong GetPosition();
258 %name(GetMediaDuration) wxLongLong GetDuration();
259 };
260
261
262
263 %constant wxEventType wxEVT_MEDIA_FINISHED;
264 %constant wxEventType wxEVT_MEDIA_STOP;
265
266 %pythoncode {
267 EVT_MEDIA_FINISHED = wx.PyEventBinder( wxEVT_MEDIA_FINISHED, 1)
268 EVT_MEDIA_STOP = wx.PyEventBinder( wxEVT_MEDIA_STOP, 1)
269 }
270
271 //---------------------------------------------------------------------------
272
273 %init %{
274 %}
275
276 //---------------------------------------------------------------------------
277