Пример #1
0
 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;
     }
 }
Пример #2
0
		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;
		}
Пример #3
0
 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;
     }
 }
Пример #4
0
 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;
     }
 }