Chapter 13. Common Desktop Environment Guidelines

The Common Desktop Environment (CDE) is a graphical user interface for UNIX™ in its variants (AIX, Digital UNIX, HP/UX, Solaris, UnixWare, and so on). CDE brings unparalleled ease of use to UNIX and is being adopted as a standard operating environment by many companies in the UNIX workstation market.

Advantages of a Common User Interface

The CDE interface provides many advantages to both end users and application developers. Among these advantages are:

  • An easy-to-use interface, which enables the user to learn the system quickly and to use it efficiently.

  • Consistency between UNIX platforms, which enables the user to move from one computer to another easily. It also enables programmers to write a single application that can be compiled for each platform, significantly reducing development effort.

  • Similar consistency with the Microsoft Windows and IBM OS/2 environments, which enables the user to move easily between these environments and CDE.

  • Several built-in productivity applications, which enable the desktop user to be productive before buying application software.

  • Desktop specifications that have been submitted to the X/Open standards organization, ensuring that CDE is ‘open’ and will not tie the user to proprietary solutions.

Relationship of CDE to Motif

The CDE user interface follows the Motif guidelines presented in this book. Motif, however, does not define a desktop, only the basic behaviors for applications and widgets. This chapter defines the guidelines that allow an application to integrate well with the desktop. Thus, to write a desktop-conforming application, you should follow the guidelines in this chapter as well as the previous chapters.

The guidelines in the following sections are specific to CDE and may not necessarily apply to a Motif interface or a Motif application running under another window manager (for example mwm or twm). The sections include information on:

  • Visual design

  • Application design guidelines

  • Window and session control

  • Application messages

  • Drag and drop

CDE Visual Design

CDE is a visually rich environment. This section provides information on designing icons and other visuals consistent with the desktop style. It discusses some of the design philosophy behind the desktop and contains useful hints to help you successfully create icons for the desktop environment.

In most graphical user interfaces (GUIs), color is applied in a localized and specific manner, either in individual icons or specific control areas, such as window borders or title bars. In many other GUIs, color is pervasive, as virtually everything is drawn with colors, with a notable absence of black lines.

Most CDE icons are not color intensive, using grays instead. This keeps the number of colors on the desktop palette to a minimum and works well visually. Because the icons, being largely colorless, always appear in the context of colored backgrounds, they stand out more.

Using Icons in CDE

