Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



How to write an aif file


Overview

The following example demonstrate how to create the application information file. You must:

You must then compile the aif file as described in How to compile an aif file.


Creating the resource definition file

The easiest way to create a resource file is to copy an existing one, and then edit it to have the correct caption/s, UID, and number of icons. An example is given below:

#include <aiftool.rh>

RESOURCE AIF_DATA
 {
 // uid
 app_uid=0x10004299;

 // captions
 caption_list=
  {
  CAPTION { code=ELangEnglish; caption="Hello"; },
  CAPTION { code=ELangFrench; caption="Bonjour"; }
  };

 // icons
 num_icons=2;
   // capabilities
 embeddability= KAppEmbeddable;
 hidden=KAppNotHidden;
 newfile= KAppSupportsNewFile;

 // MIME types
 datatype_list=
  {
  DATATYPE { priority=EDataTypePriorityNormal; type="text/html"; },
  DATATYPE { priority=EDataTypePriorityLow; type="text/plain"; }
  };
 }

The include file

The aiftool.rh resource header file is #include’d into the top of every resource definition file. This file defines the aif file structure, including all supported languages, and the default aif file capabilities.

#include <aiftool.rh>

Note that the resource header is stored in the standard C++ EPOC include directory: \Epoc32\Include\.

UID

The UID (here 0x10004299) is the unique number used to identify the application. This is the same UID which is specified in the project file (mmp) for a C++ application.

Developers can reserve unused UIDs from the Symbian Developer Network website.

Captions

Captions are the text displayed with the application’s icon in the shell. The example is localised for English and French:

caption_list=
  {
  CAPTION { code=ELangEnglish; caption="Hello"; },
  CAPTION { code=ELangFrench; caption="Bonjour"; }
  };

Consequently, the caption on a French machine is "Bonjour".

Icons

The resource definition file specifies the number of icons for the application. Each icon is comprised of an icon bitmap and a mask. In the example there are 2 icons, so the icon file would contain 4 bitmaps.

num_icons=2;

Icons, and the icon file, are discussed in greater detail in the following section.

Note that the maximum number of icons differs between device families: see Application icons.

Capabilities

Capabilities are specified so that the application is embeddable, not hidden, and allows new documents to be generated from the system shell. For information on each of the possible capabilities, see Application capabilities.

MIME Types

The datatype_list statement says that the application should be associated with HTML and plain text files. For information on MIME types, see MIME support.


Creating the bitmaps

Icon files contain the different sized icons used to represent the application at different zoom levels. Each icon is constructed from two bitmaps, an image and a mask. The image is the actual bitmap for the icon, while the mask defines what areas of the background show through the icon bitmap; the black areas of the mask are opaque to the background, while the white areas are transparent.

Note that the allowed icon formats differ between device families: see Application icons.