/////////////////////////////////////////////////////////////////////////////
-// Name: src/gtk/artstd.cpp
+// Name: src/gtk/artgtk.cpp
// Purpose: stock wxArtProvider instance with native GTK+ stock icons
// Author: Vaclav Slavik
// Modified by:
#endif
#include "wx/artprov.h"
+
+#include <gtk/gtk.h>
#include "wx/gtk/private.h"
// compatibility with older GTK+ versions:
/*static*/ void wxArtProvider::InitNativeProvider()
{
- Push(new wxGTK2ArtProvider);
+ PushBack(new wxGTK2ArtProvider);
}
// ----------------------------------------------------------------------------
// with "stock-id" representation (in addition to pixmap and pixbuf
// ones) and would convert it to pixbuf when rendered.
- GtkStyle* style = wxGTKPrivate::GetButtonWidget()->style;
+ GtkStyle* style = gtk_widget_get_style(wxGTKPrivate::GetButtonWidget());
GtkIconSet* iconset = gtk_style_lookup_icon_set(style, stockid);
if (!iconset)
continue;
wxIcon icon;
- icon.SetPixbuf(pixbuf);
+ icon.CopyFromBitmap(wxBitmap(pixbuf));
bundle.AddIcon(icon);
}
}
}
- wxBitmap bmp;
- if (pixbuf != NULL)
- bmp.SetPixbuf(pixbuf);
-
- return bmp;
+ return wxBitmap(pixbuf);
}
wxIconBundle
wxGTK2ArtProvider::CreateIconBundle(const wxArtID& id,
const wxArtClient& WXUNUSED(client))
{
+ wxIconBundle bundle;
const wxString stockid = wxArtIDToStock(id);
// try to load the bundle as stock icon first
- GtkStyle* style = wxGTKPrivate::GetButtonWidget()->style;
+ GtkStyle* style = gtk_widget_get_style(wxGTKPrivate::GetButtonWidget());
GtkIconSet* iconset = gtk_style_lookup_icon_set(style, stockid.utf8_str());
if ( iconset )
{
GtkIconSize *sizes;
gint n_sizes;
gtk_icon_set_get_sizes(iconset, &sizes, &n_sizes);
- wxIconBundle bundle = DoCreateIconBundle
+ bundle = DoCreateIconBundle
(
stockid.utf8_str(),
sizes, sizes + n_sizes,
// otherwise try icon themes
#ifdef __WXGTK26__
+#ifndef __WXGTK3__
if ( !gtk_check_version(2,6,0) )
+#endif
{
gint *sizes = gtk_icon_theme_get_icon_sizes
(
stockid.utf8_str()
);
if ( !sizes )
- return wxNullIconBundle;
+ return bundle;
gint *last = sizes;
while ( *last )
last++;
- wxIconBundle bundle = DoCreateIconBundle
+ bundle = DoCreateIconBundle
(
stockid.utf8_str(),
sizes, last,
&CreateThemeIcon
);
g_free(sizes);
- return bundle;
}
#endif // __WXGTK26__
- return wxNullIconBundle;
+ return bundle;
}
// ----------------------------------------------------------------------------