]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/media.i
Docstring update
[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 enum wxMediaCtrlPlayerControls
59 {
60 wxMEDIACTRLPLAYERCONTROLS_NONE,
61 wxMEDIACTRLPLAYERCONTROLS_STEP,
62 wxMEDIACTRLPLAYERCONTROLS_VOLUME,
63 wxMEDIACTRLPLAYERCONTROLS_DEFAULT
64 };
65
66 static wxString wxMEDIABACKEND_DIRECTSHOW(wxEmptyString);
67 static wxString wxMEDIABACKEND_MCI (wxEmptyString);
68 static wxString wxMEDIABACKEND_QUICKTIME (wxEmptyString);
69 static wxString wxMEDIABACKEND_GSTREAMER (wxEmptyString);
70
71
72 class wxMediaEvent : public wxNotifyEvent
73 {
74 public:
75 wxMediaEvent(wxEventType, int ) { wxPyRaiseNotImplemented(); }
76 };
77
78 class wxMediaCtrl : public wxControl
79 {
80 public:
81 wxMediaCtrl() { wxPyRaiseNotImplemented(); }
82
83 wxMediaCtrl(wxWindow* , wxWindowID ,
84 const wxString& ,
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 Play() { return false; }
102 bool Pause() { return false; }
103 bool Stop() { return false; }
104
105 wxMediaState GetState() { return wxMEDIASTATE_STOPPED; }
106
107 double GetPlaybackRate() { return 0.0; }
108 bool SetPlaybackRate(double dRate) { return false; }
109
110 wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart)
111 { return 0; }
112
113 wxFileOffset Tell() { return 0; }
114 wxFileOffset Length() { return 0; }
115
116 double GetVolume() { return 0.0; }
117 bool SetVolume(double dVolume) { return false; }
118
119 bool ShowPlayerControls(
120 wxMediaCtrlPlayerControls flags = wxMEDIACTRLPLAYERCONTROLS_DEFAULT)
121 { return false; }
122
123 bool Load(const wxString& fileName) { return false; }
124 bool LoadURI(const wxString& fileName) { return false; }
125 bool LoadURIWithProxy(const wxString& fileName, const wxString& proxy) { return false; }
126 };
127
128 const wxEventType wxEVT_MEDIA_FINISHED = 0;
129 const wxEventType wxEVT_MEDIA_STOP = 0;
130 const wxEventType wxEVT_MEDIA_LOADED = 0;
131
132 #endif
133 %}
134
135
136
137 //---------------------------------------------------------------------------
138
139 enum wxMediaState
140 {
141 wxMEDIASTATE_STOPPED,
142 wxMEDIASTATE_PAUSED,
143 wxMEDIASTATE_PLAYING
144 };
145
146
147 enum wxMediaCtrlPlayerControls
148 {
149 wxMEDIACTRLPLAYERCONTROLS_NONE,
150 wxMEDIACTRLPLAYERCONTROLS_STEP,
151 wxMEDIACTRLPLAYERCONTROLS_VOLUME,
152 wxMEDIACTRLPLAYERCONTROLS_DEFAULT
153 };
154
155
156 MAKE_CONST_WXSTRING(MEDIABACKEND_DIRECTSHOW);
157 MAKE_CONST_WXSTRING(MEDIABACKEND_MCI );
158 MAKE_CONST_WXSTRING(MEDIABACKEND_QUICKTIME );
159 MAKE_CONST_WXSTRING(MEDIABACKEND_GSTREAMER );
160
161 //---------------------------------------------------------------------------
162
163 class wxMediaEvent : public wxNotifyEvent
164 {
165 public:
166 wxMediaEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
167 };
168
169
170 //---------------------------------------------------------------------------
171
172 MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
173 MAKE_CONST_WXSTRING2(MediaCtrlNameStr, wxT("mediaCtrl"));
174 MustHaveApp(wxMediaCtrl);
175
176
177 class wxMediaCtrl : public wxControl
178 {
179 public:
180 %pythonAppend wxMediaCtrl "self._setOORInfo(self)"
181 %pythonAppend wxMediaCtrl() ""
182
183
184 wxMediaCtrl(wxWindow* parent,
185 wxWindowID id=-1,
186 const wxString& fileName = wxPyEmptyString,
187 const wxPoint& pos = wxDefaultPosition,
188 const wxSize& size = wxDefaultSize,
189 long style = 0,
190 const wxString& szBackend = wxPyEmptyString,
191 const wxValidator& validator = wxDefaultValidator,
192 const wxString& name = wxPyMediaCtrlNameStr);
193
194 %RenameCtor(PreMediaCtrl, wxMediaCtrl());
195
196 bool Create(wxWindow* parent,
197 wxWindowID id=-1,
198 const wxString& fileName = 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
207 bool Play();
208 bool Pause();
209 bool Stop();
210
211 wxMediaState GetState();
212
213 double GetPlaybackRate();
214 bool SetPlaybackRate(double dRate);
215
216 wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart);
217 wxFileOffset Tell();
218 wxFileOffset Length();
219
220 double GetVolume();
221 bool SetVolume(double dVolume);
222
223 bool ShowPlayerControls(
224 wxMediaCtrlPlayerControls flags = wxMEDIACTRLPLAYERCONTROLS_DEFAULT);
225
226 bool Load(const wxString& fileName);
227 bool LoadURI(const wxString& fileName);
228 bool LoadURIWithProxy(const wxString& fileName, const wxString& proxy);
229 %pythoncode { LoadFromURI = LoadURI }
230 };
231
232
233
234 %constant wxEventType wxEVT_MEDIA_FINISHED;
235 %constant wxEventType wxEVT_MEDIA_STOP;
236 %constant wxEventType wxEVT_MEDIA_LOADED;
237
238 %pythoncode {
239 EVT_MEDIA_FINISHED = wx.PyEventBinder( wxEVT_MEDIA_FINISHED, 1)
240 EVT_MEDIA_STOP = wx.PyEventBinder( wxEVT_MEDIA_STOP, 1)
241 EVT_MEDIA_LOADED = wx.PyEventBinder( wxEVT_MEDIA_LOADED, 1)
242 }
243
244 //---------------------------------------------------------------------------
245
246 %init %{
247 %}
248
249 //---------------------------------------------------------------------------
250