## Pixmaps

Pixmaps — Handling pixmaps for applications.

## Synopsis

    struct      gpe_icon;
    gboolean    gpe_load_icons                  (struct gpe_icon*);
    GdkPixbuf*  gpe_find_icon                   (const char *name);
    GdkPixbuf*  gpe_find_icon_scaled            (const char *name,
                                                 GtkIconSize size);
    GdkPixbuf*  gpe_try_find_icon               (const char *name,
                                                 gchar **error);
    gboolean    gpe_find_icon_pixmap            (const char *name,
                                                 GdkPixmap **pixmap,
                                                 GdkBitmap **bitmap);
    void        gpe_set_window_icon             (GtkWidget *window,
                                                 gchar *icon);

## Description

GPE provides a set of functions for maintaining a shared icons to avoid loading icon sets multiple times. These icons are loaded into an internal storage list and identified by a name string.

## Details

### struct gpe_icon

    struct gpe_icon {
      const char *shortname;
      const char *filename;
      GdkPixbuf *pixbuf;
    };

Struct defining a icon resource in GPE. It consists of three parts:

shortname: Short symbolic name to identify the icon.

filename: Image file with full path or file in theme location (PREFIX /share/gpe/pixmaps/<theme>).

pixbuf: GdkPixbuf with icon data.

### gpe_load_icons ()

    gboolean    gpe_load_icons                  (struct gpe_icon*);

This function is used to load a set of icons into memory and makes them accessible for the applications. Usually you will have a fixed set of pixmaps to load for each application on startup. The function will display an error message if loading of an icon fails.

`Param1` : | List of icon defintions, terminated by NULL.
Returns : | TRUE on success.

### gpe_find_icon ()

    GdkPixbuf*  gpe_find_icon                   (const char *name);

Get an icon by name from storage list.

`name` : | Icon name to find.
Returns : | Pixbuf pointer on success, NULL on failure.

### gpe_find_icon_scaled ()

    GdkPixbuf*  gpe_find_icon_scaled            (const char *name,
                                                 GtkIconSize size);

As GTK uses icons in several sizes for different purposes this function renders a given icon to one of the common GTK icon sizes.

`name` : | Icon to use.
`size` : | GTK icon size to use.
Returns : | A new allocated pixbuf containing the icon of the desired size.

### gpe_try_find_icon ()

    GdkPixbuf*  gpe_try_find_icon               (const char *name,
                                                 gchar **error);

This function is used to get an icon which is not necessarily loaded when the function is called. The icon is taken from internal storage if it is already available and tried to load from a file with the same name like the name passed to the function otherwise.

`name` : | Icon name to get.
`error` : | Retuned error information if function fails.
Returns : | Pixbuf of icon or NULL on failure.

### gpe_find_icon_pixmap ()

    gboolean    gpe_find_icon_pixmap            (const char *name,
                                                 GdkPixmap **pixmap,
                                                 GdkBitmap **bitmap);

[Deprecated - do not use.]

`name` : |
`pixmap` : |
`bitmap` : |
Returns : |

### gpe_set_window_icon ()

    void        gpe_set_window_icon             (GtkWidget *window,
                                                 gchar *icon);

Set the icon of a window from a named icon in storage list.

`window` : | Window to set icon for.
`icon` : | Icon name.

## See Also

Used by: Most GPE applications.