]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/media.i
log wxChoice events in the same format as wxComboBox ones to make it simpler to compa...
[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
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
51enum wxMediaState
52{
53 wxMEDIASTATE_STOPPED=0,
54 wxMEDIASTATE_PAUSED=0,
55 wxMEDIASTATE_PLAYING=0
56};
57
02b800ce
RD
58enum wxMediaCtrlPlayerControls
59{
60 wxMEDIACTRLPLAYERCONTROLS_NONE,
61 wxMEDIACTRLPLAYERCONTROLS_STEP,
62 wxMEDIACTRLPLAYERCONTROLS_VOLUME,
63 wxMEDIACTRLPLAYERCONTROLS_DEFAULT
64};
256c055e 65
b15ce821
RD
66static wxString wxMEDIABACKEND_DIRECTSHOW(wxEmptyString);
67static wxString wxMEDIABACKEND_MCI (wxEmptyString);
68static wxString wxMEDIABACKEND_QUICKTIME (wxEmptyString);
69static wxString wxMEDIABACKEND_GSTREAMER (wxEmptyString);
1f168cbd
RD
70static wxString wxMEDIABACKEND_REALPLAYER(wxEmptyString);
71static wxString wxMEDIABACKEND_WMP10 (wxEmptyString);
b15ce821
RD
72
73
63cd6e0b 74class wxMediaEvent : public wxNotifyEvent
256c055e
RD
75{
76public:
4d5009f9 77 wxMediaEvent(wxEventType, int ) { wxPyRaiseNotImplemented(); }
256c055e
RD
78};
79
80class wxMediaCtrl : public wxControl
81{
82public:
6ed7f20d 83 wxMediaCtrl() { wxPyRaiseNotImplemented(); }
256c055e
RD
84
85 wxMediaCtrl(wxWindow* , wxWindowID ,
86 const wxString& ,
87 const wxPoint& ,
88 const wxSize& ,
89 long style ,
90 const wxString& ,
91 const wxValidator& ,
92 const wxString& ) { wxPyRaiseNotImplemented(); }
93
256c055e
RD
94 bool Create(wxWindow* , wxWindowID ,
95 const wxString& ,
96 const wxPoint& ,
97 const wxSize& ,
98 long style ,
99 const wxString& ,
100 const wxValidator& ,
101 const wxString& ) { return false; }
102
256c055e
RD
103 bool Play() { return false; }
104 bool Pause() { return false; }
105 bool Stop() { return false; }
106
256c055e
RD
107 wxMediaState GetState() { return wxMEDIASTATE_STOPPED; }
108
e3f1b5b5 109 double GetPlaybackRate() { return 0.0; }
256c055e
RD
110 bool SetPlaybackRate(double dRate) { return false; }
111
e3f1b5b5
RD
112 wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart)
113 { return 0; }
114
115 wxFileOffset Tell() { return 0; }
116 wxFileOffset Length() { return 0; }
6c75a4cf
RD
117
118 double GetVolume() { return 0.0; }
119 bool SetVolume(double dVolume) { return false; }
02b800ce
RD
120
121 bool ShowPlayerControls(
122 wxMediaCtrlPlayerControls flags = wxMEDIACTRLPLAYERCONTROLS_DEFAULT)
123 { return false; }
124
125 bool Load(const wxString& fileName) { return false; }
126 bool LoadURI(const wxString& fileName) { return false; }
127 bool LoadURIWithProxy(const wxString& fileName, const wxString& proxy) { return false; }
1f168cbd
RD
128
129 wxFileOffset GetDownloadProgress() { return 0; }
130 wxFileOffset GetDownloadTotal() { return 0; }
131
256c055e 132};
4d5009f9
RD
133
134const wxEventType wxEVT_MEDIA_FINISHED = 0;
135const wxEventType wxEVT_MEDIA_STOP = 0;
095315e2 136const wxEventType wxEVT_MEDIA_LOADED = 0;
1f168cbd
RD
137const wxEventType wxEVT_MEDIA_STATECHANGED = 0;
138const wxEventType wxEVT_MEDIA_PLAY = 0;
139const wxEventType wxEVT_MEDIA_PAUSE = 0;
4d5009f9 140
256c055e
RD
141#endif
142%}
143
144
145
146//---------------------------------------------------------------------------
147
148enum wxMediaState
149{
150 wxMEDIASTATE_STOPPED,
151 wxMEDIASTATE_PAUSED,
152 wxMEDIASTATE_PLAYING
153};
154
256c055e 155
b15ce821
RD
156enum wxMediaCtrlPlayerControls
157{
158 wxMEDIACTRLPLAYERCONTROLS_NONE,
159 wxMEDIACTRLPLAYERCONTROLS_STEP,
160 wxMEDIACTRLPLAYERCONTROLS_VOLUME,
161 wxMEDIACTRLPLAYERCONTROLS_DEFAULT
162};
163
256c055e 164
b15ce821
RD
165MAKE_CONST_WXSTRING(MEDIABACKEND_DIRECTSHOW);
166MAKE_CONST_WXSTRING(MEDIABACKEND_MCI );
167MAKE_CONST_WXSTRING(MEDIABACKEND_QUICKTIME );
168MAKE_CONST_WXSTRING(MEDIABACKEND_GSTREAMER );
1f168cbd
RD
169MAKE_CONST_WXSTRING(MEDIABACKEND_REALPLAYER);
170MAKE_CONST_WXSTRING(MEDIABACKEND_WMP10);
256c055e
RD
171
172//---------------------------------------------------------------------------
173
174class wxMediaEvent : public wxNotifyEvent
175{
176public:
177 wxMediaEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
178};
179
180
181//---------------------------------------------------------------------------
182
183MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
4d5009f9 184MAKE_CONST_WXSTRING2(MediaCtrlNameStr, wxT("mediaCtrl"));
256c055e
RD
185MustHaveApp(wxMediaCtrl);
186
187
188class wxMediaCtrl : public wxControl
189{
190public:
191 %pythonAppend wxMediaCtrl "self._setOORInfo(self)"
192 %pythonAppend wxMediaCtrl() ""
193
194
95262b5f
RD
195 wxMediaCtrl(wxWindow* parent,
196 wxWindowID id=-1,
256c055e
RD
197 const wxString& fileName = wxPyEmptyString,
198 const wxPoint& pos = wxDefaultPosition,
199 const wxSize& size = wxDefaultSize,
200 long style = 0,
201 const wxString& szBackend = wxPyEmptyString,
202 const wxValidator& validator = wxDefaultValidator,
203 const wxString& name = wxPyMediaCtrlNameStr);
204
1b8c7ba6 205 %RenameCtor(PreMediaCtrl, wxMediaCtrl());
256c055e 206
95262b5f
RD
207 bool Create(wxWindow* parent,
208 wxWindowID id=-1,
256c055e
RD
209 const wxString& fileName = 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
218 bool Play();
219 bool Pause();
220 bool Stop();
221
256c055e
RD
222 wxMediaState GetState();
223
224 double GetPlaybackRate();
225 bool SetPlaybackRate(double dRate);
226
e3f1b5b5
RD
227 wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart);
228 wxFileOffset Tell();
229 wxFileOffset Length();
02b800ce
RD
230
231 double GetVolume();
232 bool SetVolume(double dVolume);
233
234 bool ShowPlayerControls(
235 wxMediaCtrlPlayerControls flags = wxMEDIACTRLPLAYERCONTROLS_DEFAULT);
236
237 bool Load(const wxString& fileName);
238 bool LoadURI(const wxString& fileName);
239 bool LoadURIWithProxy(const wxString& fileName, const wxString& proxy);
240 %pythoncode { LoadFromURI = LoadURI }
1f168cbd
RD
241
242 wxFileOffset GetDownloadProgress(); // DirectShow only
243 wxFileOffset GetDownloadTotal(); // DirectShow only
244
256c055e
RD
245};
246
247
248
249%constant wxEventType wxEVT_MEDIA_FINISHED;
250%constant wxEventType wxEVT_MEDIA_STOP;
095315e2 251%constant wxEventType wxEVT_MEDIA_LOADED;
1f168cbd
RD
252%constant wxEventType wxEVT_MEDIA_STATECHANGED;
253%constant wxEventType wxEVT_MEDIA_PLAY;
254%constant wxEventType wxEVT_MEDIA_PAUSE;
255
256c055e
RD
256
257%pythoncode {
1f168cbd
RD
258EVT_MEDIA_FINISHED = wx.PyEventBinder( wxEVT_MEDIA_FINISHED, 1)
259EVT_MEDIA_STOP = wx.PyEventBinder( wxEVT_MEDIA_STOP, 1)
260EVT_MEDIA_LOADED = wx.PyEventBinder( wxEVT_MEDIA_LOADED, 1)
261EVT_MEDIA_STATECHANGED = wx.PyEventBinder( wxEVT_MEDIA_STATECHANGED, 1)
262EVT_MEDIA_PLAY = wx.PyEventBinder( wxEVT_MEDIA_PLAY, 1)
263EVT_MEDIA_PAUSE = wx.PyEventBinder( wxEVT_MEDIA_PAUSE, 1)
256c055e
RD
264}
265
266//---------------------------------------------------------------------------
267
268%init %{
269%}
270
271//---------------------------------------------------------------------------
272