X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4fc81cbc050c7c69cb04eeef508a8a237a4935c5..bf9ce7b55ec8d1e4a8f2dd8ca2c2b6e9f86b57b7:/src/cocoa/mediactrl.mm?ds=sidebyside diff --git a/src/cocoa/mediactrl.mm b/src/cocoa/mediactrl.mm index 0d09279525..3e1a97a1d2 100644 --- a/src/cocoa/mediactrl.mm +++ b/src/cocoa/mediactrl.mm @@ -1,10 +1,9 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: mac/cocoa/mediactrl.cpp +// Name: src/cocoa/mediactrl.mm // Purpose: Built-in Media Backends for Cocoa // Author: Ryan Norton // Modified by: // Created: 02/03/05 -// RCS-ID: $Id$ // Copyright: (c) 2004-2005 Ryan Norton, (c) 2005 David Elliot // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -17,10 +16,6 @@ // Pre-compiled header stuff //--------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "mediactrl.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -28,16 +23,17 @@ #pragma hdrstop #endif -//--------------------------------------------------------------------------- -// Includes -//--------------------------------------------------------------------------- -#include "wx/mediactrl.h" - //--------------------------------------------------------------------------- // Compilation guard //--------------------------------------------------------------------------- #if wxUSE_MEDIACTRL +#include "wx/mediactrl.h" + +#ifndef WX_PRECOMP + #include "wx/timer.h" +#endif + //=========================================================================== // BACKEND DECLARATIONS //=========================================================================== @@ -51,7 +47,6 @@ //--------------------------------------------------------------------------- // QT Includes //--------------------------------------------------------------------------- -#include "wx/timer.h" #include #include "wx/cocoa/autorelease.h" @@ -68,11 +63,11 @@ public: wxQTMediaBackend(); ~wxQTMediaBackend(); - virtual bool CreateControl(wxControl* ctrl, wxWindow* parent, + virtual bool CreateControl(wxControl* ctrl, wxWindow* parent, wxWindowID id, - const wxPoint& pos, + const wxPoint& pos, const wxSize& size, - long style, + long style, const wxValidator& validator, const wxString& name); @@ -99,7 +94,7 @@ public: void FinishLoad(); wxSize m_bestSize; //Original movie size - Movie m_movie; //QT Movie handle/instance + Movie m_movie; //QT Movie handle/instance NSMovieView* m_movieview; //NSMovieView instance wxControl* m_ctrl; //Parent control bool m_bVideo; //Whether or not we have video @@ -112,7 +107,7 @@ public: //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // wxQTMediaBackend -// +// //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ IMPLEMENT_DYNAMIC_CLASS(wxQTMediaBackend, wxMediaBackend); @@ -151,10 +146,10 @@ public: if (!m_bPaused) { if(!IsMovieDone(m_movie)) - MoviesTask(m_movie, MOVIE_DELAY); + MoviesTask(m_movie, MOVIE_DELAY); else { - wxMediaEvent theEvent(wxEVT_MEDIA_STOP, + wxMediaEvent theEvent(wxEVT_MEDIA_STOP, m_parent->m_ctrl->GetId()); m_parent->m_ctrl->ProcessEvent(theEvent); @@ -165,7 +160,7 @@ public: wxASSERT(::GetMoviesError() == noErr); //send the event to our child - wxMediaEvent theEvent(wxEVT_MEDIA_FINISHED, + wxMediaEvent theEvent(wxEVT_MEDIA_FINISHED, m_parent->m_ctrl->GetId()); m_parent->m_ctrl->ProcessEvent(theEvent); } @@ -202,7 +197,7 @@ wxQTMediaBackend::~wxQTMediaBackend() if(m_timer) Cleanup(); - //Note that ExitMovies() is not neccessary... + //Note that ExitMovies() is not necessary... ExitMovies(); } @@ -212,24 +207,24 @@ wxQTMediaBackend::~wxQTMediaBackend() // 1) Intializes QuickTime // 2) Creates the control window //--------------------------------------------------------------------------- -bool wxQTMediaBackend::CreateControl(wxControl* inctrl, wxWindow* parent, +bool wxQTMediaBackend::CreateControl(wxControl* inctrl, wxWindow* parent, wxWindowID wid, - const wxPoint& pos, + const wxPoint& pos, const wxSize& size, - long style, + long style, const wxValidator& validator, const wxString& name) { EnterMovies(); - + wxMediaCtrl* ctrl = (wxMediaCtrl*) inctrl; //Create the control base - wxASSERT(ctrl->CreateBase(parent,wid,pos,size,style, validator, size)); - + wxASSERT(ctrl->CreateBase(parent,wid,pos,size,style, validator, name)); + //Create the NSMovieView ctrl->SetNSView(NULL); - NSView* theView = [[NSMovieView alloc] initWithFrame: ctrl->MakeDefaultNSRect(size)]; + NSMovieView* theView = [[NSMovieView alloc] initWithFrame: ctrl->MakeDefaultNSRect(size)]; ctrl->SetNSView(theView); [theView release]; @@ -239,7 +234,8 @@ bool wxQTMediaBackend::CreateControl(wxControl* inctrl, wxWindow* parent, parent->CocoaAddChild(ctrl); ctrl->SetInitialFrameRect(pos,size); } - + + [theView showController:false adjustingSize:true]; m_movieview = theView; m_ctrl = ctrl; return true; @@ -254,7 +250,7 @@ bool wxQTMediaBackend::Load(const wxString& fileName) { return Load( wxURI( - wxString( wxT("file://") ) + fileName + wxString( wxT("file://") ) + fileName ) ); } @@ -323,7 +319,7 @@ void wxQTMediaBackend::FinishLoad() // //Here, if the parent of the control has a sizer - we //tell it to recalculate the size of this control since - //the user opened a seperate media file + //the user opened a separate media file // m_ctrl->InvalidateBestSize(); m_ctrl->GetParent()->Layout(); @@ -374,7 +370,7 @@ bool wxQTMediaBackend::Stop() ::StopMovie(m_movie); if(::GetMoviesError() != noErr) return false; - + ::GoToBeginningOfMovie(m_movie); return ::GetMoviesError() == noErr; } @@ -449,7 +445,7 @@ wxLongLong wxQTMediaBackend::GetDuration() //--------------------------------------------------------------------------- wxMediaState wxQTMediaBackend::GetState() { - if ( !m_timer || (m_timer->IsRunning() == false && + if ( !m_timer || (m_timer->IsRunning() == false && m_timer->GetPaused() == false) ) return wxMEDIASTATE_STOPPED; @@ -495,12 +491,7 @@ void wxQTMediaBackend::Move(int x, int y, int w, int h) //in source file that contains stuff you don't directly use -#include +#include "wx/html/forcelnk.h" FORCE_LINK_ME(basewxmediabackends); #endif //wxUSE_MEDIACTRL - - - - -