]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/mediactrl.cpp
warnin - move pict to where it belongs :)
[wxWidgets.git] / src / mac / carbon / mediactrl.cpp
index 716590fefd06638aa14939a110706d05a35b1299..db6aed69033bc26d9dbc2b613586ace3737c91e6 100644 (file)
@@ -118,7 +118,11 @@ public:
     void FinishLoad();
 
     wxSize m_bestSize;              //Original movie size
+#ifdef __WXMAC_OSX__
     struct MovieType** m_movie;     //QT Movie handle/instance
+#else
+    Movie m_movie ;
+#endif
     wxControl* m_ctrl;              //Parent control
     bool m_bVideo;                  //Whether or not we have video
     class _wxQTTimer* m_timer;      //Timer for streaming the movie
@@ -257,17 +261,21 @@ bool wxQTMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent,
     if ( !
     
 #if wxUSE_CREATEMOVIECONTROL    
-    ctrl->wxControl::Create(parent, id, pos, size,
-                            m_ctrl->MacRemoveBordersFromStyle(style),
-                            validator, name)
-#else
     ctrl->wxWindow::Create(parent, id, pos, size,
                             m_ctrl->MacRemoveBordersFromStyle(style),
                             name)
+#else
+    ctrl->wxControl::Create(parent, id, pos, size,
+                            m_ctrl->MacRemoveBordersFromStyle(style),
+                            validator, name)
 #endif                            
         )
         return false;
 
+#if wxUSE_VALIDATORS
+        ctrl->SetValidator(validator);
+#endif
+
     m_ctrl = ctrl;
     return true;
 }
@@ -401,6 +409,8 @@ void wxQTMediaBackend::FinishLoad()
     //Native CreateMovieControl QT control (Thanks to Kevin Olliver's
     //wxQTMovie for some of this).
     //
+    #define GetControlPeer(whatever) ctrl->m_peer
+    wxMediaCtrl* ctrl = (wxMediaCtrl*) m_ctrl;
         Rect bounds = wxMacGetBoundsForControl(m_ctrl, 
                                                m_ctrl->GetPosition(),
                                                m_ctrl->GetSize());
@@ -419,7 +429,7 @@ void wxQTMediaBackend::FinishLoad()
     //ManuallyIdled - app handles movie idling rather than internal timer event loop
         ::CreateMovieControl( 
                     (WindowRef)
-                       m_ctrl->MacGetTopLevelWindowRef(),      //parent
+                       ctrl->MacGetTopLevelWindowRef(),        //parent
                        &bounds,                                                        //control bounds
                        m_movie,                                                                //movie handle
                        kMovieControlOptionHideController 
@@ -427,10 +437,9 @@ void wxQTMediaBackend::FinishLoad()
                        | kMovieControlOptionSetKeysEnabled 
 //                       | kMovieControlOptionManuallyIdled
                        ,                                                                       //flags
-                       GetControlPeer(m_ctrl)->GetControlRefAddr() );
+                       ctrl->m_peer->GetControlRefAddr() );
                        
-        ::EmbedControl(GetControlPeer(m_ctrl)->GetControlRef(), 
-                       (ControlRef) m_ctrl->GetParent()->GetHandle());
+        ::EmbedControl(ctrl->m_peer->GetControlRef(), (ControlRef)ctrl->GetParent()->GetHandle());
 #else
     //
     //"Emulation"
@@ -600,7 +609,7 @@ void wxQTMediaBackend::Cleanup()
     m_timer = NULL;
     
 #if wxUSE_CREATEMOVIECONTROL    
-    DisposeControl(GetControlPeer(m_ctrl)->GetControlRef());
+    DisposeControl(((wxMediaCtrl*)m_ctrl)->m_peer->GetControlRef());
 #endif
 
     StopMovie(m_movie);
@@ -620,8 +629,8 @@ wxSize wxQTMediaBackend::GetVideoSize() const
 //---------------------------------------------------------------------------
 // wxQTMediaBackend::Move
 //
-// If not using a native 10.2 QT control performs some emulated window
-// movement stuff
+// We need to do this even when using native qt control because 
+// CreateMovieControl is broken in this regard...
 //---------------------------------------------------------------------------
 void wxQTMediaBackend::Move(int x, int y, int w, int h)
 {
@@ -638,6 +647,15 @@ void wxQTMediaBackend::Move(int x, int y, int w, int h)
         ::SetMovieBox(m_movie, &theRect);
         wxASSERT(::GetMoviesError() == noErr);
     }
+#else
+    if(m_timer && m_ctrl)
+    {
+        m_ctrl->GetParent()->MacWindowToRootWindow(&x, &y);
+
+        ::MoveControl( (ControlRef) m_ctrl->GetHandle(), x, y );
+        m_ctrl->GetParent()->Refresh();
+        m_ctrl->GetParent()->Update();
+    }
 #endif
 }