]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/media.i
Fixes for wxPopupTransientWindow for wxMSW. Includes Patch #1181190,
[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
59 class wxMediaEvent : public wxNotifyEvent
60 {
61 public:
62 wxMediaEvent(wxEventType, int ) { wxPyRaiseNotImplemented(); }
63 };
64
65 class wxMediaCtrl : public wxControl
66 {
67 public:
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
79 bool Create(wxWindow* , wxWindowID ,
80 const wxString& ,
81 const wxPoint& ,
82 const wxSize& ,
83 long style ,
84 const wxString& ,
85 const wxValidator& ,
86 const wxString& ) { return false; }
87
88 bool Play() { return false; }
89 bool Pause() { return false; }
90 bool Stop() { return false; }
91
92 bool Load(const wxString& fileName) { return false; }
93 bool Load(const wxURI& location) { return false; }
94
95 wxMediaState GetState() { return wxMEDIASTATE_STOPPED; }
96
97 double GetPlaybackRate() { return 0.0; }
98 bool SetPlaybackRate(double dRate) { return false; }
99
100 wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart)
101 { return 0; }
102
103 wxFileOffset Tell() { return 0; }
104 wxFileOffset Length() { return 0; }
105 };
106
107 const wxEventType wxEVT_MEDIA_FINISHED = 0;
108 const wxEventType wxEVT_MEDIA_STOP = 0;
109
110 #endif
111 %}
112
113
114
115 //---------------------------------------------------------------------------
116
117 enum wxMediaState
118 {
119 wxMEDIASTATE_STOPPED,
120 wxMEDIASTATE_PAUSED,
121 wxMEDIASTATE_PLAYING
122 };
123
124
125
126 // MAKE_CONST_WXSTRING(MEDIABACKEND_DIRECTSHOW);
127 // MAKE_CONST_WXSTRING(MEDIABACKEND_MCI );
128 // MAKE_CONST_WXSTRING(MEDIABACKEND_QUICKTIME );
129
130 //---------------------------------------------------------------------------
131
132 class wxMediaEvent : public wxNotifyEvent
133 {
134 public:
135 wxMediaEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
136 };
137
138
139 //---------------------------------------------------------------------------
140
141 MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
142 MAKE_CONST_WXSTRING2(MediaCtrlNameStr, wxT("mediaCtrl"));
143 MustHaveApp(wxMediaCtrl);
144
145
146 class wxMediaCtrl : public wxControl
147 {
148 public:
149 %pythonAppend wxMediaCtrl "self._setOORInfo(self)"
150 %pythonAppend wxMediaCtrl() ""
151
152
153 wxMediaCtrl(wxWindow* parent,
154 wxWindowID id=-1,
155 const wxString& fileName = wxPyEmptyString,
156 const wxPoint& pos = wxDefaultPosition,
157 const wxSize& size = wxDefaultSize,
158 long style = 0,
159 const wxString& szBackend = wxPyEmptyString,
160 const wxValidator& validator = wxDefaultValidator,
161 const wxString& name = wxPyMediaCtrlNameStr);
162
163 %RenameCtor(PreMediaCtrl, wxMediaCtrl());
164
165 bool Create(wxWindow* parent,
166 wxWindowID id=-1,
167 const wxString& fileName = wxPyEmptyString,
168 const wxPoint& pos = wxDefaultPosition,
169 const wxSize& size = wxDefaultSize,
170 long style = 0,
171 const wxString& szBackend = wxPyEmptyString,
172 const wxValidator& validator = wxDefaultValidator,
173 const wxString& name = wxPyMediaCtrlNameStr);
174
175
176 bool Play();
177 bool Pause();
178 bool Stop();
179
180 bool Load(const wxString& fileName);
181 %extend {
182 bool LoadFromURI(const wxString& location) {
183 return self->Load(wxURI(location));
184 }
185 }
186
187 wxMediaState GetState();
188
189 double GetPlaybackRate();
190 bool SetPlaybackRate(double dRate);
191
192 wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart);
193 wxFileOffset Tell();
194 wxFileOffset Length();
195 };
196
197
198
199 %constant wxEventType wxEVT_MEDIA_FINISHED;
200 %constant wxEventType wxEVT_MEDIA_STOP;
201
202 %pythoncode {
203 EVT_MEDIA_FINISHED = wx.PyEventBinder( wxEVT_MEDIA_FINISHED, 1)
204 EVT_MEDIA_STOP = wx.PyEventBinder( wxEVT_MEDIA_STOP, 1)
205 }
206
207 //---------------------------------------------------------------------------
208
209 %init %{
210 %}
211
212 //---------------------------------------------------------------------------
213