O'Reilly logo

Modding Mac OS X by Erica Sadun

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding a Custom Drawer

In these steps, you will add a new type of window component, a drawer, to your Terminal window. You’ll see how to connect the drawer to your existing window and update your buttons to control the drawer.

  1. In Interface Builder, select the Palette window and click on the window icon to open the Windows palette.

  2. Drag a new window/drawer combination from the palette onto the NIB window, as shown in Figure 7-27. When dropped, three new instances appear in the window: a Parent Window, an NSDrawer, and a DrawContent view. The DrawContentView design window should automatically open.

    Dragging a new window with a drawer into your nib project.

    Figure 7-27. Dragging a new window with a drawer into your nib project.

  3. Close the DrawContentView design window.

  4. In the NIB window, select the new Parent Window and delete it by choosing Edit Cut (⌘-X) or Edit Delete (press Delete). This leaves the new NSDrawer and Draw ContentView instances.

  5. Select the NSDrawer instance.

  6. In the Info window, open the Connections pane (⌘-2). After deleting the Parent Window, the NSDrawer should have just one connection: the contentView connected to the NSView. The other two outlets (delegate and parentWindow) should be unconnected.

  7. Depress and hold the Control key. With the Control key pressed, drag your cursor from the NSDrawer to the Term window instance, as shown in Figure 7-28. When a square appears around Term, release the mouse and then release the Control ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required