コード例 #1
0
        public Gtk.Widget GetVisualizerWidget(ObjectValue val)
        {
            Gdk.Pixbuf pixbuf;
            string     file = Path.GetTempFileName();

            try {
                RawValue pix = (RawValue)val.GetRawValue();
                pix.CallMethod("Save", file, "png");
                pixbuf = new Gdk.Pixbuf(file);
            } finally {
                File.Delete(file);
            }
            Gtk.ScrolledWindow sc = new Gtk.ScrolledWindow();
            sc.ShadowType       = Gtk.ShadowType.In;
            sc.HscrollbarPolicy = Gtk.PolicyType.Automatic;
            sc.VscrollbarPolicy = Gtk.PolicyType.Automatic;
            Gtk.Image image = new Gtk.Image(pixbuf);
            sc.AddWithViewport(image);
            sc.ShowAll();
            return(sc);
        }