]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/media.i
Add a grid sizer demo, and document the props accepted by SetSizerProps.
[wxWidgets.git] / wxPython / src / media.i
CommitLineData
256c055e
RD
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
e3f1b5b5 14"Classes for a media player control"
256c055e
RD
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>
4d5009f9 25#include <wx/uri.h>
256c055e
RD
26%}
27
28//----------------------------------------------------------------------
29
30%import core.i
31%pythoncode { wx = _core }
32%pythoncode { __docfilter__ = wx.__DocFilter(globals()) }
33
256c055e
RD
34//---------------------------------------------------------------------------
35
36%typemap(in) wxLongLong {
37 $1 = PyLong_AsLongLong($input);
38}
39
40
41%typemap(out) wxLongLong {
42 $result = PyLong_FromLongLong($1.GetValue());
43}
44
45//---------------------------------------------------------------------------
46// Make a stubbed out class for platforms that don't have wxMediaCtrl
47%{
48#if !wxUSE_MEDIACTRL
49enum wxMediaState
50{
51 wxMEDIASTATE_STOPPED=0,
52 wxMEDIASTATE_PAUSED=0,
53 wxMEDIASTATE_PLAYING=0
54};
55
02b800ce
RD
56enum wxMediaCtrlPlayerControls
57{
58 wxMEDIACTRLPLAYERCONTROLS_NONE,
59 wxMEDIACTRLPLAYERCONTROLS_STEP,
60 wxMEDIACTRLPLAYERCONTROLS_VOLUME,
61 wxMEDIACTRLPLAYERCONTROLS_DEFAULT
62};
256c055e 63
b15ce821
RD
64static wxString wxMEDIABACKEND_DIRECTSHOW(wxEmptyString);
65static wxString wxMEDIABACKEND_MCI (wxEmptyString);
66static wxString wxMEDIABACKEND_QUICKTIME (wxEmptyString);
67static wxString wxMEDIABACKEND_GSTREAMER (wxEmptyString);
1f168cbd
RD
68static wxString wxMEDIABACKEND_REALPLAYER(wxEmptyString);
69static wxString wxMEDIABACKEND_WMP10 (wxEmptyString);
b15ce821
RD
70
71
63cd6e0b 72class wxMediaEvent : public wxNotifyEvent
256c055e
RD
73{
74public:
4d5009f9 75 wxMediaEvent(wxEventType, int ) { wxPyRaiseNotImplemented(); }
256c055e
RD
76};
77
78class wxMediaCtrl : public wxControl
79{
80public:
6ed7f20d 81 wxMediaCtrl() { wxPyRaiseNotImplemented(); }
256c055e
RD
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
256c055e
RD
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
256c055e
RD
101 bool Play() { return false; }
102 bool Pause() { return false; }
103 bool Stop() { return false; }
104
256c055e
RD
105 wxMediaState GetState() { return wxMEDIASTATE_STOPPED; }
106
e3f1b5b5 107 double GetPlaybackRate() { return 0.0; }
256c055e
RD
108 bool SetPlaybackRate(double dRate) { return false; }
109
e3f1b5b5
RD
110 wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart)
111 { return 0; }
112
113 wxFileOffset Tell() { return 0; }
114 wxFileOffset Length() { return 0; }
6c75a4cf
RD
115
116 double GetVolume() { return 0.0; }
117 bool SetVolume(double dVolume) { return false; }
02b800ce
RD
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; }
1f168cbd
RD
126
127 wxFileOffset GetDownloadProgress() { return 0; }
128 wxFileOffset GetDownloadTotal() { return 0; }
129
256c055e 130};
4d5009f9
RD
131
132const wxEventType wxEVT_MEDIA_FINISHED = 0;
133const wxEventType wxEVT_MEDIA_STOP = 0;
095315e2 134const wxEventType wxEVT_MEDIA_LOADED = 0;
1f168cbd
RD
135const wxEventType wxEVT_MEDIA_STATECHANGED = 0;
136const wxEventType wxEVT_MEDIA_PLAY = 0;
137const wxEventType wxEVT_MEDIA_PAUSE = 0;
4d5009f9 138
256c055e
RD
139#endif
140%}
141
142
143
144//---------------------------------------------------------------------------
145
146enum wxMediaState
147{
148 wxMEDIASTATE_STOPPED,
149 wxMEDIASTATE_PAUSED,
150 wxMEDIASTATE_PLAYING
151};
152
256c055e 153
b15ce821
RD
154enum wxMediaCtrlPlayerControls
155{
156 wxMEDIACTRLPLAYERCONTROLS_NONE,
157 wxMEDIACTRLPLAYERCONTROLS_STEP,
158 wxMEDIACTRLPLAYERCONTROLS_VOLUME,
159 wxMEDIACTRLPLAYERCONTROLS_DEFAULT
160};
161
256c055e 162
b15ce821
RD
163MAKE_CONST_WXSTRING(MEDIABACKEND_DIRECTSHOW);
164MAKE_CONST_WXSTRING(MEDIABACKEND_MCI );
165MAKE_CONST_WXSTRING(MEDIABACKEND_QUICKTIME );
166MAKE_CONST_WXSTRING(MEDIABACKEND_GSTREAMER );
1f168cbd
RD
167MAKE_CONST_WXSTRING(MEDIABACKEND_REALPLAYER);
168MAKE_CONST_WXSTRING(MEDIABACKEND_WMP10);
256c055e
RD
169
170//---------------------------------------------------------------------------
171
172class wxMediaEvent : public wxNotifyEvent
173{
174public:
175 wxMediaEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
176};
177
178
179//---------------------------------------------------------------------------
180
181MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
4d5009f9 182MAKE_CONST_WXSTRING2(MediaCtrlNameStr, wxT("mediaCtrl"));
256c055e
RD
183MustHaveApp(wxMediaCtrl);
184
185
186class wxMediaCtrl : public wxControl
187{
188public:
189 %pythonAppend wxMediaCtrl "self._setOORInfo(self)"
190 %pythonAppend wxMediaCtrl() ""
191
192
95262b5f
RD
193 wxMediaCtrl(wxWindow* parent,
194 wxWindowID id=-1,
256c055e
RD
195 const wxString& fileName = wxPyEmptyString,
196 const wxPoint& pos = wxDefaultPosition,
197 const wxSize& size = wxDefaultSize,
198 long style = 0,
199 const wxString& szBackend = wxPyEmptyString,
200 const wxValidator& validator = wxDefaultValidator,
201 const wxString& name = wxPyMediaCtrlNameStr);
202
1b8c7ba6 203 %RenameCtor(PreMediaCtrl, wxMediaCtrl());
256c055e 204
95262b5f
RD
205 bool Create(wxWindow* parent,
206 wxWindowID id=-1,
256c055e
RD
207 const wxString& fileName = wxPyEmptyString,
208 const wxPoint& pos = wxDefaultPosition,
209 const wxSize& size = wxDefaultSize,
210 long style = 0,
211 const wxString& szBackend = wxPyEmptyString,
212 const wxValidator& validator = wxDefaultValidator,
213 const wxString& name = wxPyMediaCtrlNameStr);
214
215
216 bool Play();
217 bool Pause();
218 bool Stop();
219
256c055e
RD
220 wxMediaState GetState();
221
222 double GetPlaybackRate();
223 bool SetPlaybackRate(double dRate);
224
e3f1b5b5
RD
225 wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart);
226 wxFileOffset Tell();
227 wxFileOffset Length();
02b800ce
RD
228
229 double GetVolume();
230 bool SetVolume(double dVolume);
231
232 bool ShowPlayerControls(
233 wxMediaCtrlPlayerControls flags = wxMEDIACTRLPLAYERCONTROLS_DEFAULT);
234
235 bool Load(const wxString& fileName);
236 bool LoadURI(const wxString& fileName);
237 bool LoadURIWithProxy(const wxString& fileName, const wxString& proxy);
238 %pythoncode { LoadFromURI = LoadURI }
1f168cbd
RD
239
240 wxFileOffset GetDownloadProgress(); // DirectShow only
241 wxFileOffset GetDownloadTotal(); // DirectShow only
242
e70b4d2d
RD
243 %property(DownloadProgress, GetDownloadProgress, doc="See `GetDownloadProgress`");
244 %property(DownloadTotal, GetDownloadTotal, doc="See `GetDownloadTotal`");
245 %property(PlaybackRate, GetPlaybackRate, SetPlaybackRate, doc="See `GetPlaybackRate` and `SetPlaybackRate`");
246 %property(State, GetState, doc="See `GetState`");
247 %property(Volume, GetVolume, SetVolume, doc="See `GetVolume` and `SetVolume`");
256c055e
RD
248};
249
250
251
252%constant wxEventType wxEVT_MEDIA_FINISHED;
253%constant wxEventType wxEVT_MEDIA_STOP;
095315e2 254%constant wxEventType wxEVT_MEDIA_LOADED;
1f168cbd
RD
255%constant wxEventType wxEVT_MEDIA_STATECHANGED;
256%constant wxEventType wxEVT_MEDIA_PLAY;
257%constant wxEventType wxEVT_MEDIA_PAUSE;
258
256c055e
RD
259
260%pythoncode {
1f168cbd
RD
261EVT_MEDIA_FINISHED = wx.PyEventBinder( wxEVT_MEDIA_FINISHED, 1)
262EVT_MEDIA_STOP = wx.PyEventBinder( wxEVT_MEDIA_STOP, 1)
263EVT_MEDIA_LOADED = wx.PyEventBinder( wxEVT_MEDIA_LOADED, 1)
264EVT_MEDIA_STATECHANGED = wx.PyEventBinder( wxEVT_MEDIA_STATECHANGED, 1)
265EVT_MEDIA_PLAY = wx.PyEventBinder( wxEVT_MEDIA_PLAY, 1)
266EVT_MEDIA_PAUSE = wx.PyEventBinder( wxEVT_MEDIA_PAUSE, 1)
256c055e
RD
267}
268
269//---------------------------------------------------------------------------
270
271%init %{
272%}
273
274//---------------------------------------------------------------------------
275