Section 3

We can now go back and add class methods to our rotate click region hierarchy to select the correct rotate click region. Begin with the CellClickRegionOutside class.

Add the following class method.

rotateRegionForPoint: aPoint
    ^self subclasses detect: [:cls | cls containsPoint: aPoint]

We can use #containsPoint: on the rotate click region classes to select the class that is the best choice for the click location. Go to the CellClickRegionRotateClockwise class. Add the following class method.

containsPoint: aPoint
    ^aPoint y <= (CellRenderer cellExtent y // 2)

Now add similar code to the CellClickRegionRotateCounterClockwise class. Add this class method.

containsPoint: aPoint
    ^aPoint y > (CellRenderer cellExtent y // 2)

Index Page Next Page

Copyright © 2007, 2008, 2009, 2010 Stephan B Wessels      stevewessels@me.com