An icon in CDE is a specific graphical element that the user can move, copy, delete, or open. The following CDE applications use icons as a fundamental method for user interaction. (For information on the available applications that CDE includes, see the CDE User's Guide).

File Manager Icons

File Manager is the tool that provides for the presentation and organization of the user's file structure. The basic types of iconic objects displayed in File Manager are files, directories (folders), executables, and actions. These objects are referred to as documents, folders, and applications. File Manager displays the icons in two sizes, called Icon and Small Icon views in the Set View Properties dialog box. Icon is 32x32 pixels and Small Icon is 16x16 pixels. Figure 13-1 shows both icon sizes.

Figure 13-1. File Manager Icons at Sizes 32x32 and 16x16

Documents, folders, and applications are represented by three different shapes. Documents are vertical rectangles meant to look like pieces of paper. Folders are horizontal rectangles with a tab to look like a file folder. Applications can be any shape and use the entire icon square. All objects in File Manager should indicate to the user that they can be manipulated, that is, dragged and dropped.

Application Manager Group Icons

The Application Manager is similar to File Manager, but its focus is on holding applications rather than documents. All network-accessible applications in the desktop are placed here in containers, called application groups (rather than folders).

Application Manager is like a “network store.” This is the place where the user goes to find the latest applications available on the system. Figure 13-2 shows an example of the Application Manager's group icons.

Figure 13-2. Application Manager Group Icons

Application group icons are like folders in that they represent a collection of objects, in this case related objects. If your application requires support files or includes sample files, you can design your own application group icon that represents where a user can get the related files for your application.

Front Panel and Subpanel Icons

The Front Panel is the control panel for the desktop and usually appears at the bottom of the screen. Front Panel icons provide quick access to the user's most commonly used applications.

The Front Panel also has subpanels of icons that the user can access with the arrow buttons on the Front Panel. The subpanel is an extension of the Front Panel icon. For example, Figure 13-3 shows the Personal Applications subpanel open. The user can add applications to this subpanel by dropping them on the Install drop site. The user can choose to promote icons in the subpanel to the Front Panel via the pop-up menu.

Figure 13-3. Front Panel and Subpanel Icons


Minimized Window Icons

Minimized window icons appear on the desktop when a window is minimized. The icon should represent the application that controls the minimized window, as shown in Figure 13-4. These icons are different from the icons used in the Front Panel in that they represent running applications, although they are the same size.

Figure 13-4. Minimized Window Icons


Other Graphic Elements

Other graphic elements include button graphics, tool bar graphics, and graphics used as labels. A tool palette in a paint program is an example; a document orientation button (landscape or portrait) in a printer dialog box is another. These are graphics that you create for use in your application and that are not used elsewhere. Figure 13-5 is an example of some other graphic elements (tool bar graphics).

Figure 13-5. Other Graphics


Using Color in CDE Icons

When designing icons for a CDE application, you must be aware of the available color palette and the dynamic mapping of colors.

Icon Color Palette

CDE icons use a palette of 22 colors:

  • Eight static grays

  • Eight static colors (white, black, red, blue, green, cyan, magenta, and yellow )

  • Five dynamic colors for the Foreground, Background, TopShadow, BottomShadow, and Select areas

  • A transparent “color” that allows the background to show through

These colors are the default colors in the Icon Editor, which is the recommended tool for creating desktop icons. Figure 13-6 shows the Icon Editor and its color palette. This limited palette was chosen to maximize the attractiveness and readability of icons without using an unnecessary number of colors.

If you use more than the 22 icon colors, then your icons may experience color-flashing effects that can make the icon unreadable. The best way to ensure predictability of appearance of your icons is to use only the 22 colors in the desktop palette.

Figure 13-6. Icon Editor Color Palette


Role of Dynamic Colors

It is important to understand the limited role of the dynamic colors. These represent the colors used to display the user interface elements on which your icon appears. If your icon appears in File Manager, File Manager determines what the background color is. If the user changes the color palette in Style Manager, the colors in the user interface change to match, and the background color on which the icons are displayed changes.

In general, dynamic colors have little use in most icons. There are two ways they are used:

  • If your icon does not fill the entire bounding box, then fill the unused area with the transparent color.

  • You can draw a shadow under your icon. This is recommended only for Front Panel icons. Do not use this for File Manager icons. Figure 13-7 shows dynamic color shadows.

Figure 13-7. Dynamic Color Shadows


Understanding CDE Design Philosophy and Helpful Hints

The philosophy behind the graphic language of the desktop is that users benefit if the computer world parallels the real world. This extends from the three-dimensional appearance of windows and controls, such as push buttons and menu bars, to the general appearance of icons.

Designing with Color

Design your icon primarily to use the eight static grays; use the eight static colors mostly as accents. The eight static colors are strong and can easily be overused. The static grays allow icons to blend gracefully with the already colorful desktop environment. You can dither the static colors with the static grays to tone the colors down for coverage of larger areas. You can also use the grays to smooth the edges of icons. This is sometimes referred to as “anti-aliasing.”

Do not use dynamic colors in File Manager icons because the appearance of the icon will change when the user changes color palettes. Such a change could be inappropriate as well as unpredictable.

Using Different Icon Styles

Icons have various graphical styles. The most basic icon consists of a simple black outline. However, as color is added, the style resembles that of a coloring book, with color added within the black lines. This is most effective when done on white backgrounds.

CDE, with its pervasive use of colored and medium-value backgrounds, uses both lighter and darker shades to create fairly realistic images. You are encouraged to explore this style.

Another element of style is the point of view taken in portraying the object. CDE uses a head-on view, as shown in Figure 13-8, usually from slightly above if the object in question is a three-dimensional one, such as a printer. You should use a treatment that gives the icon a slight dimensional quality, as this reinforces the perception that the icon can be dragged and dropped.

Figure 13-8. Examples of Three-Dimensional Icons in CDE


Designing An Application Icon

The application icon is the most important icon you will design. This is the place for your product identity, as well as a clear indication to the user of what your application does. The application icon is what the user opens to run your application.

There are no shape conventions for application icons. They can fill the entire icon bounding box or they can be irregular in shape. It is recommended that your icon appear three-dimensional. Figure 13-9 shows some CDE icons. You can use these icons as templates when designing your own icons.

Figure 13-9. Application Icons That CDE Uses


Designing An Application Group Icon

The application group icon represents the container in which the user finds your application, as well as any other files you may choose to include, such as information or sample files. Design the icon in such a way that the user knows it is a container, such as a folder or box.

The concept that Application Manager uses is that of an icon based on accordion-style folders. This icon is large enough that you can stamp images on the front of it to indicate to the user what kinds of items are inside. Figure 13-10 is an example of application group icons.

Figure 13-10. Application Group Icons


Designing Document Icons

A document icon should help the user understand what kind of data is stored in that document icon and what application is associated with the document. Figure 13-11 shows a number of CDE document icons that you can use as templates when designing your own document icons.

Applications that support multiple file formats need different document icons for the different output formats. Rather than creating a distinctively different graphic for each format, you might use the same graphic for the basic file and add a tag to, or a small label in, the icon to delineate the format.

In the case of the document icon, the basic rectangle of the document is left-aligned in the icon square. If you use the tag approach, place the tag on the right side of the icon, half on and half off the basic icon, but not obliterating the descriptive graphic, as shown in Figure 13-11.

Figure 13-11. Document Icons


Understanding the Differences Among Platforms

The desktop is different from the application spaces you may be familiar with in the following ways:

  • The desktop requires a 48x48 pixel size to accommodate higher resolution displays.

  • The desktop has a different color space for icons. You may be able to reuse icons from other environments but if they have color in them, chances are some of the colors will need to be changed to map onto the desktop palette. The basic design should still work. See Table 13-1 for information on translating colors.

  • Perhaps the most significant difference is that, in most cases, desktop icons appear against a background color other than white. This can make your icon appear unreadable if you simply copy it from another environment. You should test any icons from other environments before using them on the desktop.

Table 13-1. RGB Values for Common Desktop Environment Icon Colors

ColorRGB Values DecimalRGB Values HexGraysRGB Values DecimalRGB Values Hex
Black0,0,0#00Gray1222,222,222#de
White255,255,255#ffGray2189,189,189#bd
Red255,0,0#ff0000Gray3173,173,173#ad
Green0,255,0#00ff00Gray4148,148,148#94
Blue0,0,255#0000ffGray5115,115,115#73
Yellow255,255,0#ffff00Gray699,99,99#63
Cyan0,255,255#00ffffGray766,66,66#42
Magenta255,0,255#ff00ffGray833,33,33#33

Implementing Required Icons

This section discusses the details you need to know to create icons that display correctly in CDE, such as formats, resolutions, sizes, naming, and so on.

Icon Formats

CDE runs in both color and monochrome modes, so you must create your icons in two formats: XBM (X bitmap) for monochrome and XPM (X pixmap) for color. The Icon Editor saves icon files to both formats.

On the desktop, buttons and palettes can use either the XBM or XPM formats. You should use the XPM format wherever possible for your button, palette, and tool bar graphics.

The XBM file format has only two colors: foreground and background. On the desktop, the foreground color is not fixed, but varies according to the background color. A color scheme with a dark gray background might cause any text or graphics to appear white. However, a color scheme with a light gray background will cause text and graphics to appear black.

Inverting the foreground color may have a strange effect on certain icons. For something simple, like an arrow shape, there is no adverse consequence. But for other images, the negative version created by inverting the foreground color might be illegible and, therefore, unusable. Figure 13-12 shows the consequences of reversing the foreground color in monochrome mode.

Figure 13-12. Monochrome (XBM) Bitmaps with Foreground Reversal Consequences


Display Resolution

CDE accommodates three display resolutions: low resolution (640x480 pixels), medium resolution (800x600 pixels), and high resolution (mega-pixel). The size of the Front Panel and some of the icons change automatically, depending on the display resolution. For this reason, your application must provide different icon sizes.

Icon Sizes

CDE has three icon sizes: 16x16, 32x32, and 48x48, referred to as 16, 32, and 48. (They have suffixes of .t, .m, and .l, respectively.) If your application comes from the PC domain, then the size 16 and 32 icons are familiar sizes. Table 13-2 defines where each size is used.

Table 13-2. Icon Sizes and Usage

ComponentLow ResolutionMedium ResolutionHigh Resolution
File Manager32,1632,1632,16
Application Manager32,1632,1632,16
Front Panel324848
Subpanels163232
Front Panel Controls161616
Minimized Window324848

Table 13-3 lists the icons you need to create for an application. A total of 16 icon files are needed, assuming one of each type and size. Figure 13-13 shows an example set of icons.

Table 13-3. Minimum Required Icon Set

Type of Icon16 Color32 Color48 ColorMono. 16Mono. 32Mono. 48
Application icon XXXXXX
Document or file iconXX XX 
Application container iconXX XX 
Minimized windows  X  X

Figure 13-13. Minimum Required Set of Icons for Mailer


Icon Naming Conventions

The basic name for the icon must be no more than seven characters. The size and color suffixes are appended to the name, as shown in Table 13-4.

Table 13-4. Icon Naming Conventions

SizeCOLORB&WB&W Mask
48Iconame.l.pmIconame.l.bmIconame.l_m.bm
32Iconame.m.pmIconame.m.bmIconame.m_m.bm
24Iconame.s.pmIconame.s.bmIconame.s_m.bm
16Iconame.t.pmIconame.t.bmIconame.t_m.bm

The suffix .pm is for the XPM format. The suffix .bm is for the XBM format. The suffix _m refers to the mask for the black-and-white icon.

You do not have to provide icons in all these configurations. Table 13-3 lists the required icons. For example, the .s icons are typically used for tool bars, which your application may not have.

Icon Alignment

Depending on the graphic you use for your icon, the bits may not take up the entire space allocated for the icon. The recommended rules for where the empty space goes in a desktop icon are:

  • For 16x16 and 32x32 icons, which are left-aligned, any empty bits are on the right side of the bounding box.

  • For 48x48 icons, which are centered in the bounding box, any empty bits surround the centered image.

Figure 13-14 is an example of a left-aligned 32x32 icon with a tag.

Figure 13-14. Left-Aligned 32x32 Icon with Tag


Optional Icon Sizes

There is no size 48 requirement for the document or application group icons because neither are expected to be used for a minimized window icon (you use the tool's icon instead) or in the Front Panel. A user might, however, promote one of these icons to the Front Panel.

Optional Front Panel Icon Style

The icons that appear by default in the Front Panel have a slightly different appearance from File Manager icons. These icons cannot be dragged and dropped and are thus given a more permanent look by appearing to be etched into the surface.

You do not have to provide size 48 icons with an etched appearance. Since you cannot determine if and when your icons will be used in the Front Panel, you should not design specifically for this usage; instead, design for File Manager usage, which is more common.

CDE Application Design Guidelines

Your application should present its components to the user in a logical and task-oriented manner. Menus should follow a common organization and naming convention to enable users to use the same rules and practices across the desktop. The following sections outline CDE application design and menu structure requirements.

General Guidelines

Consider the following guidelines when designing a CDE application:

  • There should always be exactly one control within any window of your application that has the input focus if the window in which it resides has the input focus.

    If any window within your application has focus, some control within that window must have focus. The user should not have to explicitly set focus to a control within the window.

  • When a text field within your application does not have input focus, do not display the text cursor within that field.

    Although use of inactive text cursors is allowed within Motif, it is better to hide the text cursor when removing focus rather than display the inactive text cursor. This makes it easier for the user to quickly scan the screen or window to determine which text field currently has focus.

  • Your application should provide keyboard mnemonics for all buttons, menus, and menu items displayed within the application.

    Once the user becomes adept at using your application, keyboard mnemonics are a quick way to access functionality. Mnemonics also facilitate access to functionality from within keyboard-centric applications or windows. The user need not frequently switch between using the mouse and keyboard. Mnemonics should be provided pervasively throughout the user interface.

  • Your application should provide shortcut keys (accelerators) for those functions that you expect the user to use frequently.

    Shortcut keys provide the user who has become expert at using your application a quick way to access application functionality without going through menus and dialog boxes.

  • If your application does not use the values of global environment settings, such as multiclick timeout intervals, drag thresholds, window color settings, mouse left- or right-handedness, and so on, but instead uses its own values for these settings, then your application should provide one or more Options dialog boxes that allow the user to change the values for these settings.

    In general, you should not override the value of settings treated as global environment settings. The user controls these settings through the CDE Style Manager. If you choose to ignore these settings and specify your own settings, then your application will be inconsistent with other applications in CDE. If you nevertheless choose to provide your own values, then you must provide the user with a way to make your settings consistent with the rest of the desktop.

Tool Bars

Tool bars provide quick access to already user-accessible functions. Some common usages of tool bars include navigation, changing data views, accessing frequently used tools or editors, simplifying the number of steps to complete a common operation, and providing a fast path to frequently used menu items. Figure 13-15 is an example of a tool bar on the CDE Calendar.

Figure 13-15. Tool Bar on the CDE Calendar


Tool Bar Design Issues

When designing your application and an associated tool bar, consider the following guidelines:

  • Use tool bars only when they improve or enhance user access to common operations, such as in an application with several large menus.

  • Present a natural organization of actions on the tool bar. Grouping items that are dissimilar can confuse the user if the item they are looking for is not in the proper context.

  • Do not place too many items in the tool bar. The user should be able to find and use an item quickly. Keep the number of buttons to a minimum so that you do not increase the difficulty of using a tool bar.

  • Do not use cryptic icons as they can confuse the user. Keep the pixmaps as simple as possible. Remember that all graphics must be international in scope. When designing a graphic to represent a command, such as Save, remember that the icon has to represent a verb, as opposed to a noun, like most other icons.

Tool Bar Components

You typically use the following Motif components when constructing a tool bar:

Tool bar container 

The tool bar uses a container component to provide a layout mechanism for the drawn buttons that make up a tool bar. You may choose most any container for the tool bar, as long as it allows for the specified behavior. The tool bar container is placed directly under the menu bar and should be the same width as the window, as well as similar height to the menu bar.

Tool bar button 

The Motif widget DrawnButton provides an appropriate medium for the graphic buttons in tool bars.

Pixmap 

The pixmap for the drawn button is the graphic that conveys the functionality to be expected by pushing a particular button.

CDE Window and Session Control

Your application is presented to the user as a series of windows. Some of these windows present the main portion of the application. Others are dynamic, appearing to the user only when needed to accomplish certain tasks. All of these windows should contain menus, border decorations, and behavior styles appropriate to their function. The following sections describe the guidelines for designing your application's windows.

Window Control Guidelines

The fundamental user-visible characteristic of primary windows is that stacking, workspace placement, and minimization can be independent of other primary windows. Secondary window stacking, workspace placement, and minimization must be tied to the associated primary window.

Window Management Choices

You should provide the Close, Move, Lower, and Minimize choices as the minimum set of capabilities in primary windows. Provide Resize and Maximize choices as appropriate. Design your secondary windows so that resizing and maximizing are neither necessary nor appropriate. Most secondary windows should include only the Close, Move, and Lower choices. In extraordinary cases, you may provide the Resize and Maximize choices in a secondary window. Do not provide the Minimize choice in secondary windows (they are minimized with the associated primary window).

Windows that have a Close or Exit choice need to support the window management protocol for Close if there is a window menu. In the case of dialog boxes, the Close item on the window menu corresponds to the Cancel choice or dialog box dismissal with no further action taken.

Workspace Management Guidelines

CDE applications appear in one of several work areas called workspaces. A user may have several workspaces active on the desktop. Your application should behave in certain ways in relation to those workspaces.

For example, a spreadsheet application may have one or more secondary windows open that allow the user to change the properties of data cells in the main window. If the user moves the main window to a different workspace, the secondary properties windows should move with it.

On the other hand, a word processor may have several windows open, where each is used to edit a different document. In this case, when a user moves one of the windows to a different workspace, the other windows should remain where they are.

Session Management Support

When you design a desktop application, consider the following guidelines for session management:

  • Applications should support Interclient Communications Conventions Manual (ICCCM) mechanisms for session management of their primary windows and key properties.

    The ICCCM defines important relationships and behaviors between applications and the window manager, including protocols for saving and restoring application states across invocations.

  • Applications should support ICCCM mechanisms for session management of all associated windows (that is, secondary windows that may include help windows).

    Associated windows include multiple primary windows and secondary windows, such as online help windows.

  • Applications should accept messages from the CDE Session Manager that inform them the user is logging out and should save their state at that time.

CDE Application Messages

From time to time, an application needs to present feedback to keep the user informed about the progress of ongoing activities and to alert the user to situations that require intervention. The CDE Motif interface provides many ways to provide such feedback to the user. This section describes the use of error messages, informational messages, and other message dialog boxes.

Error Messages

Use error messages when it is crucial to bring the information to the user's attention because the intended action cannot be carried out without user intervention. Use a Motif error dialog box to present application error messages. Keep in mind the basic three-part structure for error messages. Each error message should tell the user:

  • What happened

  • Why it happened

  • What should be done to correct the problem

Figure 13-16 is an example of an error dialog box.

It is appropriate to assume that the user knows basic desktop terms, such as files or programs. However, avoid terminology that is typically understood only by an expert or frequent computer user unless the application is specifically targeted at computer professionals.

In many cases, the only user response to an error dialog box is to click the OK button to dismiss the dialog box. However, you should be able to offer resolutions to the problem. If you have buttons for user actions, be sure to also include a Cancel button.

Figure 13-16. Error Dialog Box


Informational Messages

Use informational messages in the window footer to present progress, status, or helpful information to the user. Do not use informational messages to present crucial information because informational messages are deliberately designed to be nonobtrusive and many users may not notice them.

Motif provides a message area at the bottom of the main window, but this is rather clumsy and ugly. A more elegant approach is to provide a wider margin below the data area of the main window where status information can be unobtrusively displayed, as shown in Figure 13-17. For other examples of using informational messages, see the status message area in the CDE Mailer.

Figure 13-17. Informational Message in the Lower Margin of a Window

The text "Loading earth.gif..." is displayed at the start of the load and the text "Done" is added when the load has completed. The entire message is removed 5 seconds later.

Informational messages in the footer area should be left-justified and displayed in a light font in keeping with their unobtrusive nature. Note that the margin where informational messages are displayed should not accept mouse focus. Progress messages in the footer area are normally displayed only while the operation is in progress. Remove notices and other information that is no longer valid within a few seconds to avoid confusion about whether the information is current.

Other Message Dialogs

CDE supports the following dialog boxes:

Information dialog box 

Used to display status, completion of activity, or other informative types of messages to which the user need not necessarily respond other than to acknowledge having read the message.

Question dialog box 

Used to ask questions of the user. The question should be clearly worded to indicate what a yes or no response means. The buttons displayed are Yes, No, and Help. Help provides additional information as to what the application will do in response to a Yes or No choice. When possible, you should replace the label for the Yes and No buttons to make it clear what action will be performed as a result of choosing either operation. For example, when a file is not yet saved but the user chooses to close it, Save, Discard, Cancel, and Help would be more appropriate choices than Yes or No in a question dialog box.

Warning dialog box 

Used to communicate the consequences of an action requested by the user that may result in a loss of data or other undesirable event. The dialog box is presented before the action is performed and offers the user the opportunity to cancel the requested operation. The buttons typically displayed are Yes, No, and Help — or Continue, Cancel, and Help.

Working dialog box 

Used to display in-progress information to the user when this information is not displayed in the footer of your application's window. The dialog box contains a Stop button that allows the user to terminate the activity. When pressed, the operation is terminated at the next appropriate breakpoint, and a confirmation might be displayed asking whether the user really wants to stop the activity.

Drag and Drop

This section discusses the drag-and-drop operation and provides CDE guidelines for incorporating drag and drop into your CDE application.

You should be familiar with the description of Motif drag and drop. For more information, see Chapter 7, “Data Transfer”. Where differences occur, this section supersedes Chapter 7, “Data Transfer” when developing applications for CDE.

Mouse-Based Selection

CDE has incorporated two changes to mouse-based selection that is significantly different than in Motif. The first is that the user may elect to have either adjust or transfer capability on the middle mouse button. In addition, CDE integrates drag and select on the first mouse button.

On a 3-button mouse, MB2 is typically used as the TRANSFER (or SELECT) button. However, in CDE the user may change an environment setting to indicate that MB2 should be used as the ADJUST button. The ADJUST button can be used to toggle the selection state of elements under the multiple selection model.

Drag-And-Drop User Model

In CDE the user can select and drag icons in File Manager, mail messages and attachments in Mailer, appointments in Calendar, and text from text editors or text fields. The user can drop items onto any drop zone that accepts them. For example, a document icon from File Manager can be dropped onto a folder icon in File Manager, onto the Print Manager icon in the Front Panel, or onto the attachment list in Mailer.

Parts of a Drag Icon

The drag icon consists of three parts:

  • State indicator

  • Operation indicator

  • Source indicator

Figure 13-18 shows these parts.

Figure 13-18. Parts of a Drag Icon


State Indicator

The state indicator is a positioning pointer combined with a valid or invalid drop zone indicator. The valid state indicator should resemble an arrow pointer with a hot spot so the user can position the cursor in a predictable manner. The invalid state indicator, a cannot pointer, appears when the user is over an invalid drop zone. Figure 13-19 shows an example of an invalid state indicator.

Figure 13-19. Invalid State Indicator


Operation Indicator

The operation indicator gives the user feedback on what operation is occurring during the drag. Figure 13-20 shows the copy and link feedback. Because most drags are move operations, an operation indicator is added to the drag icon only for copy or link operations.

Figure 13-20. Operation Indicator


Source Indicator

The source indicator is a representation of the selection (or the item being dragged). It comes in several versions, depending upon whether the selection represents single or multiple items and what kind of item the selection represents. Figure 13-21 shows examples of source indicator drag icons.

Figure 13-21. Source Indicator

The hot spot for text drag icons is located on the top left corner (1,1). The hot spot for single and multiple drag icons is located at the top left pixel of the invalid icon (3,3). CDE has tuned each drag icon to increase user accuracy at targeting and positioning.

Drag Icon Graphic

You are responsible for supplying a graphic to be used in the drag icon in your application. This graphic is usually one of the icons already supplied with the application, such as the 32x32 icons that File Manager uses to represent documents. The graphic used depends on what is being dragged.

In cases where the user does not select an icon to start a drag, it is still appropriate to show a relevant graphic in the drag icon, especially if that graphic will be used by the destination application upon the drop. For example, in Calendar Appointment Editor, the user can select an appointment from the scrolling list, which does not show icons. An appointment icon is used as part of the drag icon. If the appointment were dropped on File Manager, File Manager would display the appointment, using the same graphic.

In CDE three operations are associated with the drag icon. These operations are explained in “Parts of a Drag Icon”. The drag icon has alternate graphics that indicate to the user when the operation is a copy or link. The default operation, move, requires no alternate icon graphics.

Success or Failure of a Drag-and-Drop Operation

The user needs an indication that the drag-and-drop operation either succeeded or failed. You should use transition effects to indicate the success or failure of the drop. There are two kinds of transition effects: melt and snap back.

Use the melt effect when the user drops a drag icon on a valid drop zone. The effect looks like the drag icon melts into the drop zone. The drag icon disappears and is replaced by whatever is appropriate for the destination application. Dropping a drag icon on the Print Manager control in the Front Panel may show nothing other than the melt effect. Dropping a drag icon on the File Manager control would show the melt effect followed by the icon appearing in File Manager.

Use the snap back effect when the drop fails. Drops can fail for two reasons: because the drop zone is invalid or because the data transfer fails. If the user drops a drag icon over an invalid drop zone, one that shows the cannot pointer drag icon, then the drag icon snaps back to the source application.

Once a drop occurs, the source and destination applications have to transfer the data. If the data transfer fails, the destination application should do the following:

  • Indicate to the API that the drop failed so that the dropped item will get snapped back to the source application

  • Display an error notice that clearly indicates why the drop failed and what, if anything, the user can do to correct the situation

Sometimes the transition effect does not take place immediately. The icon appears where it is placed until the transfer is done. During this time, your application should set the cursor to the busy state. The user cannot move or select the icon until the transfer is complete; the busy cursor tells the user the transfer is in process.

Drag-and-Drop Mechanics

You should understand the following areas of the CDE underlying application architecture when designing a drag-and-drop operation:

  • What type of object is being dragged

  • What action takes place when the object is dropped

  • How to match operations between source and destination applications

Types of Objects

There are three types of draggable objects in CDE:

  • Files

  • Buffers

  • Text selections

Each application has its own objects that can be dragged and dropped. For example, Calendar uses appointments, Mailer uses mail messages, and File Manager uses folders and files.

The folder and file icons in File Manager exist as separate entities in the underlying file system and are, therefore, treated as files when dragged and dropped. However, Calendar appointments and Mailer messages do not exist as separate entities in the file system. When a user drags these objects they are treated as buffers.

Text selections fall into a different category because selecting a piece of text is different than selecting an icon. The user selects a range of text in a document window; the text does not represent the whole document — only a piece of a document. Rarely does a user see the piece of text as a distinct object and the user does not expect a piece of text to behave like an icon when dropped. For this reason, the drag-and-drop model for text mirrors the cut, copy, and paste operations available from the Edit menu.

Actions That Occur When Objects Are Dropped

There are two actions that can occur when an object is dropped: insert or load.

The insert action inserts the dropped object into the destination, adding it to the current data in the application or document. The object is inserted when a user schedules an appointment, prints a document, attaches a document, pastes text, or appends a mail message. Such an action is a move or copy operation, depending on the destination and the user. The user might decide to copy a piece of selected text as opposed to moving it. The drag icon should indicate whether the operation is a copy or move.

The load action operates the same as if the user had chosen Open from the File menu, selected a file, and clicked the Open button. The dropped object gets loaded into the application. The user can edit it and save changes back to the original file. Load works only with files at this time, not with buffers or text. The user should see the copy drag icon when dragging an object over a drop zone that supports the load action.

Load works with buffers; however, buffers are loaded as read-only.

Matching Drag-and-Drop Operations

When designing drag-and-drop operations for an application, you must understand how Motif decides which operation executes when the source and destination of a drag and drop do not match.

For each drag source, an application advertises which drag-and-drop operations are possible and on what destinations the drag source can be dropped. For each drag destination, the application advertises the possible sources and the types of operations. If a source and its destination have two or more operations in common, Motif follows a specific order to determine which operation to use. That order is move, copy, link. The application cannot change the operation that is accepted based on the type of item being dragged.

For example, application A might allow an element to be moved or copied. Application B might allow the destination to accept a copy or link. The intersection in this example is copy. If the destination in application B accepts move or copy, then the source is moved because the move operation comes first in the operation order.

In this example, the user could override the move operation by holding down a modifier key, for example Ctrl, to make the operation a copy. This will work if the copy operation is in the common set of operations. If the copy operation is not in the common set, then the drag becomes an invalid drag.

The only time you may have to consider matching operations is when you have a destination that accepts moves but functions better with copies. In that case, the destination should accept only copies because accepting a copy broadens the scope of acceptable drops. In most cases where a move is accepted, a copy would work just as well. Remember that move is implemented as a copy followed by a delete.

Determining Drag Sources

If you use drag and drop in an application, you must decide what control elements can be dragged and how those elements are to be represented. Typically, the user selects something like text or a file to drag, but the application may also allow a drag-and-drop of other elements, such as mail messages or appointments.

This section provides general guidelines for determining drag sources and then discusses specific elements that can be dragged.

Dragging from a Scrolling List

In CDE, items in a scrolling list are text objects by default. They can be buffer objects, but they cannot be both text and buffer objects. For example, the Calendar Appointment Editor has a scrolling list of appointments that the user can select and drag. When dragging an appointment, the user is manipulating a buffer and the drag icon shows an appointment icon as the source indicator (see Figure 13-22). A Mailer container window has a list of mail messages in the upper portion of the window. Users can select and drag one or more messages from this list. These messages are actually buffers and the drag icon shows a mail message as the source indicator. If multiple mail messages are dragged, then the drag icon shows the multiple source indicator.

Figure 13-22. Scrolling List with a Draggable Item

If your application uses a scrolling list to show mail message headers or to list other kinds of objects, then you need to integrate dragging with an extended selection model, as in the Mailer application.

Dragging from a Dialog Box

Sometimes the user needs to be able to drag from inside a dialog box. For example, in the Calendar Appointment Editor there are a series of text fields on the left side where the user enters information about an appointment. Allowing drags from this area lets the user drag text from the appointment description.

The recommended method for indicating that the user can drag something is to include a draggable icon graphic in the dialog box. This icon graphic must be the same icon that represents data in File Manager. In Calendar, the appointment icon is shown just as it would appear in File Manager (see Figure 13-23), with a label under it. This is the same icon that the drag icon source indicator uses. Place the icon graphic in the dialog box adjacent to the information to be dragged. The upper right corner of the dialog box or window is the default position, but you can change it for your application. In Calendar Appointment Editor, the icon is placed near the main text field to indicate that you can drag the text fields.

Figure 13-23. Calendar Appointment Editor Dialog Box


Dragging from a Window

In some applications, you might want to allow the user to drag an entire document or file. For example, in Icon Editor, you might want to allow the user to drag the file for an icon currently in the editor. You should incorporate a draggable icon graphic in the window of your application to indicate that the user can drag the document or file. In the case of Icon Editor, you can use one of the icons for displaying the contents of the icon file. Follow the guidelines for icons used in dialog boxes. For example, the icon should:

  • Be the same icon used to represent the document in File Manager

  • Be 32x32 pixels

  • Have a label

  • Be placed adjacent to the data being dragged

  • Be used as the source indicator in the drag icon

Dragging and Dropping Multiple Selections

When the user selects more than one item to be dragged, change the drag icon to indicate there is more than one item selected.

Some drop zones may be able to accept only a single item. A drop zone cannot differentiate between a single and a multiple set of items being dropped. Since the drop icon does not display the cannot pointer, melt the items in and then have the destination application snap them back. Follow the snap back with an error notice that tells the user why the drop failed.

Standard Supported Drop Zones

The standard supported drop zones in CDE are Front Panel controls, open windows, and some icons in File Manager, including folder and action icons. CDE does not support dropping on minimized icons and on File Manager icons that do not support drops.

Front Panel Drop Zones

The Front Panel is a collection of controls and other functions that provide the user with easy and fast access to the operating system. As a consequence, its drag-and-drop behaviors are heavily dependent upon the context of the destination. For example, if the destination is a printer, then the system should print it. If the destination is a subpanel, then the system should install it in the subpanel. Most applications will not vary in behavior quite as broadly as the Front Panel.

File Manager Drop Zones

File Manager for CDE allows the user to drop an icon on the desktop, where it becomes a reference. Within File Manager windows, File Manager allows dropping onto icons other than folders and action icons. For example, dropping a mail message icon onto a mail container icon appends the mail message.

When mail messages or calendar appointments, or other buffers, are dragged from the source application and dropped onto File Manager, they must be named. The underlying API supports a name field for the item being dragged. You should use this name as the name of the buffer. Create names that are consistent with the application from which it came. If there is no appropriate name, as in dropping a text selection in File Manager, name the resulting file “unnamed.” If there is a name conflict, display a dialog box and ask the user to rename the dropped file.

Drop-Only Targets

CDE does not support the concept of a specific control or graphical target used only for drops. Any control in the human interface that has selectable items can be dropped upon and should provide drop-zone feedback. This includes data panes, scrolling lists, and text-entry fields. The operation that takes place upon the drop should be consistent with the user's expectations for that application type.

Drag-and-Drop Performance Guidelines

There are several points during a drag-and-drop operation when the timing and response to the user is critical. The responsibility for ensuring optimal performance belongs to the source and destination applications, as well as to the Motif Drag-and-Drop API and Drag-and-Drop Convenience API.

The following time line explains the individual user steps and system responses in a drag-and-drop operation. The suggested guideline for interaction timing is noted after the relevant step.

  1. The user makes a selection. The pointer is over the selected object. The user presses and holds down the mouse button.

  2. The user starts to move the pointer. The user should be able to move the pointer 10 pixels before a drag is initiated. If the user is pressing the TRANSFER button, there is no drag threshold.

    • Change the pointer to a drag icon when the drag is initiated.

    • The latency from hand movement to drag icon display should be less than 50 msec.

  3. The user drags the object over a drop zone, crossing the boundary line with the hot spot on the drag icon.

    • Change the drag icon to the cannot pointer if it is not over a valid drop zone. Highlight the drop zone if it is a valid drop zone.

    • The latency from hand movement to drag icon display should be less than 50 msec.

  4. The user drops the drag icon on the drop zone.

    If the drop zone is not valid, use the snap-back transition effect to snap the drag icon back to the source.

    If the drop zone is valid, use the melt-in transition effect to melt the drag icon into the destination.

    • The display latency from mouse button release to feedback echo should be less than 50 msec, with a maximum limit of 120 msec.

    • Transitional animations should run from 200 to 350 msec, with a maximum limit of 500 msec. The animation should run at the same speed, regardless of hardware conditions.

  5. The destination application starts the data transfer.

    • Display a message to the user indicating that data transfer has started.

    • Indicate progress with further messages.

    • Indicate the completion of the data transfer to the user.

    • If the data transfer fails, the destination application should provide the user with appropriate feedback as to why it failed.

    • The latency from command invocation (drop occurred) to completion should be in the range of 0.3 to 1 second, with a maximum of 2 seconds.

    • When a command might run longer than 2 seconds, display a busy cursor whenever the cursor is over the busy object. When possible, display partial results. The progress indicator or busy cursor should be displayed in less than 0.5 second.

    • Display a status message or an in-progress message upon completion of the transitional animation that indicates the data transfer is taking place. For example: Data transfer is 10% complete. Update this message every 2 to 3 seconds until the transfer is 100% complete.

    • If the data transfer fails, display a message, either in the status area or in an in-progress message, that indicates why the drop failed and what the user can do about it, if anything.

Using Attachments in Your Application

This section discusses the CDE user model and guidelines for attaching (or including) documents. You can see this functionality in the Mailer software application. If you plan to include an attachment list in the interface of your application, read this section.


Note: This set of guidelines is not a description of an embedded document architecture.

In CDE, an attachment and attachment list are defined as follows:

attachment 

An attachment is an object that is included with another object in order to complete it.

Suppose you had two documents called A and B. If document A is attached to document B then A continues to exist as a separate document that is “carried” by B. Show document A as an icon within document B. The user can open and view document A independently and can detach A from B at a later time, as if they were never attached at all.

attachment list 

An attachment list is the area in which you can display attachments. An attachment list should be scrollable and include room for displaying icon labels.


Note: Containers are an implementation concept that should not appear in the attachments interface. Therefore, do not use the term “container” to describe attachments to the user. (It may be an appropriate term elsewhere.)


Attachment User Model

Show attachments as icons where they are attached. These icons are the same icons as those used in File Manager and other places in CDE. The basic rule is that if the same icon is used in File Manager as in an attachment, then you should make every effort to ensure that the two behave the same in every situation.

There are three levels of functionality for attached documents:

  1. Ability to attach and detach documents

  2. Ability to open, view, and quit an attached document in a separate window

  3. Ability to edit the attachment in a separate window and save changes back to the attached document

The goal is to provide level 3 functionality whenever possible. If you cannot provide this level, then degrade the attachment's level of functionality in the steps shown. This section assumes you are providing level 3 functionality.

If a document provides significantly different functionality as an attachment from that provided as a File Manager icon, then provide a different icon for the attachment to clearly indicate to the user the difference in functionality.

What Can Be Attached?

You should determine for each application what items it can attach. For example, Mailer can attach documents, scripts, and applications, but not folders.

What is the Method for Attaching?

There are two methods of attachment:

  • Through the file selection dialog box that comes up when you choose Add File from the Attachment menu

  • Through drag and drop from File Manager or another application

What Happens When an Object Is Attached?

The act of attaching document A to document B copies the bits of document A into document B. There is no further connection with the original file. If the user opens the attached document and makes changes, the changes are saved back to the attached document only, not back to a file in the file system.

Attachments Within Attachments

The user can attach messages or text files that have attachments inside them. This is sometimes referred to as “nesting.” For example, a text file might have a mail message icon that the user could open and that could have a text message and more attachments.

Editing and Saving Attachments

The user should be able to open an attachment, edit it, and save the changes back to the attachment. If the attachment cannot do this, then do not provide the Open action in the Actions portion of the menu when that attachment is selected and do not allow double-clicking to open the attachment.

Executing Attachments

When the user tries to open or double-click on an executable attachment, there may be times when you should ask the user to confirm this operation. Both the name of the attachment and the name of the action being taken on the attachment should be variables. An example error message follows:

"Invitation" is an executable attachment. Do you want to Run it?
Buttons: Run, Cancel, Help

Read-Only Attachments

The user can open read-only attachments for reading only. Indicate this state by deactivating the menus in the attachment application, deactivating the selection cursor, or by some other obvious method. At a minimum, you should dim the Save menu item in the attachment application.

Drag Load and Attachments

The user can accomplish a drag load in two ways. In applications that directly support drag load, the user can drag an icon from File Manager over the open window for that application and drop it. This should load the file represented by that icon. The same result can be accomplished by dropping an icon onto an action icon. The action starts an editor, which then loads the file represented by the icon. When an icon from File Manager is drag loaded, it is equivalent to choosing Open from the File menu. The user can then edit and save the open file.

The user can drag and drop an attachment onto editors or actions that support drag load but any edits made are not saved back to the attachment. Attachments, which are implemented as buffers, are loaded as read-only data.

When the user tries to save changes to a loaded attachment, the editor displays a file selection dialog box and asks the user to confirm the name and to choose a place in the file system to save the file. The name used in the file selection dialog box is the same as the attachment name. If the editor (command line application) cannot bring up a file selection dialog box, then you should clearly and visibly indicate to the user that the loaded file is read-only.

If the user wants to edit the attachment directly, the user must select the attachment in the attachment list, choose Open from the Attachment menu, or double-click on the attachment. This opens the attachment, allowing the user to edit and save changes.

Another option is to drag load an attachment, edit it, save it to a new file name, and replace the old attachment with the new one manually.