public void SetImage(ImageDescription image) { Gtk.ImageMenuItem it = item as Gtk.ImageMenuItem; if (it == null) { return; } if (!image.IsNull) { if (defImage == null) { item.StateChanged += ImageMenuItemStateChanged; } defImage = image; selImage = new ImageDescription { Backend = image.Backend, Size = image.Size, Alpha = image.Alpha, Styles = image.Styles.Add("sel") }; var img = new ImageBox(context, image); img.ShowAll(); it.Image = img; GtkWorkarounds.ForceImageOnMenuItem(it); } else { if (defImage.HasValue) { item.StateChanged -= ImageMenuItemStateChanged; defImage = selImage = null; } it.Image = null; } }
public void SetImage(ImageDescription image) { Gtk.ImageMenuItem it = item as Gtk.ImageMenuItem; if (it == null) { return; } if (!image.IsNull) { var img = new ImageBox(context, image); img.ShowAll(); it.Image = img; GtkWorkarounds.ForceImageOnMenuItem(it); } else { it.Image = null; } }