-static GdkPixbuf *CreateThemeIcon(const char *iconname,
- GtkIconSize iconsize, const wxSize& sz)
+GdkPixbuf *CreateThemeIcon(const char *iconname, int size)
+{
+ return gtk_icon_theme_load_icon
+ (
+ gtk_icon_theme_get_default(),
+ iconname,
+ size,
+ (GtkIconLookupFlags)0,
+ NULL
+ );
+}
+
+
+// creates either stock or theme icon
+GdkPixbuf *CreateGtkIcon(const char *icon_name,
+ GtkIconSize stock_size, const wxSize& pixel_size)
+{
+ // try stock GTK+ icon first
+ GdkPixbuf *pixbuf = CreateStockIcon(icon_name, stock_size);
+ if ( pixbuf )
+ return pixbuf;
+
+ // if that fails, try theme icon
+ wxSize size(pixel_size);
+ if ( pixel_size == wxDefaultSize )
+ gtk_icon_size_lookup(stock_size, &size.x, &size.y);
+ return CreateThemeIcon(icon_name, size.x);
+}
+
+template<typename SizeType, typename LoaderFunc>
+wxIconBundle DoCreateIconBundle(const char *stockid,
+ const SizeType *sizes_from,
+ const SizeType *sizes_to,
+ LoaderFunc get_icon)
+