+ ::MCDoAction(m_mc, 32, (void*)true); // mcActionSetKeysEnabled
+ wxASSERT(::GetMoviesError() == noErr);
+
+ // Setup a callback so we can tell when the user presses
+ // play on the player controls
+ m_mcactionupp = wxQTMediaBackend::MCFilterProc;
+ ::MCSetActionFilterWithRefCon( m_mc, m_mcactionupp, (long)this );
+ wxASSERT(::GetMoviesError() == noErr);
+
+ // Part of a suggestion from Greg Hazel to repaint movie when idle
+ m_ctrl->PushEventHandler(new wxQTMediaEvtHandler(this));
+
+ // Create offscreen GWorld for where to "show" when window is hidden
+ Rect worldRect;
+ worldRect.left = worldRect.top = 0;
+ worldRect.right = worldRect.bottom = 1;
+ ::NewGWorld(&m_movieWorld, 0, &worldRect, NULL, NULL, 0);
+
+ // Catch window messages:
+ // if we do not do this and if the user clicks the play
+ // button on the controller, for instance, nothing will happen...
+ EventTypeSpec theWindowEventTypes[] =
+ {
+ { kEventClassMouse, kEventMouseDown },
+ { kEventClassMouse, kEventMouseUp },
+ { kEventClassMouse, kEventMouseDragged },
+ { kEventClassKeyboard, kEventRawKeyDown },
+ { kEventClassKeyboard, kEventRawKeyRepeat },
+ { kEventClassKeyboard, kEventRawKeyUp },
+ { kEventClassWindow, kEventWindowUpdate },
+ { kEventClassWindow, kEventWindowActivated },
+ { kEventClassWindow, kEventWindowDeactivated }
+ };
+ m_windowUPP =
+ NewEventHandlerUPP( wxQTMediaBackend::WindowEventHandler );
+ InstallWindowEventHandler(
+ wrTLW,
+ m_windowUPP,
+ GetEventTypeCount( theWindowEventTypes ), theWindowEventTypes,
+ this,
+ &m_windowEventHandler );
+ }
+ else
+ {
+ // MovieController already created:
+ // Just change the movie in it and we're good to go
+ Point thePoint;
+ thePoint.h = thePoint.v = 0;
+ ::MCSetMovie(m_mc, m_movie,
+ (WindowRef)m_ctrl->MacGetTopLevelWindowRef(),
+ thePoint);
+ wxASSERT(::GetMoviesError() == noErr);
+ }