]>
Commit | Line | Data |
---|---|---|
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 WXDLLIMPEXP_MEDIA 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, wxWindowID id=-1, | |
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 | %name(PreMediaCtrl) wxMediaCtrl(); | |
192 | ||
193 | %extend { | |
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, | |
199 | long style = 0, | |
200 | const wxString& szBackend = wxPyEmptyString, | |
201 | const wxValidator& validator = wxDefaultValidator, | |
202 | const wxString& name = wxPyMediaCtrlNameStr) | |
203 | { | |
204 | return new wxMediaCtrl(parent, id, wxURI(location), | |
205 | pos, size, style, szBackend, validator, name); | |
206 | } | |
207 | ||
208 | bool CreateFromURI(wxWindow* parent, wxWindowID id=-1, | |
209 | const wxString& location=wxPyEmptyString, | |
210 | const wxPoint& pos = wxDefaultPosition, | |
211 | const wxSize& size = wxDefaultSize, | |
212 | long style = 0, | |
213 | const wxString& szBackend = wxPyEmptyString, | |
214 | const wxValidator& validator = wxDefaultValidator, | |
215 | const wxString& name = wxPyMediaCtrlNameStr) | |
216 | { | |
217 | return self->Create(parent, id, wxURI(location), | |
218 | pos, size, style, szBackend, validator, name); | |
219 | } | |
220 | } | |
221 | ||
222 | ||
223 | bool Create(wxWindow* parent, wxWindowID id=-1, | |
224 | const wxString& fileName = wxPyEmptyString, | |
225 | const wxPoint& pos = wxDefaultPosition, | |
226 | const wxSize& size = wxDefaultSize, | |
227 | long style = 0, | |
228 | const wxString& szBackend = wxPyEmptyString, | |
229 | const wxValidator& validator = wxDefaultValidator, | |
230 | const wxString& name = wxPyMediaCtrlNameStr); | |
231 | ||
232 | ||
233 | bool Play(); | |
234 | bool Pause(); | |
235 | bool Stop(); | |
236 | ||
237 | bool Load(const wxString& fileName); | |
238 | %extend { | |
239 | bool LoadFromURI(const wxString& location) { | |
240 | return self->Load(wxURI(location)); | |
241 | } | |
242 | } | |
243 | ||
244 | void Loop(bool bLoop = true); | |
245 | bool IsLooped(); | |
246 | ||
247 | wxMediaState GetState(); | |
248 | ||
249 | double GetPlaybackRate(); | |
250 | bool SetPlaybackRate(double dRate); | |
251 | ||
252 | bool SetPosition(wxLongLong where); | |
253 | wxLongLong GetPosition(); | |
254 | wxLongLong GetDuration(); | |
255 | }; | |
256 | ||
257 | ||
258 | ||
259 | %constant wxEventType wxEVT_MEDIA_FINISHED; | |
260 | %constant wxEventType wxEVT_MEDIA_STOP; | |
261 | ||
262 | %pythoncode { | |
263 | EVT_MEDIA_FINISHED = wx.PyEventBinder( wxEVT_MEDIA_FINISHED, 1) | |
264 | EVT_MEDIA_STOP = wx.PyEventBinder( wxEVT_MEDIA_STOP, 1) | |
265 | } | |
266 | ||
267 | //--------------------------------------------------------------------------- | |
268 | ||
269 | %init %{ | |
270 | %} | |
271 | ||
272 | //--------------------------------------------------------------------------- | |
273 |