Section 3

We can begin by defining some constants on the CellRenderer. This is where we already defined the extent of the cells. Create a new protocol on the class side named "constants" and move the #cellExtent class method to that protocol. Here are some new class methods to provide more constants.


Construct a new class hierarchy for click regions. We can create a common superclass, like we did for the renderer and direction classes.

With a class method we can pass a Point to the superclass and it will answer the click-region object. By providing an ignore region class we cover all three situations. For the moment the method doesn't answer anything.

We can construct some unit tests to see which click region is answered for various points inside the cell. Writing the code this way will force us to have tests that show the behavior we want and then make the classes implement that behavior.

Here's our first test. Add a subclass of TestCase as CellClickRegionTestCase.

Of course we do not expect this to work just yet.

Index Page Next Page

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