mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-19 09:50:06 +00:00
Allow user to set a custom image loading routine for loading bg_pixmap's
Allow user to set a custom image loading routine for loading bg_pixmap's specified in the gtkrc's.
This commit is contained in:
parent
aed9cf77fa
commit
cefd52f52f
30
gtk/gtkrc.c
30
gtk/gtkrc.c
@ -228,6 +228,8 @@ static gchar *pixmap_path[GTK_RC_MAX_PIXMAP_PATHS];
|
||||
/* The files we have parsed, to reread later if necessary */
|
||||
GSList *rc_files = NULL;
|
||||
|
||||
static GtkImageLoader image_loader = NULL;
|
||||
|
||||
void
|
||||
gtk_rc_init (void)
|
||||
{
|
||||
@ -760,11 +762,18 @@ gtk_rc_style_init (GtkRcStyle *rc_style, GdkColormap *cmap)
|
||||
if (strcmp (rc_style->bg_pixmap_name[i], "<parent>") == 0)
|
||||
style->bg_pixmap[i] = (GdkPixmap*) GDK_PARENT_RELATIVE;
|
||||
else
|
||||
style->bg_pixmap[i] =
|
||||
gdk_pixmap_colormap_create_from_xpm (NULL, cmap,
|
||||
NULL,
|
||||
{
|
||||
if(image_loader)
|
||||
style->bg_pixmap[i] = image_loader(NULL, cmap, NULL,
|
||||
&style->bg[i],
|
||||
rc_style->bg_pixmap_name[i]);
|
||||
else
|
||||
style->bg_pixmap[i] =
|
||||
gdk_pixmap_colormap_create_from_xpm (NULL, cmap,
|
||||
NULL,
|
||||
&style->bg[i],
|
||||
rc_style->bg_pixmap_name[i]);
|
||||
}
|
||||
}
|
||||
|
||||
rc_style->styles = g_list_append (rc_style->styles, node);
|
||||
@ -1646,3 +1655,18 @@ gtk_rc_widget_class_path (GtkWidget *widget)
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
/*
|
||||
typedef GdkPixmap * (*GtkImageLoader) (GdkWindow *window,
|
||||
GdkColormap *colormap,
|
||||
GdkBitmap **mask,
|
||||
GdkColor *transparent_color,
|
||||
const gchar *filename);
|
||||
*/
|
||||
|
||||
void
|
||||
gtk_rc_set_loader(GtkImageLoader loader)
|
||||
{
|
||||
image_loader = loader;
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,15 @@ void gtk_rc_add_widget_name_style (GtkStyle *style,
|
||||
void gtk_rc_add_widget_class_style (GtkStyle *style,
|
||||
const gchar *pattern);
|
||||
|
||||
/* Tell gtkrc to use a custom routine to load images specified in rc files instead of
|
||||
the default xpm-only loader */
|
||||
typedef GdkPixmap * (*GtkImageLoader) (GdkWindow *window,
|
||||
GdkColormap *colormap,
|
||||
GdkBitmap **mask,
|
||||
GdkColor *transparent_color,
|
||||
const gchar *filename);
|
||||
void gtk_rc_set_loader(GtkImageLoader loader);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user