public Gtk.IconInfo LookupIcon(GLib.IIcon icon, int size, Gtk.IconLookupFlags flags) { IntPtr raw_ret = gtk_icon_theme_lookup_by_gicon(Handle, icon == null ? IntPtr.Zero : ((icon is GLib.Object) ? (icon as GLib.Object).Handle : (icon as GLib.IconAdapter).Handle), size, (int)flags); Gtk.IconInfo ret = GLib.Object.GetObject(raw_ret, true) as Gtk.IconInfo; return(ret); }
public Gtk.IconInfo LookupIcon(string icon_name, int size, Gtk.IconLookupFlags flags) { IntPtr native_icon_name = GLib.Marshaller.StringToPtrGStrdup(icon_name); IntPtr raw_ret = gtk_icon_theme_lookup_icon(Handle, native_icon_name, size, (int)flags); Gtk.IconInfo ret = GLib.Object.GetObject(raw_ret, true) as Gtk.IconInfo; GLib.Marshaller.Free(native_icon_name); return(ret); }
public unsafe Gdk.Pixbuf LoadIcon(string icon_name, int size, Gtk.IconLookupFlags flags) { IntPtr native_icon_name = GLib.Marshaller.StringToPtrGStrdup(icon_name); IntPtr error = IntPtr.Zero; IntPtr raw_ret = gtk_icon_theme_load_icon(Handle, native_icon_name, size, (int)flags, out error); Gdk.Pixbuf ret = GLib.Object.GetObject(raw_ret, true) as Gdk.Pixbuf; GLib.Marshaller.Free(native_icon_name); if (error != IntPtr.Zero) { throw new GLib.GException(error); } return(ret); }
public Gtk.IconInfo ChooseIcon(string[] icon_names, int size, Gtk.IconLookupFlags flags) { int cnt_icon_names = icon_names == null ? 0 : icon_names.Length; IntPtr[] native_icon_names = new IntPtr [cnt_icon_names + 1]; for (int i = 0; i < cnt_icon_names; i++) { native_icon_names [i] = GLib.Marshaller.StringToPtrGStrdup(icon_names[i]); } native_icon_names [cnt_icon_names] = IntPtr.Zero; IntPtr raw_ret = gtk_icon_theme_choose_icon(Handle, native_icon_names, size, (int)flags); Gtk.IconInfo ret = GLib.Object.GetObject(raw_ret) as Gtk.IconInfo; for (int i = 0; i < native_icon_names.Length - 1; i++) { icon_names [i] = GLib.Marshaller.Utf8PtrToString(native_icon_names[i]); GLib.Marshaller.Free(native_icon_names[i]); } return(ret); }
public unsafe Cairo.Surface LoadSurface(string icon_name, int size, int scale, Gdk.Window for_window, Gtk.IconLookupFlags flags) { IntPtr native_icon_name = GLib.Marshaller.StringToPtrGStrdup(icon_name); IntPtr error = IntPtr.Zero; IntPtr raw_ret = gtk_icon_theme_load_surface(Handle, native_icon_name, size, scale, for_window == null ? IntPtr.Zero : for_window.Handle, (int)flags, out error); Cairo.Surface ret = Cairo.Surface.Lookup(raw_ret, true); GLib.Marshaller.Free(native_icon_name); if (error != IntPtr.Zero) { throw new GLib.GException(error); } return(ret); }
public static Gdk.Pixbuf TryLoadIcon(Gtk.IconTheme theme, string icon_name, int size, Gtk.IconLookupFlags flags) { try { return(theme.LoadIcon(icon_name, size, flags)); } catch { try { return(theme.LoadIcon("gtk-missing-image", size, flags)); } catch { return(null); } } }
public static Gdk.Pixbuf TryLoadIcon(Gtk.IconTheme theme, string[] names, int size, Gtk.IconLookupFlags flags) { try { var info = theme.ChooseIcon(names, size, flags); return(info.LoadIcon()); } catch { try { return(theme.LoadIcon("gtk-missing-image", size, flags)); } catch { return(null); } } }