void LoadPixbuf (IconId iconId) { // We dont need to load the same image twice if (icon == iconId && iconLoaded) return; icon = iconId; iconAnimation = null; // clean up previous running animation if (xwtAnimation != null) { xwtAnimation.Dispose (); xwtAnimation = null; } // if we have nothing, use the default icon if (iconId == IconId.Null) iconId = Stock.StatusSteady; // load image now if (ImageService.IsAnimation (iconId, Gtk.IconSize.Menu)) { iconAnimation = ImageService.GetAnimatedIcon (iconId, Gtk.IconSize.Menu); image = iconAnimation.FirstFrame.ToNSImage (); xwtAnimation = iconAnimation.StartAnimation (p => { image = p.ToNSImage (); ReconstructString (); }); } else { image = ImageService.GetIcon (iconId).ToNSImage (); } iconLoaded = true; }
void LoadPixbuf(IconId image) { // We dont need to load the same image twice if (currentIcon == image && iconLoaded) return; currentIcon = image; iconAnimation = null; // clean up previous running animation if (currentIconAnimation != null) { currentIconAnimation.Dispose (); currentIconAnimation = null; } // if we have nothing, use the default icon if (image == IconId.Null) image = "md-status-steady"; // load image now if (ImageService.IsAnimation (image, Gtk.IconSize.Menu)) { iconAnimation = ImageService.GetAnimatedIcon (image, Gtk.IconSize.Menu); renderArg.CurrentPixbuf = iconAnimation.FirstFrame.WithSize (14,14); currentIconAnimation = iconAnimation.StartAnimation (delegate (Xwt.Drawing.Image p) { renderArg.CurrentPixbuf = p.WithSize (14,14); QueueDraw (); }); } else { renderArg.CurrentPixbuf = ImageService.GetIcon (image).WithSize (14,14); } iconLoaded = true; }
public void ShowMessage (IconId iconId, string message, bool isMarkup) { Message = message; StatusText.ToolTip = message; if (iconId.IsNull) iconId = BrandingService.StatusSteadyIconId; // don't reload same icon if (currentIcon == iconId) return; currentIcon = iconId; if (xwtAnimation != null) { xwtAnimation.Dispose (); xwtAnimation = null; } if (ImageService.IsAnimation (currentIcon, Gtk.IconSize.Menu)) { animatedIcon = ImageService.GetAnimatedIcon (currentIcon, Gtk.IconSize.Menu); StatusImage = animatedIcon.FirstFrame; xwtAnimation = animatedIcon.StartAnimation (p => { StatusImage = p; }); } else StatusImage = currentIcon.GetStockIcon ().WithSize (Xwt.IconSize.Small); }
void SetStatusIcon (IconId stockId, double alpha = 1.0) { animatedStatusIcon = null; if (statusIconAnimation != null) { statusIconAnimation.Dispose (); statusIconAnimation = null; } if (stockId.IsNull) { statusIconView.Visible = false; return; } if (ImageService.IsAnimation (stockId, Gtk.IconSize.Menu)) { animatedStatusIcon = ImageService.GetAnimatedIcon (stockId, Gtk.IconSize.Menu); statusIconView.Image = animatedStatusIcon.FirstFrame.WithAlpha (alpha); statusIconAnimation = animatedStatusIcon.StartAnimation (p => { statusIconView.Image = p.WithAlpha (alpha); }); } else statusIconView.Image = ImageService.GetIcon (stockId).WithSize (Xwt.IconSize.Small).WithAlpha (alpha); statusIconView.Visible = true; }