static void tab_panel_view_notify_icon_cb (GtkWidget* view, GParamSpec* pspec, MidoriExtension* extension) { MidoriBrowser* browser = midori_browser_get_for_widget (view); gboolean minimized = katze_object_get_boolean (view, "minimized"); GdkPixbuf* icon = midori_view_get_icon (MIDORI_VIEW (view)); if (minimized) { GtkToolItem* toolitem = tab_panel_get_toolitem_for_view (view); GtkWidget* image = gtk_tool_button_get_icon_widget (GTK_TOOL_BUTTON (toolitem)); gtk_image_set_from_pixbuf (GTK_IMAGE (image), icon); } else { GtkTreeModel* model = tab_panel_get_model_for_browser (browser); GtkTreeIter iter; GtkWidget* label = midori_view_get_proxy_tab_label (MIDORI_VIEW (view)); GtkStyle* style = gtk_widget_get_style (label); if (tab_panel_get_iter_for_view (model, &iter, view)) gtk_tree_store_set (GTK_TREE_STORE (model), &iter, 3, icon, 6, &style->bg[GTK_STATE_NORMAL], 7, &style->fg[GTK_STATE_NORMAL], -1); } }
static void gtk_tool_button_sync_action_properties (GtkActivatable *activatable, GtkAction *action) { GtkToolButton *button; GIcon *icon; const gchar *stock_id; GtkIconSet *icon_set = NULL; parent_activatable_iface->sync_action_properties (activatable, action); if (!action) return; if (!gtk_activatable_get_use_action_appearance (activatable)) return; button = GTK_TOOL_BUTTON (activatable); G_GNUC_BEGIN_IGNORE_DEPRECATIONS; stock_id = gtk_action_get_stock_id (action); G_GNUC_END_IGNORE_DEPRECATIONS; gtk_tool_button_set_label (button, gtk_action_get_short_label (action)); gtk_tool_button_set_use_underline (button, TRUE); G_GNUC_BEGIN_IGNORE_DEPRECATIONS; gtk_tool_button_set_stock_id (button, stock_id); G_GNUC_END_IGNORE_DEPRECATIONS; gtk_tool_button_set_icon_name (button, gtk_action_get_icon_name (action)); if (stock_id) { G_GNUC_BEGIN_IGNORE_DEPRECATIONS; icon_set = gtk_icon_factory_lookup_default (stock_id); G_GNUC_END_IGNORE_DEPRECATIONS; } if (icon_set != NULL) gtk_tool_button_set_icon_widget (button, NULL); else if ((icon = gtk_action_get_gicon (action)) != NULL) { GtkIconSize icon_size = gtk_tool_item_get_icon_size (GTK_TOOL_ITEM (button)); GtkWidget *image = gtk_tool_button_get_icon_widget (button); if (!image) { image = gtk_image_new (); gtk_widget_show (image); gtk_tool_button_set_icon_widget (button, image); } gtk_image_set_from_gicon (GTK_IMAGE (image), icon, icon_size); } else if (gtk_action_get_icon_name (action)) gtk_tool_button_set_icon_name (button, gtk_action_get_icon_name (action)); else gtk_tool_button_set_label (button, gtk_action_get_short_label (action)); }
void wxToolBarTool::SetImage() { const wxBitmap& bitmap = GetNormalBitmap(); wxCHECK_RET(bitmap.IsOk(), "invalid bitmap for wxToolBar icon"); GtkWidget* image = gtk_tool_button_get_icon_widget(GTK_TOOL_BUTTON(m_item)); // always use pixbuf, because pixmap mask does not // work with disabled images in some themes gtk_image_set_from_pixbuf(GTK_IMAGE(image), bitmap.GetPixbuf()); }
/*# @method get_icon_widget GtkToolButton @brief Return the widget used as icon widget on button. @return The widget used as icon on button, or NULL. */ FALCON_FUNC ToolButton::get_icon_widget( VMARG ) { NO_ARGS MYSELF; GET_OBJ( self ); GtkWidget* wdt = gtk_tool_button_get_icon_widget( (GtkToolButton*)_obj ); if ( wdt ) vm->retval( new Gtk::Widget( vm->findWKI( "GtkWidget" )->asClass(), wdt ) ); else vm->retnil(); }
static void gtk_tool_button_update (GtkActivatable *activatable, GtkAction *action, const gchar *property_name) { GtkToolButton *button; GtkWidget *image; parent_activatable_iface->update (activatable, action, property_name); if (!gtk_activatable_get_use_action_appearance (activatable)) return; button = GTK_TOOL_BUTTON (activatable); if (strcmp (property_name, "short-label") == 0) gtk_tool_button_set_label (button, gtk_action_get_short_label (action)); else if (strcmp (property_name, "stock-id") == 0) gtk_tool_button_set_stock_id (button, gtk_action_get_stock_id (action)); else if (strcmp (property_name, "gicon") == 0) { const gchar *stock_id = gtk_action_get_stock_id (action); GIcon *icon = gtk_action_get_gicon (action); GtkIconSize icon_size = GTK_ICON_SIZE_BUTTON; if ((stock_id && gtk_icon_factory_lookup_default (stock_id)) || !icon) image = NULL; else { image = gtk_tool_button_get_icon_widget (button); icon_size = gtk_tool_item_get_icon_size (GTK_TOOL_ITEM (button)); if (!image) image = gtk_image_new (); } gtk_tool_button_set_icon_widget (button, image); gtk_image_set_from_gicon (GTK_IMAGE (image), icon, icon_size); } else if (strcmp (property_name, "icon-name") == 0) gtk_tool_button_set_icon_name (button, gtk_action_get_icon_name (action)); }