]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/media.i
Get/SetTitle only for wxTopLevelWindow (wxMGL part).
[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 double GetVolume() { return 0.0; }
107 bool SetVolume(double dVolume) { return false; }
108 };
109
110 const wxEventType wxEVT_MEDIA_FINISHED = 0;
111 const wxEventType wxEVT_MEDIA_STOP = 0;
112
113 #endif
114 %}
115
116
117
118 //---------------------------------------------------------------------------
119
120 enum wxMediaState
121 {
122 wxMEDIASTATE_STOPPED,
123 wxMEDIASTATE_PAUSED,
124 wxMEDIASTATE_PLAYING
125 };
126
127
128
129 // MAKE_CONST_WXSTRING(MEDIABACKEND_DIRECTSHOW);
130 // MAKE_CONST_WXSTRING(MEDIABACKEND_MCI );
131 // MAKE_CONST_WXSTRING(MEDIABACKEND_QUICKTIME );
132
133 //---------------------------------------------------------------------------
134
135 class wxMediaEvent : public wxNotifyEvent
136 {
137 public:
138 wxMediaEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
139 };
140
141
142 //---------------------------------------------------------------------------
143
144 MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
145 MAKE_CONST_WXSTRING2(MediaCtrlNameStr, wxT("mediaCtrl"));
146 MustHaveApp(wxMediaCtrl);
147
148
149 class wxMediaCtrl : public wxControl
150 {
151 public:
152 %pythonAppend wxMediaCtrl "self._setOORInfo(self)"
153 %pythonAppend wxMediaCtrl() ""
154
155
156 wxMediaCtrl(wxWindow* parent,
157 wxWindowID id=-1,
158 const wxString& fileName = wxPyEmptyString,
159 const wxPoint& pos = wxDefaultPosition,
160 const wxSize& size = wxDefaultSize,
161 long style = 0,
162 const wxString& szBackend = wxPyEmptyString,
163 const wxValidator& validator = wxDefaultValidator,
164 const wxString& name = wxPyMediaCtrlNameStr);
165
166 %RenameCtor(PreMediaCtrl, wxMediaCtrl());
167
168 bool Create(wxWindow* parent,
169 wxWindowID id=-1,
170 const wxString& fileName = wxPyEmptyString,
171 const wxPoint& pos = wxDefaultPosition,
172 const wxSize& size = wxDefaultSize,
173 long style = 0,
174 const wxString& szBackend = wxPyEmptyString,
175 const wxValidator& validator = wxDefaultValidator,
176 const wxString& name = wxPyMediaCtrlNameStr);
177
178
179 bool Play();
180 bool Pause();
181 bool Stop();
182
183 double GetVolume(); //DirectShow only
184 bool SetVolume(double dVolume); //DirectShow only
185
186 bool Load(const wxString& fileName);
187 %extend {
188 bool LoadFromURI(const wxString& location) {
189 return self->Load(wxURI(location));
190 }
191 }
192
193 wxMediaState GetState();
194
195 double GetPlaybackRate();
196 bool SetPlaybackRate(double dRate);
197
198 wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart);
199 wxFileOffset Tell();
200 wxFileOffset Length();
201 };
202
203
204
205 %constant wxEventType wxEVT_MEDIA_FINISHED;
206 %constant wxEventType wxEVT_MEDIA_STOP;
207
208 %pythoncode {
209 EVT_MEDIA_FINISHED = wx.PyEventBinder( wxEVT_MEDIA_FINISHED, 1)
210 EVT_MEDIA_STOP = wx.PyEventBinder( wxEVT_MEDIA_STOP, 1)
211 }
212
213 //---------------------------------------------------------------------------
214
215 %init %{
216 %}
217
218 //---------------------------------------------------------------------------
219