• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Converting HIPoints to CGPoints/NSPoints in global space?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Converting HIPoints to CGPoints/NSPoints in global space?


  • Subject: Re: Converting HIPoints to CGPoints/NSPoints in global space?
  • From: Scott Thompson <email@hidden>
  • Date: Tue, 14 Feb 2006 10:14:57 -0600


On Feb 13, 2006, at 12:00 PM, Raleigh Ledet wrote:

HiPoints are not always 0,0 upper left. HIViews mimic NSViews See:
<http://developer.apple.com/documentation/Carbon/Conceptual/ HIViewDoc/HIView_concept/chapter_1_section_1.html>

:-) Someone at Wacom pointing Dave at remedial carbon documentation is very, very amusing to me. :-)


I don't know how accurate it is to say that HIViews mimic NSViews. It is true that they are both view systems and, as such, they share a lot in common. To some extent the interfaces are similar, but there are some very important differences and many of them center around the coordinate systems.

HIViews are also an evolution of the classic Carbon Control Manager. It was designed to make it easier to move code from the classic Control Manager to Carbon. To simplify that transition the base HIView coordinate system is a left handed coordinate system based in the upper left corner of the view (a la QuickDraw). You can ask an NSView to use this coordinate system by default by returning TRUE from the "isFlipped" method.

Because the Quartz 2D coordinate system is arbitrarily orientable, it is possible to change the drawing environment of an HIView so that the HIPoints used in drawing are no longer based on the QuickDraw- like coordinate system. However, it is very important to realize that the coordinate systems of a view are used for more than just drawing.

Most notably, the coordinate axes are used for the positioning of subviews. When working with Carbon and HIViews, subviews are positioned using the left handed coordinate system based on the upper left corner. In contrast, the positioning of subviews in an NSView can use either left or right handed coordinates based on the isFlipped state of the view.

Another important difference between Carbon views and Cocoa views is the fact that Cocoa can scale the coordinate environment used to position subviews (i.e. you can have a bounds rect whose width or height is not the same as the frame width or height) . Cocoa will do the Right Thing™ to ensure that the subviews scale to honor the bounds.

Carbon and the HIView system do not (currently) allow you to scale the coordinate system used to position subviews, the height and width of the bounds in an HIView always match the height and width of its frame. (in Tiger anyway)



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Converting HIPoints to CGPoints/NSPoints in global space?
      • From: Dave MacLachlan <email@hidden>
References: 
 >Re: Converting HIPoints to CGPoints/NSPoints in global space? (From: Raleigh Ledet <email@hidden>)

  • Prev by Date: Re: Using zlib for i386 (or Universal) builds on PPC clients
  • Next by Date: NSAttributedString
  • Previous by thread: Re: Converting HIPoints to CGPoints/NSPoints in global space?
  • Next by thread: Re: Converting HIPoints to CGPoints/NSPoints in global space?
  • Index(es):
    • Date
    • Thread