Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Примеры брендбуков / apple_osx-aqua-human-interface.pdf
Скачиваний:
17
Добавлен:
16.02.2016
Размер:
8.01 Mб
Скачать

C H A P T E R 5

Windows

Minimizing and Expanding Windows

When the user clicks the minimize button or double-clicks the title bar, the window minimizes into the Dock. The window’s icon remains in the Dock until the user clicks it again or, if it is the application’s only open window, until the user clicks the application icon in the Dock. For more information, see “Clicking in the Dock” (page 44).

Windows With Changeable Panes

The content of some windows changes depending on the user’s selection. For example, when the user clicks one of the icons at the top of the Mail Preferences window, the display at the bottom of the window changes. Some windows, such as Displays in System Preferences, switch panes using a tab control (see “Tab Controls” (page 138)).

Windows with changeable panes should reopen in their previous state as long as the application is open, and return to their default views when the user quits. A tabbed preferences window, for example, should open in its previous state until the user quits the application; the next time the user opens the application, the leftmost tab in the preferences window should be active.

Special Windows

This section describes special types of windows—including drawers, utility windows, and About windows—and how each type differs from what’s described elsewhere in this chapter.

Drawers

A drawer is a child window that slides out from a parent window and that the user can open or close (show or hide) while the parent window is open. A drawer should contain frequently accessed controls that don’t need to be visible at all times. A drawer’s contents should be closely related to the contents of its parent window.

88Special Windows

Apple Computer, Inc. June 2002

C H A P T E R 5

Windows

Built-in support for drawers is available to Cocoa developers via the NSDrawer class. Carbon developers can create a drawer using the CreateNewWindow function with the kDrawerWindowClass constant, and associate it with its parent window using SetDrawerParent. The Carbon Window Manager also provides other drawer-related functions. In both Carbon and Cocoa, a drawer automatically inherits the textured appearance if its parent window is textured (see “Textured Windows” (page 72).

Figure 5-14 An open drawer next to its parent window

When to Use Drawers

Use drawers only for controls that need to be accessed fairly frequently but that don’t need to be visible all the time. (Contrast this criterion with a utility window, which should be visible and available whenever its main window is in the top layer.) Some examples of uses of drawers include access to favorites lists, the Mailbox drawer (in the Mail application), or browser bookmarks.

Although a drawer is somewhat similar to a sheet in that it attaches to a window and slides out, the two elements are not interchangeable. Sheets are primarily intended to replace modal dialogs, as described in “When to Use Sheets” (page 98), whereas drawers provide additional functionality. When a sheet is open, it is the focus of the window and it obscures the window contents; when a drawer is open, the entire parent window is still visible and accessible.

Special Windows

89

Apple Computer, Inc. June 2002

C H A P T E R 5

Windows

Drawer Behavior

The user shows or hides a drawer, typically by pressing a button or choosing a command. If a drawer contains a valid drop target, you may also wish to have the drawer open when the user drags an appropriate object to where the drawer appears.

When a drawer opens or closes, it appears to be sliding from behind its parent window, to the left, right, or down. You should ensure that a parent window’s default position allows its drawer to open fully without disappearing offscreen. If a user moves a parent window to the edge of the screen and then opens a drawer, it should open on the side of the window that has room. If the user makes a window so big that there’s no room on either side, the drawer opens off the screen.

To support the illusion that a closed drawer is hidden behind its parent window, an open drawer should be smaller than its parent window. When the parent window is resized vertically, an open drawer resizes if necessary to ensure that it does not exceed the height of the parent window. (A drawer can be shorter than its parent window.) The illusion is further reinforced by the fact that the inner border of a drawer is hidden by the parent window and that the parent window’s shadow is seen on the drawer when appropriate.

The user can resize an open drawer by dragging its outside border. The degree to which a drawer can be resized is determined by the content of the drawer. If the user resizes a drawer to the point where content is significantly obscured, the drawer should simply close. For example, if a drawer contains a scrolling list, the user should be able to resize the drawer to cover up the edge of the list. But if the user makes the drawer so small that the items in the list are difficult to identify, the drawer should close. If the user sets a new size (if that is possible) for a drawer, the new size should be used the next time the drawer is opened.

A drawer should maintain its state (open or closed) when its parent window becomes inactive, or when the window is closed and then reopened. When a parent window with an open drawer is minimized, the drawer should close; the drawer should reopen when the window is made active again.

A drawer can contain any control that is appropriate to its intended use. Follow normal layout guidelines, as stated in “Positioning Controls in Dialogs and Windows” (page 149).

90Special Windows

Apple Computer, Inc. June 2002

Соседние файлы в папке Примеры брендбуков