Re: What's the most cocoa-ey pattern for this?
Re: What's the most cocoa-ey pattern for this?
- Subject: Re: What's the most cocoa-ey pattern for this?
- From: Michael B Johnson <email@hidden>
- Date: Sat, 10 Jan 2009 16:39:32 -0800
So I believe I figured out the most Cocoa-ey pattern to do this
tracking of time ranges. In 10.5, Apple added the NSTrackingArea to
NSView. This is exactly the analogous pattern; except in a view it's
2D with an offset, while what I'm interested in is time:1D with an
offset. To make it even more concrete, if the equivalent capability
was on QTMovie, I'd have what I want. To be specific, here's the bug
(radar 6487403) "need QTTrackingTimeRange for QTMovie, like
NSTrackingArea for NSView"
comments welcome (or file duplicate bug reports to express your
interest in seeing this as well :-)):
-------------------
I propose a new class, called a QTTrackingTimeRange, modeled after
NSTrackingArea.
Analogous to how tracking rects are used in a NSView, this would be
used for time ranges in a QTMovie.
// note: I don't know what the QTTrackingTimeRangeOptions would be, if
any - assuming some bitwise-OR-able flags, probably expressing
interest in direction
@interface QTTrackingTimeRange : NSObject <NSCopying, NSCoding> {
}
- (QTTrackingTimeRange *)initWithTimeRange:(QTTimeRange)range options:
(QTTrackingTimeRangeOptions)options owner:(id)owner userInfo:
(NSDictionary *)userInfo;
@property QTTimeRange range;
@property (readonly) QTTrackingTimeRangeOptions options;
@property (readonly) owner;
@property (readonly) NSDictionary* userInfo;
@property (readonly) BOOL active;
@end
// category we are proposing for QTMovie:
@interface QTMovie(TrackingTimeRange)
- addTrackingTimeRange:(QTTrackingTimeRange*)trackingTimeRange;
- removeTrackingTimeRange:(QTTrackingTimeRange*)trackingTimeRange;
@end
// protocol for the "owner" object to implement to be notified as
these time ranges are exited or entered and from what direction (if
known)
@protocol QTTrackingTimeRangeOwner
- trackingTimeRangeEntered:(QTTrackingTimeRange*)trackingTimeRange
direction:(QTTrackingTimeRangeDirection)direction;
- trackingTimeRangeExited:(QTTrackingTimeRange*)trackingTimeRange
direction:(QTTrackingTimeRangeDirection)direction;
@end
enum {
QTTrackingTimeRangeDirectionForward,
QTTrackingTimeRangeDirectionBackward,
QTTrackingTimeRangeDirectionUnknown
};
typedef NSUInteger QTTrackingTimeRangeDirection;
--> Michael B. Johnson, PhD
--> http://homepage.mac.com/drwave (personal)
--> http://xenia.media.mit.edu/~wave (alum)
--> MPG Lead
--> Pixar Animation Studios
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden