From 23ae8ccf110f94019c745ebc4959c06b842a626d Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Thu, 9 Apr 2015 23:25:05 +0100 Subject: Extend gtk compatability to fix more items depricated in GTK 3.10 --- gtk/compat.h | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) (limited to 'gtk/compat.h') diff --git a/gtk/compat.h b/gtk/compat.h index 4f83aac46..42deab2ac 100644 --- a/gtk/compat.h +++ b/gtk/compat.h @@ -73,6 +73,14 @@ GtkWidget *nsgtk_combo_box_text_new(void); void nsgtk_combo_box_text_append_text(GtkWidget *combo_box, const gchar *text); gchar *nsgtk_combo_box_text_get_active_text(GtkWidget *combo_box); +/** + * creates a new image widget of an appropriate icon size from a pixbuf. + * + * \param pixbuf The pixbuf to use as a source. + * \param size The size of icon to create + * \return An image widget. + */ +GtkWidget *nsgtk_image_new_from_pixbuf_icon(GdkPixbuf *pixbuf, GtkIconSize size); /* GTK prior to 2.16 needs the sexy interface for icons */ #if !GTK_CHECK_VERSION(2,16,0) @@ -111,23 +119,39 @@ enum { #endif -GtkWidget *nsgtk_entry_new(void); -void nsgtk_entry_set_icon_from_pixbuf(GtkWidget *entry, GtkEntryIconPosition icon_pos, GdkPixbuf *pixbuf); /** - * Sets the icon shown in the entry at the specified position from a stock image. + * Sets the icon shown in the entry at the specified position from a + * stock image. + * + * Compatability interface for original deprecated in GTK 3.10 * - * Compatability interface for interface deprecated in 3.10 + * \param stock_id the name of the stock item */ void nsgtk_entry_set_icon_from_stock(GtkWidget *entry, GtkEntryIconPosition icon_pos, const gchar *stock_id); /** * Creates a GtkImage displaying a stock icon. * - * Compatability interface for interface deprecated in 3.10 + * Compatability interface for original deprecated in GTK 3.10 + * + * \param stock_id the name of the stock item */ GtkWidget *nsgtk_image_new_from_stock(const gchar *stock_id, GtkIconSize size); +/** + * Creates a new GtkButton containing the image and text from a stock item. + * + * Compatability interface for original deprecated in GTK 3.10 + * + * \param stock_id the name of the stock item + */ +GtkWidget *nsgtk_button_new_from_stock(const gchar *stock_id); + +GtkWidget *nsgtk_entry_new(void); + +void nsgtk_entry_set_icon_from_pixbuf(GtkWidget *entry, GtkEntryIconPosition icon_pos, GdkPixbuf *pixbuf); + void nsgtk_widget_override_background_color(GtkWidget *widget, GtkStateFlags state, uint16_t a, uint16_t r, uint16_t g, uint16_t b); GtkWidget* nsgtk_hbox_new(gboolean homogeneous, gint spacing); GtkWidget* nsgtk_vbox_new(gboolean homogeneous, gint spacing); -- cgit v1.2.3