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