Section 3

Push Cells With The Mouse

We get to tie a lot of these pieces together. There's logic that knows how to handle pushing cells and there's hints that show the user when a click could push a cell. It's time to make it happen.

You may remember that we put a "hook" in the CellClickRegionInside class to get us started. Here's the existing #mouseUpWithinCellAtPoint:cell:withinGrid: class method.

Change the method to now send the correct message down to the push region.

All we need to do is write the mouse-up handlers for the four push direction classes. Here's the push north class method.

The other three push directions are similar. Here's the new class method for the CellClickRegionPushEast class.

mouseUpForCell: aCell withinGrid: aGrid
    aGrid pushCellEastFromLocation: aCell gridLocation

The CellClickRegionPushSouth class.

mouseUpForCell: aCell withinGrid: aGrid
    aGrid pushCellSouthFromLocation: aCell gridLocation

The CellClickRegionPushWest class.

mouseUpForCell: aCell withinGrid: aGrid
    aGrid pushCellWestFromLocation: aCell gridLocation

Index Page Next Page

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