1 /////////////////////////////////////////////////////////////////////////////
 
   3 // Purpose:     SWIG definitions for the wxMediaCtrl
 
   7 // Created:     23-Nov-2004
 
   9 // Copyright:   (c) 2004 by Total Control Software
 
  10 // Licence:     wxWindows license
 
  11 /////////////////////////////////////////////////////////////////////////////
 
  14 "Classes for a media player control"
 
  17 %module(package="wx", docstring=DOCSTRING) media
 
  21 #include "wx/wxPython/wxPython.h"
 
  22 #include "wx/wxPython/pyclasses.h"
 
  24 #include <wx/mediactrl.h>
 
  28 //----------------------------------------------------------------------
 
  31 %pythoncode { wx = _core }
 
  32 %pythoncode { __docfilter__ = wx.__DocFilter(globals()) }
 
  34 %include _media_rename.i
 
  36 //---------------------------------------------------------------------------
 
  38 %typemap(in) wxLongLong {
 
  39     $1 = PyLong_AsLongLong($input);
 
  43 %typemap(out) wxLongLong {
 
  44     $result = PyLong_FromLongLong($1.GetValue());
 
  47 //---------------------------------------------------------------------------
 
  48 // Make a stubbed out class for platforms that don't have wxMediaCtrl
 
  53     wxMEDIASTATE_STOPPED=0,
 
  54     wxMEDIASTATE_PAUSED=0,
 
  55     wxMEDIASTATE_PLAYING=0
 
  59 class wxMediaEvent : public wxNotifyEvent
 
  62     wxMediaEvent(wxEventType, int )    { wxPyRaiseNotImplemented(); }
 
  65 class wxMediaCtrl : public wxControl
 
  68     wxMediaCtrl()    { wxPyRaiseNotImplemented(); }
 
  70     wxMediaCtrl(wxWindow* , wxWindowID ,
 
  77                 const wxString& ) { wxPyRaiseNotImplemented(); }
 
  79     bool Create(wxWindow* , wxWindowID ,
 
  86                 const wxString& ) { return false; }
 
  88     bool Play() { return false; }
 
  89     bool Pause() { return false; }
 
  90     bool Stop() { return false; }
 
  92     bool Load(const wxString& fileName) { return false; }
 
  93     bool Load(const wxURI& location) { return false; }
 
  95     wxMediaState GetState() { return wxMEDIASTATE_STOPPED; }
 
  97     double GetPlaybackRate()  { return 0.0; }
 
  98     bool SetPlaybackRate(double dRate) { return false; }
 
 100     wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart)
 
 103     wxFileOffset Tell()    { return 0; }
 
 104     wxFileOffset Length()    { return 0; }
 
 106     double GetVolume() { return 0.0; }
 
 107     bool   SetVolume(double dVolume) { return false; }
 
 110 const wxEventType wxEVT_MEDIA_FINISHED = 0;
 
 111 const wxEventType wxEVT_MEDIA_STOP = 0;
 
 118 //---------------------------------------------------------------------------
 
 122     wxMEDIASTATE_STOPPED,
 
 129 // MAKE_CONST_WXSTRING(MEDIABACKEND_DIRECTSHOW);
 
 130 // MAKE_CONST_WXSTRING(MEDIABACKEND_MCI       );
 
 131 // MAKE_CONST_WXSTRING(MEDIABACKEND_QUICKTIME );
 
 133 //---------------------------------------------------------------------------
 
 135 class wxMediaEvent : public wxNotifyEvent
 
 138     wxMediaEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
 
 142 //---------------------------------------------------------------------------
 
 144 MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
 
 145 MAKE_CONST_WXSTRING2(MediaCtrlNameStr, wxT("mediaCtrl"));
 
 146 MustHaveApp(wxMediaCtrl);
 
 149 class wxMediaCtrl : public wxControl
 
 152     %pythonAppend wxMediaCtrl      "self._setOORInfo(self)"
 
 153     %pythonAppend wxMediaCtrl()    ""
 
 156     wxMediaCtrl(wxWindow* parent,
 
 158                 const wxString& fileName = wxPyEmptyString,
 
 159                 const wxPoint& pos = wxDefaultPosition,
 
 160                 const wxSize& size = wxDefaultSize,
 
 162                 const wxString& szBackend = wxPyEmptyString,
 
 163                 const wxValidator& validator = wxDefaultValidator,
 
 164                 const wxString& name = wxPyMediaCtrlNameStr);
 
 166     %RenameCtor(PreMediaCtrl,  wxMediaCtrl());
 
 168     bool Create(wxWindow* parent,
 
 170                 const wxString& fileName = wxPyEmptyString,
 
 171                 const wxPoint& pos = wxDefaultPosition,
 
 172                 const wxSize& size = wxDefaultSize,
 
 174                 const wxString& szBackend = wxPyEmptyString,
 
 175                 const wxValidator& validator = wxDefaultValidator,
 
 176                 const wxString& name = wxPyMediaCtrlNameStr);
 
 183     double GetVolume();                 //DirectShow only
 
 184     bool   SetVolume(double dVolume);   //DirectShow only
 
 186     bool Load(const wxString& fileName);
 
 188         bool LoadFromURI(const wxString& location) {
 
 189             return self->Load(wxURI(location));
 
 193     wxMediaState GetState();
 
 195     double GetPlaybackRate();
 
 196     bool SetPlaybackRate(double dRate);
 
 198     wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart);    
 
 200     wxFileOffset Length();
 
 205 %constant wxEventType wxEVT_MEDIA_FINISHED;
 
 206 %constant wxEventType wxEVT_MEDIA_STOP;
 
 209 EVT_MEDIA_FINISHED = wx.PyEventBinder( wxEVT_MEDIA_FINISHED, 1)
 
 210 EVT_MEDIA_STOP     = wx.PyEventBinder( wxEVT_MEDIA_STOP, 1)
 
 213 //---------------------------------------------------------------------------
 
 218 //---------------------------------------------------------------------------