Example #1
0
		public MDSpinner (Gtk.IconSize size, Image idleImage = null)
		{
			Content = imageView = new Xwt.ImageView ();
			if (size == Gtk.IconSize.Menu)
				spinner = ImageService.GetAnimatedIcon ("md-spinner-16", size);
			else
				spinner = ImageService.GetAnimatedIcon ("md-spinner-18", size);
			IdleImage = idleImage;
		}
Example #2
0
		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;
		}
Example #3
0
		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);
		}
Example #4
0
			public AnimatedImageInfo (Gtk.Image img, AnimatedIcon anim)
			{
				Image = img;
				AnimatedIcon = anim;
				img.Realized += HandleRealized;
				img.Unrealized += HandleUnrealized;
				img.Destroyed += HandleDestroyed;
				if (img.IsRealized)
					StartAnimation ();
			}
Example #5
0
		static string InternalGetStockIdFromAnimation (RuntimeAddin addin, string id, Gtk.IconSize size)
		{
			if (!id.StartsWith ("animation:"))
				return id;
			
			id = id.Substring (10);
			Dictionary<string, string> hash;
			int addinId;

			if (addin != null) {
				addinId = GetAddinId (addin);
				hash = addinIcons[addinId];
			} else {
				addinId = -1;
				hash = iconSpecToStockId;
			}

			string stockId = "__asm" + addinId + "__" + id + "__" + size;
			if (!hash.ContainsKey (stockId)) {
				var aicon = new AnimatedIcon (addin, id, size);
				AddToIconFactory (stockId, aicon.FirstFrame.WithSize (size).ToPixbuf (), null, size);
				AddToAnimatedIconFactory (stockId, aicon);
				hash[stockId] = stockId;
			}
			return stockId;
		}
Example #6
0
		static void AddToAnimatedIconFactory (string stockId, AnimatedIcon aicon)
		{
			animationFactory [stockId] = aicon;
		}
			public AnimatedTreeStoreIconInfo (Gtk.TreeStore treeStore, Gtk.TreeIter iter, int column, AnimatedIcon anim, string iconId)
			{
				TreeStore = treeStore;
				Iter = iter;
				Column = column;
				AnimatedIcon = anim;
				IconId = iconId;
				TreeStore.RowDeleted += HandleRowDeleted;
				StartAnimation ();
			}
Example #8
0
        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;
        }
		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;
		}