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