]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/mediactrlcmn.cpp
compute scrollbar spacing the same way GtkScrolledWindow does it
[wxWidgets.git] / src / common / mediactrlcmn.cpp
index 8812a48efcfba756b769292ad10200982f93969f..b8cfb5da86ccd09ffa9e51ae2eb4f8af63b57012 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
-// Name:        src/common/mediactrl.cpp
+// Name:        src/common/mediactrlcmn.cpp
 // Purpose:     wxMediaCtrl common code
 // Author:      Ryan Norton <wxprojects@comcast.net>
 // Modified by:
 // Purpose:     wxMediaCtrl common code
 // Author:      Ryan Norton <wxprojects@comcast.net>
 // Modified by:
 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
 IMPLEMENT_CLASS(wxMediaCtrl, wxControl)
 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
 IMPLEMENT_CLASS(wxMediaCtrl, wxControl)
-DEFINE_EVENT_TYPE(wxEVT_MEDIA_STATECHANGED)
-DEFINE_EVENT_TYPE(wxEVT_MEDIA_PLAY)
-DEFINE_EVENT_TYPE(wxEVT_MEDIA_PAUSE)
+wxDEFINE_EVENT( wxEVT_MEDIA_STATECHANGED, wxMediaEvent );
+wxDEFINE_EVENT( wxEVT_MEDIA_PLAY, wxMediaEvent );
+wxDEFINE_EVENT( wxEVT_MEDIA_PAUSE, wxMediaEvent );
 IMPLEMENT_CLASS(wxMediaBackend, wxObject)
 IMPLEMENT_DYNAMIC_CLASS(wxMediaEvent, wxEvent)
 IMPLEMENT_CLASS(wxMediaBackend, wxObject)
 IMPLEMENT_DYNAMIC_CLASS(wxMediaEvent, wxEvent)
-DEFINE_EVENT_TYPE(wxEVT_MEDIA_FINISHED)
-DEFINE_EVENT_TYPE(wxEVT_MEDIA_LOADED)
-DEFINE_EVENT_TYPE(wxEVT_MEDIA_STOP)
+wxDEFINE_EVENT( wxEVT_MEDIA_FINISHED, wxMediaEvent );
+wxDEFINE_EVENT( wxEVT_MEDIA_LOADED, wxMediaEvent );
+wxDEFINE_EVENT( wxEVT_MEDIA_STOP, wxMediaEvent );
 
 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 //
 
 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 //
@@ -107,8 +107,7 @@ bool wxMediaCtrl::Create(wxWindow* parent, wxWindowID id,
         {
             if (!Load(fileName))
             {
         {
             if (!Load(fileName))
             {
-                delete m_imp;
-                m_imp = NULL;
+                wxDELETE(m_imp);
                 return false;
             }
         }
                 return false;
             }
         }
@@ -124,7 +123,6 @@ bool wxMediaCtrl::Create(wxWindow* parent, wxWindowID id,
 
         while((classInfo = NextBackend(&it)) != NULL)
         {
 
         while((classInfo = NextBackend(&it)) != NULL)
         {
-            wxLogMessage( classInfo->GetClassName() );
             if(!DoCreate(classInfo, parent, id,
                          pos, size, style, validator, name))
                 continue;
             if(!DoCreate(classInfo, parent, id,
                          pos, size, style, validator, name))
                 continue;
@@ -172,8 +170,7 @@ bool wxMediaCtrl::Create(wxWindow* parent, wxWindowID id,
 
         if (!Load(location))
         {
 
         if (!Load(location))
         {
-            delete m_imp;
-            m_imp = NULL;
+            wxDELETE(m_imp);
             return false;
         }
 
             return false;
         }
 
@@ -251,9 +248,10 @@ const wxClassInfo* wxMediaCtrl::NextBackend(wxClassInfo::const_iterator* it)
           *it != end; ++(*it) )
     {
         const wxClassInfo* classInfo = **it;
           *it != end; ++(*it) )
     {
         const wxClassInfo* classInfo = **it;
-        if ( classInfo->IsKindOf(CLASSINFO(wxMediaBackend)) &&
-             classInfo != CLASSINFO(wxMediaBackend) )
+        if ( classInfo->IsKindOf(wxCLASSINFO(wxMediaBackend))  &&
+             classInfo != wxCLASSINFO(wxMediaBackend) )
         {
         {
+            ++(*it);
             return classInfo;
         }
     }
             return classInfo;
         }
     }
@@ -468,7 +466,7 @@ void wxMediaCtrl::DoMoveWindow(int x, int y, int w, int h)
 //---------------------------------------------------------------------------
 // wxMediaCtrl::MacVisibilityChanged
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 // wxMediaCtrl::MacVisibilityChanged
 //---------------------------------------------------------------------------
-#ifdef __WXMAC__
+#ifdef __WXOSX_CARBON__
 void wxMediaCtrl::MacVisibilityChanged()
 {
     wxControl::MacVisibilityChanged();
 void wxMediaCtrl::MacVisibilityChanged()
 {
     wxControl::MacVisibilityChanged();
@@ -512,13 +510,13 @@ bool wxMediaBackendCommonBase::SendStopEvent()
 {
     wxMediaEvent theEvent(wxEVT_MEDIA_STOP, m_ctrl->GetId());
 
 {
     wxMediaEvent theEvent(wxEVT_MEDIA_STOP, m_ctrl->GetId());
 
-    return !m_ctrl->ProcessEvent(theEvent) || theEvent.IsAllowed();
+    return !m_ctrl->GetEventHandler()->ProcessEvent(theEvent) || theEvent.IsAllowed();
 }
 
 void wxMediaBackendCommonBase::QueueEvent(wxEventType evtType)
 {
     wxMediaEvent theEvent(evtType, m_ctrl->GetId());
 }
 
 void wxMediaBackendCommonBase::QueueEvent(wxEventType evtType)
 {
     wxMediaEvent theEvent(evtType, m_ctrl->GetId());
-    m_ctrl->AddPendingEvent(theEvent);
+    m_ctrl->GetEventHandler()->AddPendingEvent(theEvent);
 }
 
 void wxMediaBackendCommonBase::QueuePlayEvent()
 }
 
 void wxMediaBackendCommonBase::QueuePlayEvent()
@@ -546,10 +544,10 @@ void wxMediaBackendCommonBase::QueueStopEvent()
 //
 #include "wx/html/forcelnk.h"
 
 //
 #include "wx/html/forcelnk.h"
 
-#ifdef __WXMSW__ // MSW has huge backends so we do it seperately
+#ifdef __WXMSW__ // MSW has huge backends so we do it separately
 FORCE_LINK(wxmediabackend_am)
 FORCE_LINK(wxmediabackend_wmp10)
 FORCE_LINK(wxmediabackend_am)
 FORCE_LINK(wxmediabackend_wmp10)
-#else
+#elif !defined(__WXOSX_COCOA__)
 FORCE_LINK(basewxmediabackends)
 #endif
 
 FORCE_LINK(basewxmediabackends)
 #endif