Solaris Common Desktop Environment: Programmer's Guide

To Obtain the Icon Image Information for a Specified Action

    Use the DtActionIcon() function to obtain the icon image information.

DtActionIcon(char *action_name)

An action definition specifies the icon image used to represent the action in the definition's ICON field:

ACTION action_name
{
     ICON icon_image_base_name  
     ... 
}

DtActionIcon() returns a character string containing the value of the icon image field. If the action definition does not contain an icon field, the function returns the value of the default action icon image, Dtactn.

You then need to determine the location of the icon, and the size you want to use. Icons can exist in four sizes and are available in bitmap or pixmap form. For example, you can find the base name of the icon file from the action definition for the Calculator. You then use the base name coupled with the information given in Table 8-1 and knowledge of the location of all the icons to find the specific icon file you want.

The icon name for the calculator action is Dtcalc, but that is not the entire file name. Icon file names are based on the size of the icon. Table 8-1 shows the sizes and file-naming conventions for the desktop icons.

Table 8-1 Icon Sizes and File Names

Icon Size 

Bitmap Name 

Pixmap Name 

16 by 16 (tiny) 

name.t.bm

name.t.pm

24 by 24 (small) 

name.s.bm

name.s.pm

32 by 32 (medium) 

name.m.bm

name.m.pm

48 by 48 (large) 

name.l.bm

name.l.pm


Note -

See "Creating Icons for the Desktop" in the Solaris Common Desktop Environment: Advanced User's and System Administrator's Guide for more information about the desktop icon files.


For bitmaps, there is an additional file that is used as a mask, and its extension ends with _m.bm. Thus, there can be a total of three files for each size icon. Here are the icon files for the calculator:

Dtcalc.t.bm  
Dtcalc.t.pm
Dtcalc.t_m.bm  
Dtcalc.m.bm  
Dtcalc.m.pm  
Dtcalc.m_m.bm  
Dtcalc.l.bm 
Dtcalc.l.pm  
Dtcalc.l_m.bm

Note -

There are no small icons (Dtcalc.s.bm, Dtcalc.s.pm, Dtcalc.s_m.bm) for the Calculator.


DtActionIcon() returns only a base name; for the Calculator it is Dtcalc. You must choose the type (pixmap or bitmap) and size (tiny, small, medium, or large) and append the applicable extension to the base name. In addition, you must know where the file resides.