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; }
 
 107 const wxEventType wxEVT_MEDIA_FINISHED = 0;
 
 108 const wxEventType wxEVT_MEDIA_STOP = 0;
 
 115 //---------------------------------------------------------------------------
 
 119     wxMEDIASTATE_STOPPED,
 
 126 // MAKE_CONST_WXSTRING(MEDIABACKEND_DIRECTSHOW);
 
 127 // MAKE_CONST_WXSTRING(MEDIABACKEND_MCI       );
 
 128 // MAKE_CONST_WXSTRING(MEDIABACKEND_QUICKTIME );
 
 130 //---------------------------------------------------------------------------
 
 132 class wxMediaEvent : public wxNotifyEvent
 
 135     wxMediaEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
 
 139 //---------------------------------------------------------------------------
 
 141 MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
 
 142 MAKE_CONST_WXSTRING2(MediaCtrlNameStr, wxT("mediaCtrl"));
 
 143 MustHaveApp(wxMediaCtrl);
 
 146 class wxMediaCtrl : public wxControl
 
 149     %pythonAppend wxMediaCtrl      "self._setOORInfo(self)"
 
 150     %pythonAppend wxMediaCtrl()    ""
 
 153     wxMediaCtrl(wxWindow* parent,
 
 155                 const wxString& fileName = wxPyEmptyString,
 
 156                 const wxPoint& pos = wxDefaultPosition,
 
 157                 const wxSize& size = wxDefaultSize,
 
 159                 const wxString& szBackend = wxPyEmptyString,
 
 160                 const wxValidator& validator = wxDefaultValidator,
 
 161                 const wxString& name = wxPyMediaCtrlNameStr);
 
 163     %RenameCtor(PreMediaCtrl,  wxMediaCtrl());
 
 165     bool Create(wxWindow* parent,
 
 167                 const wxString& fileName = wxPyEmptyString,
 
 168                 const wxPoint& pos = wxDefaultPosition,
 
 169                 const wxSize& size = wxDefaultSize,
 
 171                 const wxString& szBackend = wxPyEmptyString,
 
 172                 const wxValidator& validator = wxDefaultValidator,
 
 173                 const wxString& name = wxPyMediaCtrlNameStr);
 
 180     bool Load(const wxString& fileName);
 
 182         bool LoadFromURI(const wxString& location) {
 
 183             return self->Load(wxURI(location));
 
 187     wxMediaState GetState();
 
 189     double GetPlaybackRate();
 
 190     bool SetPlaybackRate(double dRate);
 
 192     wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart);    
 
 194     wxFileOffset Length();
 
 199 %constant wxEventType wxEVT_MEDIA_FINISHED;
 
 200 %constant wxEventType wxEVT_MEDIA_STOP;
 
 203 EVT_MEDIA_FINISHED = wx.PyEventBinder( wxEVT_MEDIA_FINISHED, 1)
 
 204 EVT_MEDIA_STOP     = wx.PyEventBinder( wxEVT_MEDIA_STOP, 1)
 
 207 //---------------------------------------------------------------------------
 
 212 //---------------------------------------------------------------------------