Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HIView and marquee selection



Question 1 - There have been many discussions about a lack of "rubber-band api." At the time (May03) the WindowFun sample code was pointed out as a "modern" way of implementing a selection tool (like the Finder). WindowFun had a LineTool example that created an overlay window using QDBeginCGContext. I wanted to make sure that using QuickDraw CGrafPtrs was still the "modern way of doing this"???

There are several ways to get a CGContext for drawing into an overlay window. Using QDBeginCGContext in the kEventWindowPaint handler is one mechanism. You could also create an HIView that fills the overlay window and have it respond to the kEventControlDraw event.


For that matter, you could probably just install a kEventControlDraw handler on the content view of the overlay window. IIRC, the trickiest part is that an overlay window doesn't show it's content view by default.

Question 2 - I know I can do it any way I want too, but just wanted some advice... Our image will consist of many subViews (one for each physical object) that we want to be user selectable. Where should the selection tool be drawn, at the window level or at the custom HIView level???

At the window level -
we get the mouse down first and begin tracking
draw the current selection rect to the overlay window
send this rect to the view
the view determines which subView(s) intersect the select rect and selects them
the view then sets HIViewSetNeedsDisplay for each subview


At the custom HIView level -
Override the TView.Track and begin tracking
draw the current selection rect to the overlay window
the view determines which subView(s) intersect the select rect and selects them
the view then sets HIViewSetNeedsDisplay for each subview

My personal choice would be to not use a separate HIView for each component. Rather I would use some other, internal abstraction to represent the components and then I would draw the components in a single HIView. That way all the drawing (of components, of selection rectangles, etc...) and hit testing all occur in the same coordinate system.


Scott

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden
References: 
 >HIView and marquee selection (From: Mike Garrity <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.