コード例 #1
0
        public Gtk.IconInfo LookupByGiconForScale(GLib.IIcon icon, int size, int scale, Gtk.IconLookupFlags flags)
        {
            IntPtr raw_ret = gtk_icon_theme_lookup_by_gicon_for_scale(Handle, icon == null ? IntPtr.Zero : ((icon is GLib.Object) ? (icon as GLib.Object).Handle : (icon as GLib.IconAdapter).Handle), size, scale, (int)flags);

            Gtk.IconInfo ret = GLib.Object.GetObject(raw_ret) as Gtk.IconInfo;
            return(ret);
        }
コード例 #2
0
        public Gtk.IconInfo Copy()
        {
            IntPtr raw_ret = gtk_icon_info_copy(Handle);

            Gtk.IconInfo ret = GLib.Object.GetObject(raw_ret, true) as Gtk.IconInfo;
            return(ret);
        }
コード例 #3
0
        public Gtk.IconInfo LookupIconForScale(string icon_name, int size, int scale, Gtk.IconLookupFlags flags)
        {
            IntPtr native_icon_name = GLib.Marshaller.StringToPtrGStrdup(icon_name);
            IntPtr raw_ret          = gtk_icon_theme_lookup_icon_for_scale(Handle, native_icon_name, size, scale, (int)flags);

            Gtk.IconInfo ret = GLib.Object.GetObject(raw_ret) as Gtk.IconInfo;
            GLib.Marshaller.Free(native_icon_name);
            return(ret);
        }
コード例 #4
0
 public static Gtk.IconInfo IconThemeLookUpByGIcon(Gtk.IconTheme theme, GLib.Icon icon, int size, int flags)
 {
     return(NativeHelper <Gtk.IconInfo> (() =>
     {
         IntPtr raw_ret = gtk_icon_theme_lookup_by_gicon(theme.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 = raw_ret == IntPtr.Zero ? null : (Gtk.IconInfo)GLib.Opaque.GetOpaque(raw_ret, typeof(Gtk.IconInfo), true);
         return ret;
     }, null, GTK_NOT_FOUND,
                                         "Failed to lookup by GIcon: {0}"));
 }
コード例 #5
0
        public IconEmblem(int position, GLib.Icon icon, int size)
        {
            Position = position;
            IconSize = size;
            Gtk.IconInfo info = Gtk.IconTheme.Default.LookupByGIcon(icon, size, Gtk.IconLookupFlags.GenericFallback);
            if (info == null)
            {
                Log <IconEmblem> .Warn("IconInfo lookup failed, using fallback of '{0}'", Gtk.Stock.Cancel);

                Icon = Gtk.Stock.Cancel;
                return;
            }
            ForcePixbuf = info.LoadIcon();
        }
コード例 #6
0
        public Gtk.IconInfo ChooseIconForScale(string[] icon_names, int size, int scale, Gtk.IconLookupFlags flags)
        {
            int cnt_icon_names = icon_names == null ? 0 : icon_names.Length;

            IntPtr[] native_icon_names = new IntPtr [cnt_icon_names];
            for (int i = 0; i < cnt_icon_names; i++)
            {
                native_icon_names [i] = GLib.Marshaller.StringToPtrGStrdup(icon_names[i]);
            }
            IntPtr raw_ret = gtk_icon_theme_choose_icon_for_scale(Handle, native_icon_names, size, scale, (int)flags);

            Gtk.IconInfo ret = GLib.Object.GetObject(raw_ret) as Gtk.IconInfo;
            for (int i = 0; i < native_icon_names.Length; i++)
            {
                icon_names [i] = GLib.Marshaller.Utf8PtrToString(native_icon_names[i]);
                GLib.Marshaller.Free(native_icon_names[i]);
            }
            return(ret);
        }
コード例 #7
0
		public static Gdk.Pixbuf LoadMimeIcon (string mimetype, int size)
		{
			Gtk.IconTheme icon_theme = Gtk.IconTheme.Default;
			Gnome.IconLookupResultFlags result;

			// FIXME when ximian bug #76540 is fixed
			// change "new Gnome.Vfs.FileInfo (IntPtr.Zero)" to "null"
			string icon_name = Gnome.Icon.Lookup (icon_theme, null, null, null, new Gnome.Vfs.FileInfo (IntPtr.Zero), mimetype, (Gnome.IconLookupFlags) 0, out result);

			if (icon_name == null)
				return null;

			Gtk.IconInfo icon_info = icon_theme.LookupIcon (icon_name, size, 0);

			if (icon_info == null)
				return null;
			try {
				return icon_info.LoadIcon ();
			} catch (System.Exception e) {
				System.Console.Write (e.ToString ());
			}
			return null;
		}