Retired Document
Important: This sample code may not represent best practices for current development. The project may use deprecated symbols and illustrate technologies and techniques that are no longer recommended.
Relevant replacement documents include:
Start Code/Events.c
// Play Movie with Controller Sample |
// Based on QTShell |
// WWDC 2000 |
#include "ComApplication.h" |
#include "ComFramework.h" |
#include "MacFramework.h" |
////////// |
// |
// ActivateController |
// Activate or deactivate the movie controller in the specified window. |
// |
////////// |
void ActivateController (WindowReference theWindow, Boolean IsActive) |
{ |
WindowObject myWindowObject = NULL; |
MovieController myMC = NULL; |
GrafPtr mySavedPort = NULL; |
if (theWindow == NULL) |
return; |
GetPort(&mySavedPort); |
MacSetPort(QTFrame_GetPortFromWindowReference(theWindow)); |
// get the window object associated with the specified window |
myWindowObject = QTFrame_GetWindowObjectFromWindow(theWindow); |
if (myWindowObject != NULL) { |
myMC = (**myWindowObject).fController; |
if (myMC != NULL) |
// Step 1. Insert MCActivate.clp here... |
} |
MacSetPort(mySavedPort); |
} |
////////// |
// |
// Draw |
// Update the specified window. |
// |
////////// |
void Draw (WindowReference theWindow, Rect *theRefreshArea) |
{ |
#pragma unused(theRefreshArea) |
GrafPtr mySavedPort; |
GetPort(&mySavedPort); |
MacSetPort(QTFrame_GetPortFromWindowReference(theWindow)); |
BeginUpdate(QTFrame_GetWindowFromWindowReference(theWindow)); |
//EraseRect(theRefreshArea); // this is important only for non-rectangular movies |
// ***insert application-specific drawing here*** |
// draw the movie controller and its movie |
// Step 2. Insert Draw.clp here... |
EndUpdate(QTFrame_GetWindowFromWindowReference(theWindow)); |
MacSetPort(mySavedPort); |
} |
////////// |
// |
// CheckMovieControllers |
// Let all movie controllers have a chance to process the event. |
// |
// Returns true if the event was handled by some movie controller, false otherwise |
// |
////////// |
Boolean CheckMovieControllers (EventRecord *theEvent) |
{ |
WindowPtr myWindow = NULL; |
MovieController myMC = NULL; |
myWindow = QTFrame_GetFrontMovieWindow(); |
while (myWindow != NULL) { |
myMC = QTFrame_GetMCFromWindow(myWindow); |
if (myMC != NULL) |
// Step 3. Insert MCIsPlayerEvent.clp here... |
return(true); |
myWindow = QTFrame_GetNextMovieWindow(myWindow); |
} |
return(false); |
} |
Copyright © 2003 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2003-01-14