02.04.2013 Views

QuickTime Kit Programming Guide - filibeto.org

QuickTime Kit Programming Guide - filibeto.org

QuickTime Kit Programming Guide - filibeto.org

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

C H A P T E R 4<br />

Adding New Capabilities to the QT<strong>Kit</strong>Player Application<br />

13. After the @end directive, you add this chunk of code to intercept some actions for the movie<br />

controller and to update the current time display in the drawer. Note that the refCon parameter<br />

is a document id:<br />

pascal Boolean MyActionFilter (MovieController mc, short action, void* params,<br />

long refCon)<br />

{<br />

MovieDocument *doc = (MovieDocument *)refCon;<br />

}<br />

switch (action)<br />

{<br />

// handle idle events<br />

case mcActionIdle:<br />

// update the current time display in the info drawer<br />

if ([[doc drawer] state] != NSDrawerClosedState)<br />

[doc setTimeDisplay];<br />

break;<br />

}<br />

return false;<br />

This wraps up the additions to the code you need to make in your MovieDocument implementation<br />

file. You’re now ready to build and compile your Xcode project.<br />

The Completed Project<br />

If you’ve followed the steps outlined in this chapter, you’ll have successfully extended the QT<strong>Kit</strong>Player<br />

application with a Cocoa drawer you can toggle open and closed. The drawer will display and update<br />

the time of any <strong>QuickTime</strong> movie you want to play.<br />

You can control movie playback as you have before, with QT<strong>Kit</strong>Player functionality still in place for<br />

movie control, as shown in Figure 4-13.<br />

Figure 4-13 Open drawer with movie Show Controller selected<br />

The Completed Project 77<br />

2005-11-09 | © 2004, 2005 Apple Computer, Inc. All Rights Reserved.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!