]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/media.i
bug fixes for using wxTransientPopupWindow and wxDP_ALLOWNONE support from Andreas...
[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
256c055e 58
63cd6e0b 59class wxMediaEvent : public wxNotifyEvent
256c055e
RD
60{
61public:
4d5009f9 62 wxMediaEvent(wxEventType, int ) { wxPyRaiseNotImplemented(); }
256c055e
RD
63};
64
65class wxMediaCtrl : public wxControl
66{
67public:
68 wxMediaCtrl() { wxPyRaiseNotImplemented(); }
69
70 wxMediaCtrl(wxWindow* , wxWindowID ,
71 const wxString& ,
72 const wxPoint& ,
73 const wxSize& ,
74 long style ,
75 const wxString& ,
76 const wxValidator& ,
77 const wxString& ) { wxPyRaiseNotImplemented(); }
78
e3f1b5b5
RD
79// wxMediaCtrl(wxWindow* ,
80// wxWindowID ,
81// const wxURI& ,
82// const wxPoint&,
83// const wxSize& ,
84// long style,
85// const wxString& ,
86// const wxValidator& ,
87// const wxString& ) { wxPyRaiseNotImplemented(); }
256c055e
RD
88
89 bool Create(wxWindow* , wxWindowID ,
90 const wxString& ,
91 const wxPoint& ,
92 const wxSize& ,
93 long style ,
94 const wxString& ,
95 const wxValidator& ,
96 const wxString& ) { return false; }
97
e3f1b5b5
RD
98// bool Create(wxWindow* ,
99// wxWindowID ,
100// const wxURI& ,
101// const wxPoint&,
102// const wxSize& ,
103// long style,
104// const wxString& ,
105// const wxValidator& ,
106// const wxString& ) { return false; }
256c055e
RD
107
108 bool Play() { return false; }
109 bool Pause() { return false; }
110 bool Stop() { return false; }
111
112 bool Load(const wxString& fileName) { return false; }
113 bool Load(const wxURI& location) { return false; }
114
115 void Loop(bool bLoop = true) {}
116 bool IsLooped() { return false; }
117
118 wxMediaState GetState() { return wxMEDIASTATE_STOPPED; }
119
e3f1b5b5 120 double GetPlaybackRate() { return 0.0; }
256c055e
RD
121 bool SetPlaybackRate(double dRate) { return false; }
122
e3f1b5b5
RD
123 wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart)
124 { return 0; }
125
126 wxFileOffset Tell() { return 0; }
127 wxFileOffset Length() { return 0; }
256c055e 128};
4d5009f9
RD
129
130const wxEventType wxEVT_MEDIA_FINISHED = 0;
131const wxEventType wxEVT_MEDIA_STOP = 0;
132
256c055e
RD
133#endif
134%}
135
136
137
138//---------------------------------------------------------------------------
139
140enum wxMediaState
141{
142 wxMEDIASTATE_STOPPED,
143 wxMEDIASTATE_PAUSED,
144 wxMEDIASTATE_PLAYING
145};
146
256c055e
RD
147
148
4d5009f9
RD
149// MAKE_CONST_WXSTRING(MEDIABACKEND_DIRECTSHOW);
150// MAKE_CONST_WXSTRING(MEDIABACKEND_MCI );
151// MAKE_CONST_WXSTRING(MEDIABACKEND_QUICKTIME );
256c055e
RD
152
153//---------------------------------------------------------------------------
154
155class wxMediaEvent : public wxNotifyEvent
156{
157public:
158 wxMediaEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
159};
160
161
162//---------------------------------------------------------------------------
163
164MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
4d5009f9 165MAKE_CONST_WXSTRING2(MediaCtrlNameStr, wxT("mediaCtrl"));
256c055e
RD
166MustHaveApp(wxMediaCtrl);
167
168
169class wxMediaCtrl : public wxControl
170{
171public:
172 %pythonAppend wxMediaCtrl "self._setOORInfo(self)"
173 %pythonAppend wxMediaCtrl() ""
174
175
95262b5f
RD
176 wxMediaCtrl(wxWindow* parent,
177 wxWindowID id=-1,
256c055e
RD
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
1b8c7ba6 186 %RenameCtor(PreMediaCtrl, wxMediaCtrl());
256c055e 187
e3f1b5b5 188// %extend {
1b8c7ba6 189// %RenameCtor(MediaCtrlFromURI,
e3f1b5b5
RD
190// wxMediaCtrl(wxWindow* parent,
191// wxWindowID id=-1,
192// const wxString& location=wxPyEmptyString,
193// const wxPoint& pos = wxDefaultPosition,
194// const wxSize& size = wxDefaultSize,
195// long style = 0,
196// const wxString& szBackend = wxPyEmptyString,
197// const wxValidator& validator = wxDefaultValidator,
1b8c7ba6 198// const wxString& name = wxPyMediaCtrlNameStr))
e3f1b5b5
RD
199// {
200// return new wxMediaCtrl(parent, id, wxURI(location),
201// pos, size, style, szBackend, validator, name);
202// }
203
204// bool CreateFromURI(wxWindow* parent,
205// wxWindowID id=-1,
206// const wxString& location=wxPyEmptyString,
207// const wxPoint& pos = wxDefaultPosition,
208// const wxSize& size = wxDefaultSize,
209// long style = 0,
210// const wxString& szBackend = wxPyEmptyString,
211// const wxValidator& validator = wxDefaultValidator,
212// const wxString& name = wxPyMediaCtrlNameStr)
213// {
214// return self->Create(parent, id, wxURI(location),
215// pos, size, style, szBackend, validator, name);
216// }
217// }
256c055e
RD
218
219
95262b5f
RD
220 bool Create(wxWindow* parent,
221 wxWindowID id=-1,
256c055e
RD
222 const wxString& fileName = wxPyEmptyString,
223 const wxPoint& pos = wxDefaultPosition,
224 const wxSize& size = wxDefaultSize,
225 long style = 0,
226 const wxString& szBackend = wxPyEmptyString,
227 const wxValidator& validator = wxDefaultValidator,
228 const wxString& name = wxPyMediaCtrlNameStr);
229
230
231 bool Play();
232 bool Pause();
233 bool Stop();
234
235 bool Load(const wxString& fileName);
236 %extend {
237 bool LoadFromURI(const wxString& location) {
238 return self->Load(wxURI(location));
239 }
240 }
241
242 void Loop(bool bLoop = true);
243 bool IsLooped();
244
245 wxMediaState GetState();
246
247 double GetPlaybackRate();
248 bool SetPlaybackRate(double dRate);
249
e3f1b5b5
RD
250 wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart);
251 wxFileOffset Tell();
252 wxFileOffset Length();
256c055e
RD
253};
254
255
256
257%constant wxEventType wxEVT_MEDIA_FINISHED;
258%constant wxEventType wxEVT_MEDIA_STOP;
259
260%pythoncode {
261EVT_MEDIA_FINISHED = wx.PyEventBinder( wxEVT_MEDIA_FINISHED, 1)
262EVT_MEDIA_STOP = wx.PyEventBinder( wxEVT_MEDIA_STOP, 1)
263}
264
265//---------------------------------------------------------------------------
266
267%init %{
268%}
269
270//---------------------------------------------------------------------------
271