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




On Mar 1, 2005, at 6:16 AM, Mike Garrity wrote:

Just to reiterate what we are doing....

I am starting from scratch to re-implement an old program using Carbon events, compositing windows, and HIViews.

The main window displays an image which represents a set of 2 dimensional physical objects (Think electrical components on a circuit board) located in a physical coordinate system (e.g positions and sizes in inches or microns). The window displays the image at various zoom levels and aspect ratios.

I have been working on implementing the drawing of the physical objects as custom HIViews. The custom HIViews are based on the HIFramework sample code. I have also been using a custom HIView to represent the physical coordinate space in which the objects HIViews' are embedded. I have successfully embedded the custom coordinate space view into an HIScrollView. So far, so good.

Hit testing and drag tracking on the custom HIViews looks to be straight forward enough to implement based on the HIFramework sample code.

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"???

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


Check out the sample App CarbonSketch. It draws with CoreGraphics instead of the deprecated Quickdraw. It also does the rubber-band technique using overlays.

Mike
 _______________________________________________
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.