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

C H A P T E R 3

The Dock

Designed to help combat onscreen clutter and aid in organizing work, the always-available Dock displays an icon for each open application and minimized document. It also contains icons for several common user applications, such as Mail and System Preferences, and for the Trash. The Dock provides an Aqua-compatible replacement for the Mac O 9 application menu.

Each item in the Dock has its own rectangular area called a tile. Within each tile is an icon that represents the application, document, folder, or other item in the Dock. For most purposes, you can think of the tile and icon as synonymous, even though the icon does not completely fill the tile.

When a user opens an application, its icon appears in the Dock; when a user opens a document and clicks its minimize button, the document’s icon appears in the Dock. Users can permanently add icons to the Dock and can customize where and when the Dock appears.

For more information, Carbon developers should see Dock Manager Reference, available on the Mac OS X developer documentation website.

The Dock’s Onscreen Position

When opening new windows or resizing windows, position them so that they don’t overlap with the user’s current position of the Dock. Restrict users from resizing a window so that the resize control is behind the Dock.

The Dock’s Onscreen Position

41

Apple Computer, Inc. June 2002

 

C H A P T E R 3

The Dock

If the user changes the Dock’s size or position, don’t move or resize application windows that are already open. Users should be able to change specific aspects of their environment without causing other unrequested changes.

Carbon developers can determine the Dock’s size and location using the

GetAvailableWindowPositioningBounds function, which returns a rectangle representing the available Desktop area, not including the menu bar and the space occupied by the Dock. Cocoa developers can use the frame and visibleFrame methods of the NSScreen class.

Dock Notification Behavior

With Mac OS X 10.1 and later, an open application can use its Dock tile to convey important information if needed.

When appropriate, your application’s Dock tile icon can include a small badge superimposed on the icon. In Mail, for example, when a user has unread email, the Dock icon displays a red circle indicating the number of new messages. This type of badging provides important information without being obtrusive or distracting.

Figure 3-1 An example of a badged Dock icon: The Mail application icon indicates there are unread messages

If an open and inactive application needs the user’s attention right away and calls the Notification Manager, the application icon in the Dock bounces. This type of notification should be reserved for errors or problems that the user needs to address right away. If you implement this kind of notification, you should also provide a way for the user to turn off the animation.

42Dock Notification Behavior

Apple Computer, Inc. June 2002

C H A P T E R 3

The Dock

To animate an application or document Dock tile in a Carbon application, look for functions in MacWindows.h that include DockTile. In Cocoa, use the setApplicationIcon: method of the NSApplication class or the setMiniWindowImage: method of the NSWindow class.

Dock Menus

When a user presses and holds the mouse button on your application’s tile in the Dock, a menu appears. The menu lists the application’s open windows and contains the Show In Finder and Quit commands. If the tile has not been permanently added to the Dock, the command Keep In Dock also appears.

Figure 3-2 The iTunes Dock menu

Starting with Mac OS X 10.1, an open application can customize its Dock menu by adding to the default items provided by the Dock. Potential additional items include common commands to initiate actions in your application when it is not frontmost and commands that are applicable when there is no open document window. For example, a mail application could provide commands to initiate a new

Dock Menus

43

Apple Computer, Inc. June 2002

C H A P T E R 3

The Dock

message or to check for new messages. Any command you add to the Dock menu should also be available in your application’s pull-down menus. Application-specific items appear above the standard Dock menu items.

For information on implementing Dock menus, see Inside Carbon: Customizing Your Application Dock Tile, available at the Mac OS X developer documentation website.

Clicking in the Dock

Clicking an application icon in the Dock should always result in a window—a document or another appropriate window—becoming active. In a document-based application that is not open when the user clicks the Dock icon, the application should open a new, untitled window.

While an application is open, the Dock icon has a symbol below it. When a user clicks an open application’s icon in the Dock, the application becomes active and all open unminimized windows are brought to the front; minimized document windows remain in the Dock. If there are no unminimized windows when the user clicks the Dock icon, the last minimized window should be expanded and made active. If no documents are open, the application should open a new window. (If your application is not document based, display the application’s main window.)

When the user quits the application, the icon no longer appears in the Dock (unless the user has chosen to always display it in the Dock). Users can add an application icon permanently to the Dock by choosing Keep In Dock from the Dock menu while the application is open or by dragging the item from the Finder to the Dock.

44Clicking in the Dock

Apple Computer, Inc. June 2002

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