Pixmaps

Pixmaps — Handling pixmaps for applications.

Synopsis

gboolean            gpe_load_icons                      (struct gpe_icon *);
GdkPixbuf *         gpe_find_icon                       (const gchar *name);
GdkPixbuf *         gpe_find_icon_scaled                (const gchar *name,
                                                         GtkIconSize size);
GdkPixbuf *         gpe_find_icon_scaled_free           (const gchar *name,
                                                         gint width,
                                                         gint height);
GdkPixbuf *         gpe_try_find_icon                   (const gchar *name,
                                                         gchar **error);
gboolean            gpe_find_icon_pixmap                (const gchar *name,
                                                         GdkPixmap **pixmap,
                                                         GdkBitmap **bitmap);
void                gpe_set_theme                       (const gchar *theme_name);
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

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 gchar *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 gchar *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_find_icon_scaled_free ()

GdkPixbuf *         gpe_find_icon_scaled_free           (const gchar *name,
                                                         gint width,
                                                         gint height);

Find an icon by name and scale it to a new size defined by the user.

name :

name of the icon to find

width :

designated icon width

height :

designated icon height

Returns :

New allocated and scaled pixbuf.

gpe_try_find_icon ()

GdkPixbuf *         gpe_try_find_icon                   (const gchar *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 :

Returned error information if function fails.

Returns :

Pixbuf of icon or NULL on failure.

gpe_find_icon_pixmap ()

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

[Deprecated - do not use.]

name :

pixmap :

bitmap :

Returns :


gpe_set_theme ()

void                gpe_set_theme                       (const gchar *theme_name);

Set the name of the theme used by GPE functions. This will cause GPE icon functions to load icons from the given theme instead of the default location (if the icon is present in the selected theme). The name of the theme points GPE to the directory in $PREFIX/share/gpe/pixmaps where to search for the themed icons. How the actual theme is set and changed needs to be handled by the application. Passing NULL to theme_name resets the theme to the default/user theme.

theme_name :

Name of the theme to be used for GPE.

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.