public static Gdk.Pixbuf IconPixbuf(Gtk.StyleContext context, Gtk.IconSource source, Gtk.IconSize size) { IntPtr raw_ret = gtk_render_icon_pixbuf(context == null ? IntPtr.Zero : context.Handle, source == null ? IntPtr.Zero : source.Handle, (int)size); Gdk.Pixbuf ret = GLib.Object.GetObject(raw_ret, true) as Gdk.Pixbuf; return(ret); }
public Gtk.IconSource Copy() { IntPtr raw_ret = gtk_icon_source_copy(Handle); Gtk.IconSource ret = raw_ret == IntPtr.Zero ? null : (Gtk.IconSource)GLib.Opaque.GetOpaque(raw_ret, typeof(Gtk.IconSource), true); return(ret); }
static Gtk.IconSet MakeIcons(Wrappers.Renderers.Renderer renderer, string detail) { Gtk.IconSet s = new Gtk.IconSet(); Gtk.IconSource source; renderer.Detail = detail; Gtk.IconSize[] sizes = new Gtk.IconSize[] { Gtk.IconSize.Button, Gtk.IconSize.Dialog, Gtk.IconSize.Dnd, Gtk.IconSize.LargeToolbar, Gtk.IconSize.Menu, Gtk.IconSize.SmallToolbar }; for (int i = 0; i < sizes.Length; ++i) { source = new Gtk.IconSource(); int width, height; Gtk.Icon.SizeLookup(sizes[i], out width, out height); source.Pixbuf = renderer.Icon(width); source.Size = sizes[i]; source.StateWildcarded = true; source.DirectionWildcarded = true; source.SizeWildcarded = false; s.AddSource(source); } return(s); }
static void AddToIconFactory(string stockId, Gdk.Pixbuf pixbuf, Gdk.Pixbuf pixbuf2x, Gtk.IconSize iconSize) { Gtk.IconSet iconSet = iconFactory.Lookup(stockId); if (iconSet == null) { iconSet = new Gtk.IconSet(); iconFactory.Add(stockId, iconSet); } Gtk.IconSource source = new Gtk.IconSource(); Gtk.IconSource source2x = null; if (Platform.IsWindows) { var pixel_scale = Mono.TextEditor.GtkWorkarounds.GetPixelScale(); source.Pixbuf = pixbuf.ScaleSimple((int)(pixbuf.Width * pixel_scale), (int)(pixbuf.Height * pixel_scale), Gdk.InterpType.Bilinear); } else { source.Pixbuf = pixbuf; } source.Size = iconSize; source.SizeWildcarded = iconSize == Gtk.IconSize.Invalid; if (pixbuf2x != null) { if (Mono.TextEditor.GtkWorkarounds.SetSourceScale(source, 1)) { Mono.TextEditor.GtkWorkarounds.SetSourceScaleWildcarded(source, false); source2x = new Gtk.IconSource(); source2x.Pixbuf = pixbuf2x; source2x.Size = iconSize; source2x.SizeWildcarded = iconSize == Gtk.IconSize.Invalid; Mono.TextEditor.GtkWorkarounds.SetSourceScale(source2x, 2); Mono.TextEditor.GtkWorkarounds.SetSourceScaleWildcarded(source2x, false); } } else { Mono.TextEditor.GtkWorkarounds.SetSourceScaleWildcarded(source, true); } iconSet.AddSource(source); if (source2x != null) { iconSet.AddSource(source2x); } }
static void AddToIconFactory(string stockId, Gdk.Pixbuf pixbuf, Gtk.IconSize iconSize) { Gtk.IconSet iconSet = iconFactory.Lookup(stockId); if (iconSet == null) { iconSet = new Gtk.IconSet(); iconFactory.Add(stockId, iconSet); } Gtk.IconSource source = new Gtk.IconSource(); source.Pixbuf = pixbuf; source.Size = iconSize; source.SizeWildcarded = iconSize == Gtk.IconSize.Invalid; iconSet.AddSource(source); }
internal static void Initialize(Gtk.Widget iconRenderer) { if ((Stetic.Gui.initialized == false)) { Stetic.Gui.initialized = true; Gtk.IconFactory w1 = new Gtk.IconFactory(); Gtk.IconSet w2 = new Gtk.IconSet(); Gtk.IconSource w3 = new Gtk.IconSource(); w3.Pixbuf = new Gdk.Pixbuf(System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "./res/swap.png")); w2.AddSource(w3); Gtk.IconSource w4 = new Gtk.IconSource(); w4.Pixbuf = new Gdk.Pixbuf(System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "./res/flags/ar.png")); w2.AddSource(w4); Gtk.IconSource w5 = new Gtk.IconSource(); w5.Pixbuf = new Gdk.Pixbuf(System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "./res/flags/bg.png")); w2.AddSource(w5); w1.Add("swap", w2); w1.AddDefault(); } }
static void AddToIconFactory(string stockId, Gdk.Pixbuf pixbuf, Gdk.Pixbuf pixbuf2x, Gtk.IconSize iconSize) { Gtk.IconSet iconSet = iconFactory.Lookup(stockId); if (iconSet == null) { iconSet = new Gtk.IconSet(); iconFactory.Add(stockId, iconSet); } Gtk.IconSource source = new Gtk.IconSource(); Gtk.IconSource source2x = null; source.Pixbuf = pixbuf; source.Size = iconSize; source.SizeWildcarded = iconSize == Gtk.IconSize.Invalid; if (pixbuf2x != null) { if (Mono.TextEditor.GtkWorkarounds.SetSourceScale(source, 1)) { Mono.TextEditor.GtkWorkarounds.SetSourceScaleWildcarded(source, false); source2x = new Gtk.IconSource(); source2x.Pixbuf = pixbuf2x; source2x.Size = iconSize; source2x.SizeWildcarded = iconSize == Gtk.IconSize.Invalid; Mono.TextEditor.GtkWorkarounds.SetSourceScale(source2x, 2); Mono.TextEditor.GtkWorkarounds.SetSourceScaleWildcarded(source2x, false); } } else { Mono.TextEditor.GtkWorkarounds.SetSourceScaleWildcarded(source, true); } iconSet.AddSource(source); if (source2x != null) { iconSet.AddSource(source2x); } }
static void AddToIconFactory (string stockId, Gdk.Pixbuf pixbuf, Gdk.Pixbuf pixbuf2x, Gtk.IconSize iconSize) { Gtk.IconSet iconSet = iconFactory.Lookup (stockId); if (iconSet == null) { iconSet = new Gtk.IconSet (); iconFactory.Add (stockId, iconSet); } Gtk.IconSource source = new Gtk.IconSource (); Gtk.IconSource source2x = null; if (Platform.IsWindows) { var pixel_scale = Mono.TextEditor.GtkWorkarounds.GetPixelScale (); source.Pixbuf = pixbuf.ScaleSimple ((int)(pixbuf.Width * pixel_scale), (int)(pixbuf.Height * pixel_scale), Gdk.InterpType.Bilinear); } else { source.Pixbuf = pixbuf; } source.Size = iconSize; source.SizeWildcarded = iconSize == Gtk.IconSize.Invalid; if (pixbuf2x != null) { if (Mono.TextEditor.GtkWorkarounds.SetSourceScale (source, 1)) { Mono.TextEditor.GtkWorkarounds.SetSourceScaleWildcarded (source, false); source2x = new Gtk.IconSource (); source2x.Pixbuf = pixbuf2x; source2x.Size = iconSize; source2x.SizeWildcarded = iconSize == Gtk.IconSize.Invalid; Mono.TextEditor.GtkWorkarounds.SetSourceScale (source2x, 2); Mono.TextEditor.GtkWorkarounds.SetSourceScaleWildcarded (source2x, false); } } else { Mono.TextEditor.GtkWorkarounds.SetSourceScaleWildcarded (source, true); } iconSet.AddSource (source); if (source2x != null) iconSet.AddSource (source2x); }
internal static void AddToIconFactory(string stockId, Gdk.Pixbuf pixbuf, Gtk.IconSize iconSize) { Gtk.IconSet iconSet = iconFactory.Lookup (stockId); if (iconSet == null) { iconSet = new Gtk.IconSet (); iconFactory.Add (stockId, iconSet); } Gtk.IconSource source = new Gtk.IconSource (); source.Pixbuf = pixbuf; source.Size = iconSize; iconSet.AddSource (source); }
internal static void AddToIconFactory(string stockId, string filename, Gtk.IconSize iconSize) { try { Gtk.IconSet iconSet = iconFactory.Lookup (stockId); if (iconSet == null) { iconSet = new Gtk.IconSet (); iconFactory.Add (stockId, iconSet); } Gtk.IconSource source = new Gtk.IconSource (); source.Filename = Path.GetFullPath (Path.Combine ("../data/resources/icons", filename)); source.Size = iconSize; iconSet.AddSource (source); // FIXME: temporary hack to retrieve the correct icon // from the filename stockMappings.Add (filename, stockId); } catch (GLib.GException ex) { // just discard the exception, the icon simply can't be // loaded Runtime.LoggingService.Info(typeof(ResourceService).ToString(), "Warning: can't load " + filename + " icon file"); } }
public void AddSource(Gtk.IconSource source) { gtk_icon_set_add_source(Handle, source == null ? IntPtr.Zero : source.Handle); }
public Gdk.Pixbuf RenderIconPixbuf(Gtk.IconSource source, Gtk.IconSize size) { return(Render.IconPixbuf(this, source, size)); }
static void AddToIconFactory (string stockId, Gdk.Pixbuf pixbuf, Gdk.Pixbuf pixbuf2x, Gtk.IconSize iconSize) { Gtk.IconSet iconSet = iconFactory.Lookup (stockId); if (iconSet == null) { iconSet = new Gtk.IconSet (); iconFactory.Add (stockId, iconSet); } Gtk.IconSource source = new Gtk.IconSource (); Gtk.IconSource source2x = null; source.Pixbuf = pixbuf; source.Size = iconSize; source.SizeWildcarded = iconSize == Gtk.IconSize.Invalid; if (pixbuf2x != null) { if (Mono.TextEditor.GtkWorkarounds.SetSourceScale (source, 1)) { Mono.TextEditor.GtkWorkarounds.SetSourceScaleWildcarded (source, false); source2x = new Gtk.IconSource (); source2x.Pixbuf = pixbuf2x; source2x.Size = iconSize; source2x.SizeWildcarded = iconSize == Gtk.IconSize.Invalid; Mono.TextEditor.GtkWorkarounds.SetSourceScale (source2x, 2); Mono.TextEditor.GtkWorkarounds.SetSourceScaleWildcarded (source2x, false); } } else { Mono.TextEditor.GtkWorkarounds.SetSourceScaleWildcarded (source, true); } iconSet.AddSource (source); if (source2x != null) iconSet.AddSource (source2x); }