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

C H A P T E R 1 5

Files

Handling Plug-ins

Third-party plug-ins needn’t deter you from providing a drag-installable bundle; the Finder in Mac OS X (version 10.2 and later) provides built-in support for managing plug-ins within your application’s bundle. A Plug-ins pane added to your application’s Info window in the Finder provides a user interface for adding and removing these files, as well as turning them on and off.

If your application supports plug-ins, use this feature instead of creating your own plug-in management method. Create a folder for them in your application bundle (<AppName>.app/Contents/Plugins); each item in this folder appears in the Plug-ins pane. You may want to provide user documentation explaining how to use this feature.

Naming Files and Showing Filename Extensions

Mac OS X 10.1 introduced a new model for handling filename extensions. Your application should follow the guidelines described in this section.

Any file that has a specific format can have a filename extension indicating that format. When a user copies a file to a computer that uses another operating system, the filename extension gives the system the information it needs to handle the file correctly.

Users, however, don’t need to be aware of a filename’s extension. Filename extensions are hidden by default, but users can choose to display a document’s filename extension by deselecting the “Hide extension” checkbox in the expanded Save dialog, and can choose to show all filename extensions in Finder Preferences. Your application should always display filenames that respect the user’s preference.

Handling Plug-ins

249

Apple Computer, Inc. June 2002

C H A P T E R 1 5

Files

Applications that already write out filename extensions for interoperability purposes now provide an enhanced user experience; these filename extensions can be hidden in Mac OS X but automatically get transferred with the file as it moves to a non-HFS file system. For example, when a user uploads a website containing HTML and movie files, because the movie files already have filename extensions, they don’t need to be renamed, and links in associated Web pages function properly.

To preserve the “what you see is what you typed” user experience, while supporting robust interoperability by using filename extensions to indicate file format, applications have several responsibilities. Apple recommends that applications adopt the following behavior:

All document files should have an extension indicating the file’s format.

Any user-visible filename—in a list, an Info window, or any other situation— should always use the file’s display name. Mac OS X 10.1 and later includes a function to get the display name.

When saving files, users should be able to control whether filename extensions are hidden. For more information, see “Saving, Closing, and Quitting Behavior” (page 105).

Applications should save newly created document files with a filename extension, for easy exchange with other operating systems and other users over the Internet. This filename extension can be hidden, as described above.

When opening and saving a document file, applications should preserve the value of the document filename extension hidden flag and should preserve the existing filename extension unless the user creates a new document file by choosing Save As.

When saving a document file without an extension as a new file in a Save As operation, applications should add an extension, as they would when creating a new document file.

Important

Don’t provide your own options for handling filename extensions; use the standard Open and Save dialogs. The behaviors described above happen automatically for Cocoa developers using NSDocument. Carbon developers should set a new flag, PreserveSaveFileExtension, when calling the Save dialog, and use NavCompleteSav to set the flag to hide the filename extension.

250Naming Files and Showing Filename Extensions

Apple Computer, Inc. June 2002

C H A P T E R 1 5

Files

Displaying Pathnames

Some dialogs, such as Save and Open, provide a text field in which expert users can type file-system paths to navigate in the dialog. The slash symbol (/) is used as the path separator.

Avoid displaying pathnames in your application (in document titles, for example). If it’s necessary to display a pathname, avoid truncating it.

Displaying Pathnames

251

Apple Computer, Inc. June 2002

C H A P T E R 1 5

Files

252Displaying Pathnames

Apple Computer, Inc. June 2002

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