]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/media.i
regen bakefiles - get rid of explicit size setting after ctor
[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 %}
26
27 //----------------------------------------------------------------------
28
29 %import core.i
30 %pythoncode { wx = _core }
31 %pythoncode { __docfilter__ = wx.__DocFilter(globals()) }
32
33 %include _media_rename.i
34
35 //---------------------------------------------------------------------------
36
37 %typemap(in) wxLongLong {
38 $1 = PyLong_AsLongLong($input);
39 }
40
41
42 %typemap(out) wxLongLong {
43 $result = PyLong_FromLongLong($1.GetValue());
44 }
45
46 //---------------------------------------------------------------------------
47 // Make a stubbed out class for platforms that don't have wxMediaCtrl
48 %{
49 #if !wxUSE_MEDIACTRL
50 enum wxMediaState
51 {
52 wxMEDIASTATE_STOPPED=0,
53 wxMEDIASTATE_PAUSED=0,
54 wxMEDIASTATE_PLAYING=0
55 };
56
57 enum wxMediaTimeFormat
58 {
59 wxMEDIATIMEFORMAT_TIME=0
60 };
61
62 class WXDLLIMPEXP_MEDIA wxMediaEvent : public wxNotifyEvent
63 {
64 public:
65 wxMediaEvent(wxEventTypL, int ) { wxPyRaiseNotImplemented(); }
66 };
67
68 class wxMediaCtrl : public wxControl
69 {
70 public:
71 wxMediaCtrl() { wxPyRaiseNotImplemented(); }
72
73 wxMediaCtrl(wxWindow* , wxWindowID ,
74 const wxString& ,
75 const wxPoint& ,
76 const wxSize& ,
77 long style ,
78 const wxString& ,
79 const wxValidator& ,
80 const wxString& ) { wxPyRaiseNotImplemented(); }
81
82 wxMediaCtrl(wxWindow* ,
83 wxWindowID ,
84 const wxURI& ,
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 Create(wxWindow* ,
102 wxWindowID ,
103 const wxURI& ,
104 const wxPoint&,
105 const wxSize& .
106 long style,
107 const wxString& ,
108 const wxValidator& ,
109 const wxString& ) { return false; }
110
111 bool Play() { return false; }
112 bool Pause() { return false; }
113 bool Stop() { return false; }
114
115 bool Load(const wxString& fileName) { return false; }
116 bool Load(const wxURI& location) { return false; }
117
118 void Loop(bool bLoop = true) {}
119 bool IsLooped() { return false; }
120
121 wxMediaState GetState() { return wxMEDIASTATE_STOPPED; }
122
123 double GetPlaybackRate() { return 0.0; };
124 bool SetPlaybackRate(double dRate) { return false; }
125
126 bool SetPosition(wxLongLong where) { return false; }
127 wxLongLong GetPosition() { return 0; }
128 wxLongLong GetDuration() { return 0; }
129 };
130 #endif
131 %}
132
133
134
135 //---------------------------------------------------------------------------
136
137 enum wxMediaState
138 {
139 wxMEDIASTATE_STOPPED,
140 wxMEDIASTATE_PAUSED,
141 wxMEDIASTATE_PLAYING
142 };
143
144 enum wxMediaTimeFormat
145 {
146 wxMEDIATIMEFORMAT_TIME
147 };
148
149
150 MAKE_CONST_WXSTRING(MEDIABACKEND_DIRECTSHOW);
151 MAKE_CONST_WXSTRING(MEDIABACKEND_MCI );
152 MAKE_CONST_WXSTRING(MEDIABACKEND_QUICKTIME );
153
154 //---------------------------------------------------------------------------
155
156 class wxMediaEvent : public wxNotifyEvent
157 {
158 public:
159 wxMediaEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
160 };
161
162
163 //---------------------------------------------------------------------------
164
165 MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
166 MAKE_CONST_WXSTRING2(MediaCtrlNameStr, "mediaCtrl");
167 MustHaveApp(wxMediaCtrl);
168
169
170 class wxMediaCtrl : public wxControl
171 {
172 public:
173 %pythonAppend wxMediaCtrl "self._setOORInfo(self)"
174 %pythonAppend wxMediaCtrl() ""
175
176
177 wxMediaCtrl(wxWindow* parent, 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 %name(PreMediaCtrl) wxMediaCtrl();
187
188 %extend {
189 %name(MediaCtrlFromURI)
190 wxMediaCtrl(wxWindow* parent, wxWindowID id=-1,
191 const wxString& location=wxPyEmptyString,
192 const wxPoint& pos = wxDefaultPosition,
193 const wxSize& size = wxDefaultSize,
194 long style = 0,
195 const wxString& szBackend = wxPyEmptyString,
196 const wxValidator& validator = wxDefaultValidator,
197 const wxString& name = wxPyMediaCtrlNameStr)
198 {
199 return new wxMediaCtrl(parent, id, wxURI(location),
200 pos, size, style, szBackend, validator, name);
201 }
202
203 bool CreateFromURI(wxWindow* parent, wxWindowID id=-1,
204 const wxString& location=wxPyEmptyString,
205 const wxPoint& pos = wxDefaultPosition,
206 const wxSize& size = wxDefaultSize,
207 long style = 0,
208 const wxString& szBackend = wxPyEmptyString,
209 const wxValidator& validator = wxDefaultValidator,
210 const wxString& name = wxPyMediaCtrlNameStr)
211 {
212 return self->Create(parent, id, wxURI(location),
213 pos, size, style, szBackend, validator, name);
214 }
215 }
216
217
218 bool Create(wxWindow* parent, wxWindowID id=-1,
219 const wxString& fileName = wxPyEmptyString,
220 const wxPoint& pos = wxDefaultPosition,
221 const wxSize& size = wxDefaultSize,
222 long style = 0,
223 const wxString& szBackend = wxPyEmptyString,
224 const wxValidator& validator = wxDefaultValidator,
225 const wxString& name = wxPyMediaCtrlNameStr);
226
227
228 bool Play();
229 bool Pause();
230 bool Stop();
231
232 bool Load(const wxString& fileName);
233 %extend {
234 bool LoadFromURI(const wxString& location) {
235 return self->Load(wxURI(location));
236 }
237 }
238
239 void Loop(bool bLoop = true);
240 bool IsLooped();
241
242 wxMediaState GetState();
243
244 double GetPlaybackRate();
245 bool SetPlaybackRate(double dRate);
246
247 bool SetPosition(wxLongLong where);
248 wxLongLong GetPosition();
249 wxLongLong GetDuration();
250 };
251
252
253
254 %constant wxEventType wxEVT_MEDIA_FINISHED;
255 %constant wxEventType wxEVT_MEDIA_STOP;
256
257 %pythoncode {
258 EVT_MEDIA_FINISHED = wx.PyEventBinder( wxEVT_MEDIA_FINISHED, 1)
259 EVT_MEDIA_STOP = wx.PyEventBinder( wxEVT_MEDIA_STOP, 1)
260 }
261
262 //---------------------------------------------------------------------------
263
264 %init %{
265 %}
266
267 //---------------------------------------------------------------------------
268