Integrating applications into the Desktop

Animating icons

To animate your icon, present a series of icon pictures in sequence. The Print icon on the Desktop is an animated icon; when a file icon is dropped on it, paper slides out of the printer. The Print icon is animated by stepping through this series of pictures:

You can define an animated icon just like any other icon, except that you must supply more than one pixmap, along with directions for when to display each pixmap.

To create an animated icon:

  1. Create the pixmaps.

    The example used to illustrate these instructions defines an appointment book icon that opens when a calendar program is started. This icon picture is made of four pixmaps: closed book (picture.px), book one-third open (Calendar1.px), book two-thirds open (Calendar2.px), and open book (Calendar3.px).

  2. Add animation to the activate script.

    For example:

      4 animate $static_arg true $static_arg/Calendar1.px \
      5 $static_arg/Calendar2.px $static_arg/Calendar3.px

    6 /usr/bin/X11/calendar -monthly $*

    line 4
    Displays the pixmaps, (files ending in .px,) in the sequence indicated. The animate sequence should be a single line. The true option resets the icon to its original state after the animated sequence.

    line 5
    Starts the application. $* includes any options the user enters in the dialog box displayed by the alt_activate trigger.

    For more about object scripts, see ``Define icon triggers''.

    Animation can also be used to convey information about the state of your application. For example, an icon for a mail program could change its appearance to indicate that new mail has arrived. If you want to indicate the state change when an icon trigger is activated, test for the state and declare the variation class in the appropriate object script. To indicate the state change without waiting for a trigger, your application must test for the state change and send instructions directly to the Desktop (see the xdt3(XC) manual page and the Graphical Environment Guide).

  3. Install the pixmaps, rules, and object scripts with the deskconfobj tool.

    The pixmaps and scripts will be installed in the icon object directory. By default, your rule file will be copied into the /usr/lib/X11/IXI/XDesktop/rules/modules directory.

Next topic: Localizing icon labels and messages
Previous topic: Making applications user-installable

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003