For the To Do application, you’ll implement a three-state button to indicate a ToDoItem’s status. The button will show, with an image, three possible states: not done (no image), done (an X), and deferred (an O). These states correspond to the possible states of a ToDoItem.
The ToDoCell class, which you will implement in this section, generates cells that behave as three-state buttons. These buttons also display the time an item is due. Here’s how you add the cell images to the project:
In Project Builder, create an Images group inside the Resources group.
Choose Add Files from the Project menu.
In the Add Images, select the file
If you want to create a self-contained project, choose the option to copy the files into the project directory.
Repeat the same steps for file
which is in the same location.
Now that you have an Images group, move
RightArrow.tiff into it.
The superclass of ToDoCell is NSButtonCell. In creating ToDoCell, you will add data and behavior to NSButtonCell and override some existing behavior. This choice prompts two questions:
Why a button cell and not the button itself?
Why this particular superclass?
NSCell defines state as an instance variable, so all cells inherit it. Cells, rather than controls, hold state information for reasons of efficiency—one control (a matrix) can manage a collection of cells, ...