public static ImageInfo FromFile(string file) { ImageInfo info = new ImageInfo (); info.name = file; info.source = ImageSource.File; return info; }
public static ImageInfo FromResource(string resourceName) { ImageInfo info = new ImageInfo (); info.name = resourceName; info.source = ImageSource.Resource; return info; }
public static ImageInfo FromTheme (string iconId, Gtk.IconSize size) { ImageInfo info = new ImageInfo (); info.name = iconId; info.size = size; info.source = ImageSource.Theme; return info; }
public static ImageInfo FromString(string str) { ImageInfo info = new ImageInfo (); if (str.StartsWith ("resource:")) { info.source = ImageSource.Resource; info.name = str.Substring (9); } else if (str.StartsWith ("stock:")) { info.source = ImageSource.Theme; string[] s = str.Substring (6).Split (' '); if (s.Length != 2) return null; info.name = s[0]; info.size = (Gtk.IconSize) Enum.Parse (typeof(Gtk.IconSize), s[1]); } else if (str.StartsWith ("file:")) { info.source = ImageSource.File; info.name = str.Substring (5); } else return null; return info; }
public void Read(IProject project, XmlElement elem) { XmlElement prop = elem.SelectSingleNode ("property[@name='Image']") as XmlElement; if (prop != null) imageInfo = ImageInfo.FromString (prop.InnerText); prop = elem.SelectSingleNode ("property[@name='Size']") as XmlElement; if (prop != null && prop.InnerText != "*") { SizeWildcarded = false; Size = (Gtk.IconSize) Enum.Parse (typeof(Gtk.IconSize), prop.InnerText); } else SizeWildcarded = true; prop = elem.SelectSingleNode ("property[@name='State']") as XmlElement; if (prop != null && prop.InnerText != "*") { StateWildcarded = false; State = (Gtk.StateType) Enum.Parse (typeof(Gtk.StateType), prop.InnerText); } else StateWildcarded = true; prop = elem.SelectSingleNode ("property[@name='Direction']") as XmlElement; if (prop != null && prop.InnerText != "*") { DirectionWildcarded = false; Direction = (Gtk.TextDirection) Enum.Parse (typeof(Gtk.TextDirection), prop.InnerText); } else DirectionWildcarded = true; }