2003-10-30 Daniel Kornhauser Eisenberg <dkor@alum.mit.edu>
* sample/GtkDemo/DemoApplicationWindow.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoButtonBox.cs : New sample,
* sample/GtkDemo/DemoColorSelection.cs : New sample,
* sample/GtkDemo/DemoDialog.cs : New sample,
* sample/GtkDemo/DemoDrawingArea.cs : New sample,
* sample/GtkDemo/DemoEditableCells.cs : New sample, Needs clean up
* sample/GtkDemo/DemoImages.cs : New sample, Unfinished, 75% Done
* sample/GtkDemo/DemoItemFactory.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoListStore.cs : New sample,
* sample/GtkDemo/DemoMain.cs : New sample, Unifnished, 60% Done
* sample/GtkDemo/DemoMenus.cs : New sample,
* sample/GtkDemo/DemoPanes.cs : New sample,
* sample/GtkDemo/DemoPixbuf.cs : New sample, Needs clean up
* sample/GtkDemo/DemoSizeGroup.cs : New sample,
* sample/GtkDemo/DemoStockBrowser.cs : New sample, Unfinished, 20% Done
* sample/GtkDemo/DemoTextView.cs : New sample, Unfinished, 99% Done
* sample/GtkDemo/DemoTreeStore.cs : New sample, Unfinished, 95% Done
* sample/GtkDemo/images : Several Images for the samples
* sample/GtkDemo/Makefile : Very simple Makefile
* sample/GtkDemo/README : Mentions explicitely unfinished state of port
svn path=/trunk/gtk-sharp/; revision=19489
2003-10-30 23:57:41 +00:00
|
|
|
//
|
|
|
|
// DemoImages.cs - port of images.c gtk-demo
|
|
|
|
//
|
|
|
|
// Author: Daniel Kornhauser <dkor@alum.mit.edu>
|
|
|
|
//
|
|
|
|
// Copyright (C) 2003, Ximian Inc.
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
/* Images
|
|
|
|
*
|
|
|
|
* Gtk.Image is used to display an image; the image can be in a number of formats.
|
|
|
|
* Typically, you load an image into a Gdk.Pixbuf, then display the pixbuf.
|
|
|
|
*
|
|
|
|
* This demo code shows some of the more obscure cases, in the simple
|
|
|
|
* case a call to the constructor Gtk.Image (string filename) is all you need.
|
|
|
|
*
|
|
|
|
* If you want to put image data in your program compile it in as a resource.
|
|
|
|
* This way you will not need to depend on loading external files, your
|
|
|
|
* application binary can be self-contained.
|
|
|
|
*/
|
|
|
|
|
|
|
|
// TODO:
|
|
|
|
// Finish implementing the callback, I can't get the image
|
|
|
|
// to show up, and I'm stuck in the ProgressivePreparedCallback
|
|
|
|
// because I can't get a white background to appear
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.IO;
|
2004-08-27 19:16:13 +00:00
|
|
|
using System.Reflection;
|
2003-10-30 Daniel Kornhauser Eisenberg <dkor@alum.mit.edu>
* sample/GtkDemo/DemoApplicationWindow.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoButtonBox.cs : New sample,
* sample/GtkDemo/DemoColorSelection.cs : New sample,
* sample/GtkDemo/DemoDialog.cs : New sample,
* sample/GtkDemo/DemoDrawingArea.cs : New sample,
* sample/GtkDemo/DemoEditableCells.cs : New sample, Needs clean up
* sample/GtkDemo/DemoImages.cs : New sample, Unfinished, 75% Done
* sample/GtkDemo/DemoItemFactory.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoListStore.cs : New sample,
* sample/GtkDemo/DemoMain.cs : New sample, Unifnished, 60% Done
* sample/GtkDemo/DemoMenus.cs : New sample,
* sample/GtkDemo/DemoPanes.cs : New sample,
* sample/GtkDemo/DemoPixbuf.cs : New sample, Needs clean up
* sample/GtkDemo/DemoSizeGroup.cs : New sample,
* sample/GtkDemo/DemoStockBrowser.cs : New sample, Unfinished, 20% Done
* sample/GtkDemo/DemoTextView.cs : New sample, Unfinished, 99% Done
* sample/GtkDemo/DemoTreeStore.cs : New sample, Unfinished, 95% Done
* sample/GtkDemo/images : Several Images for the samples
* sample/GtkDemo/Makefile : Very simple Makefile
* sample/GtkDemo/README : Mentions explicitely unfinished state of port
svn path=/trunk/gtk-sharp/; revision=19489
2003-10-30 23:57:41 +00:00
|
|
|
|
|
|
|
using Gtk;
|
|
|
|
using Gdk;
|
|
|
|
|
2004-08-07 17:06:29 +00:00
|
|
|
namespace GtkDemo
|
|
|
|
{
|
2004-12-12 22:11:44 +00:00
|
|
|
[Demo ("Images", "DemoImages.cs")]
|
2004-08-07 17:06:29 +00:00
|
|
|
public class DemoImages : Gtk.Window
|
2003-10-30 Daniel Kornhauser Eisenberg <dkor@alum.mit.edu>
* sample/GtkDemo/DemoApplicationWindow.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoButtonBox.cs : New sample,
* sample/GtkDemo/DemoColorSelection.cs : New sample,
* sample/GtkDemo/DemoDialog.cs : New sample,
* sample/GtkDemo/DemoDrawingArea.cs : New sample,
* sample/GtkDemo/DemoEditableCells.cs : New sample, Needs clean up
* sample/GtkDemo/DemoImages.cs : New sample, Unfinished, 75% Done
* sample/GtkDemo/DemoItemFactory.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoListStore.cs : New sample,
* sample/GtkDemo/DemoMain.cs : New sample, Unifnished, 60% Done
* sample/GtkDemo/DemoMenus.cs : New sample,
* sample/GtkDemo/DemoPanes.cs : New sample,
* sample/GtkDemo/DemoPixbuf.cs : New sample, Needs clean up
* sample/GtkDemo/DemoSizeGroup.cs : New sample,
* sample/GtkDemo/DemoStockBrowser.cs : New sample, Unfinished, 20% Done
* sample/GtkDemo/DemoTextView.cs : New sample, Unfinished, 99% Done
* sample/GtkDemo/DemoTreeStore.cs : New sample, Unfinished, 95% Done
* sample/GtkDemo/images : Several Images for the samples
* sample/GtkDemo/Makefile : Very simple Makefile
* sample/GtkDemo/README : Mentions explicitely unfinished state of port
svn path=/trunk/gtk-sharp/; revision=19489
2003-10-30 23:57:41 +00:00
|
|
|
{
|
2004-11-30 21:13:42 +00:00
|
|
|
private Gtk.Image progressiveImage;
|
2003-10-30 Daniel Kornhauser Eisenberg <dkor@alum.mit.edu>
* sample/GtkDemo/DemoApplicationWindow.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoButtonBox.cs : New sample,
* sample/GtkDemo/DemoColorSelection.cs : New sample,
* sample/GtkDemo/DemoDialog.cs : New sample,
* sample/GtkDemo/DemoDrawingArea.cs : New sample,
* sample/GtkDemo/DemoEditableCells.cs : New sample, Needs clean up
* sample/GtkDemo/DemoImages.cs : New sample, Unfinished, 75% Done
* sample/GtkDemo/DemoItemFactory.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoListStore.cs : New sample,
* sample/GtkDemo/DemoMain.cs : New sample, Unifnished, 60% Done
* sample/GtkDemo/DemoMenus.cs : New sample,
* sample/GtkDemo/DemoPanes.cs : New sample,
* sample/GtkDemo/DemoPixbuf.cs : New sample, Needs clean up
* sample/GtkDemo/DemoSizeGroup.cs : New sample,
* sample/GtkDemo/DemoStockBrowser.cs : New sample, Unfinished, 20% Done
* sample/GtkDemo/DemoTextView.cs : New sample, Unfinished, 99% Done
* sample/GtkDemo/DemoTreeStore.cs : New sample, Unfinished, 95% Done
* sample/GtkDemo/images : Several Images for the samples
* sample/GtkDemo/Makefile : Very simple Makefile
* sample/GtkDemo/README : Mentions explicitely unfinished state of port
svn path=/trunk/gtk-sharp/; revision=19489
2003-10-30 23:57:41 +00:00
|
|
|
private VBox vbox;
|
2004-08-08 18:30:25 +00:00
|
|
|
BinaryReader imageStream;
|
2004-08-07 17:06:29 +00:00
|
|
|
|
|
|
|
public DemoImages () : base ("images")
|
2003-10-30 Daniel Kornhauser Eisenberg <dkor@alum.mit.edu>
* sample/GtkDemo/DemoApplicationWindow.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoButtonBox.cs : New sample,
* sample/GtkDemo/DemoColorSelection.cs : New sample,
* sample/GtkDemo/DemoDialog.cs : New sample,
* sample/GtkDemo/DemoDrawingArea.cs : New sample,
* sample/GtkDemo/DemoEditableCells.cs : New sample, Needs clean up
* sample/GtkDemo/DemoImages.cs : New sample, Unfinished, 75% Done
* sample/GtkDemo/DemoItemFactory.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoListStore.cs : New sample,
* sample/GtkDemo/DemoMain.cs : New sample, Unifnished, 60% Done
* sample/GtkDemo/DemoMenus.cs : New sample,
* sample/GtkDemo/DemoPanes.cs : New sample,
* sample/GtkDemo/DemoPixbuf.cs : New sample, Needs clean up
* sample/GtkDemo/DemoSizeGroup.cs : New sample,
* sample/GtkDemo/DemoStockBrowser.cs : New sample, Unfinished, 20% Done
* sample/GtkDemo/DemoTextView.cs : New sample, Unfinished, 99% Done
* sample/GtkDemo/DemoTreeStore.cs : New sample, Unfinished, 95% Done
* sample/GtkDemo/images : Several Images for the samples
* sample/GtkDemo/Makefile : Very simple Makefile
* sample/GtkDemo/README : Mentions explicitely unfinished state of port
svn path=/trunk/gtk-sharp/; revision=19489
2003-10-30 23:57:41 +00:00
|
|
|
{
|
2004-08-07 17:06:29 +00:00
|
|
|
this.DeleteEvent += new DeleteEventHandler (WindowDelete);
|
|
|
|
this.BorderWidth = 8;
|
2003-10-30 Daniel Kornhauser Eisenberg <dkor@alum.mit.edu>
* sample/GtkDemo/DemoApplicationWindow.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoButtonBox.cs : New sample,
* sample/GtkDemo/DemoColorSelection.cs : New sample,
* sample/GtkDemo/DemoDialog.cs : New sample,
* sample/GtkDemo/DemoDrawingArea.cs : New sample,
* sample/GtkDemo/DemoEditableCells.cs : New sample, Needs clean up
* sample/GtkDemo/DemoImages.cs : New sample, Unfinished, 75% Done
* sample/GtkDemo/DemoItemFactory.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoListStore.cs : New sample,
* sample/GtkDemo/DemoMain.cs : New sample, Unifnished, 60% Done
* sample/GtkDemo/DemoMenus.cs : New sample,
* sample/GtkDemo/DemoPanes.cs : New sample,
* sample/GtkDemo/DemoPixbuf.cs : New sample, Needs clean up
* sample/GtkDemo/DemoSizeGroup.cs : New sample,
* sample/GtkDemo/DemoStockBrowser.cs : New sample, Unfinished, 20% Done
* sample/GtkDemo/DemoTextView.cs : New sample, Unfinished, 99% Done
* sample/GtkDemo/DemoTreeStore.cs : New sample, Unfinished, 95% Done
* sample/GtkDemo/images : Several Images for the samples
* sample/GtkDemo/Makefile : Very simple Makefile
* sample/GtkDemo/README : Mentions explicitely unfinished state of port
svn path=/trunk/gtk-sharp/; revision=19489
2003-10-30 23:57:41 +00:00
|
|
|
|
|
|
|
vbox = new VBox (false, 8);
|
|
|
|
vbox.BorderWidth = 8;
|
2004-08-07 17:06:29 +00:00
|
|
|
this.Add (vbox);
|
2003-10-30 Daniel Kornhauser Eisenberg <dkor@alum.mit.edu>
* sample/GtkDemo/DemoApplicationWindow.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoButtonBox.cs : New sample,
* sample/GtkDemo/DemoColorSelection.cs : New sample,
* sample/GtkDemo/DemoDialog.cs : New sample,
* sample/GtkDemo/DemoDrawingArea.cs : New sample,
* sample/GtkDemo/DemoEditableCells.cs : New sample, Needs clean up
* sample/GtkDemo/DemoImages.cs : New sample, Unfinished, 75% Done
* sample/GtkDemo/DemoItemFactory.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoListStore.cs : New sample,
* sample/GtkDemo/DemoMain.cs : New sample, Unifnished, 60% Done
* sample/GtkDemo/DemoMenus.cs : New sample,
* sample/GtkDemo/DemoPanes.cs : New sample,
* sample/GtkDemo/DemoPixbuf.cs : New sample, Needs clean up
* sample/GtkDemo/DemoSizeGroup.cs : New sample,
* sample/GtkDemo/DemoStockBrowser.cs : New sample, Unfinished, 20% Done
* sample/GtkDemo/DemoTextView.cs : New sample, Unfinished, 99% Done
* sample/GtkDemo/DemoTreeStore.cs : New sample, Unfinished, 95% Done
* sample/GtkDemo/images : Several Images for the samples
* sample/GtkDemo/Makefile : Very simple Makefile
* sample/GtkDemo/README : Mentions explicitely unfinished state of port
svn path=/trunk/gtk-sharp/; revision=19489
2003-10-30 23:57:41 +00:00
|
|
|
|
|
|
|
Gtk.Label label = new Gtk.Label ("<u>Image loaded from a file</u>");
|
|
|
|
label.UseMarkup = true;
|
|
|
|
vbox.PackStart (label, false, false, 0);
|
|
|
|
|
|
|
|
Gtk.Frame frame = new Gtk.Frame ();
|
|
|
|
frame.ShadowType = ShadowType.In;
|
|
|
|
|
|
|
|
// The alignment keeps the frame from growing when users resize
|
|
|
|
// the window
|
|
|
|
Alignment alignment = new Alignment (0.5f, 0.5f, 0f, 0f);
|
|
|
|
alignment.Add (frame);
|
|
|
|
vbox.PackStart (alignment, false, false, 0);
|
|
|
|
|
2004-08-27 19:16:13 +00:00
|
|
|
Gtk.Image image = new Gtk.Image (Gdk.Pixbuf.LoadFromResource ("gtk-logo-rgb.gif"));
|
2003-10-30 Daniel Kornhauser Eisenberg <dkor@alum.mit.edu>
* sample/GtkDemo/DemoApplicationWindow.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoButtonBox.cs : New sample,
* sample/GtkDemo/DemoColorSelection.cs : New sample,
* sample/GtkDemo/DemoDialog.cs : New sample,
* sample/GtkDemo/DemoDrawingArea.cs : New sample,
* sample/GtkDemo/DemoEditableCells.cs : New sample, Needs clean up
* sample/GtkDemo/DemoImages.cs : New sample, Unfinished, 75% Done
* sample/GtkDemo/DemoItemFactory.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoListStore.cs : New sample,
* sample/GtkDemo/DemoMain.cs : New sample, Unifnished, 60% Done
* sample/GtkDemo/DemoMenus.cs : New sample,
* sample/GtkDemo/DemoPanes.cs : New sample,
* sample/GtkDemo/DemoPixbuf.cs : New sample, Needs clean up
* sample/GtkDemo/DemoSizeGroup.cs : New sample,
* sample/GtkDemo/DemoStockBrowser.cs : New sample, Unfinished, 20% Done
* sample/GtkDemo/DemoTextView.cs : New sample, Unfinished, 99% Done
* sample/GtkDemo/DemoTreeStore.cs : New sample, Unfinished, 95% Done
* sample/GtkDemo/images : Several Images for the samples
* sample/GtkDemo/Makefile : Very simple Makefile
* sample/GtkDemo/README : Mentions explicitely unfinished state of port
svn path=/trunk/gtk-sharp/; revision=19489
2003-10-30 23:57:41 +00:00
|
|
|
frame.Add (image);
|
|
|
|
|
|
|
|
// Animation
|
|
|
|
label = new Gtk.Label ("<u>Animation loaded from a file</u>");
|
|
|
|
label.UseMarkup = true;
|
|
|
|
vbox.PackStart (label);
|
|
|
|
|
|
|
|
frame = new Gtk.Frame ();
|
|
|
|
frame.ShadowType = ShadowType.In;
|
|
|
|
|
|
|
|
alignment = new Alignment (0.5f, 0.5f, 0f, 0f);
|
|
|
|
alignment.Add (frame);
|
|
|
|
vbox.PackStart (alignment, false, false, 0);
|
|
|
|
|
2004-08-27 19:16:13 +00:00
|
|
|
image = new Gtk.Image (Gdk.Pixbuf.LoadFromResource ("floppybuddy.gif"));
|
2003-10-30 Daniel Kornhauser Eisenberg <dkor@alum.mit.edu>
* sample/GtkDemo/DemoApplicationWindow.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoButtonBox.cs : New sample,
* sample/GtkDemo/DemoColorSelection.cs : New sample,
* sample/GtkDemo/DemoDialog.cs : New sample,
* sample/GtkDemo/DemoDrawingArea.cs : New sample,
* sample/GtkDemo/DemoEditableCells.cs : New sample, Needs clean up
* sample/GtkDemo/DemoImages.cs : New sample, Unfinished, 75% Done
* sample/GtkDemo/DemoItemFactory.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoListStore.cs : New sample,
* sample/GtkDemo/DemoMain.cs : New sample, Unifnished, 60% Done
* sample/GtkDemo/DemoMenus.cs : New sample,
* sample/GtkDemo/DemoPanes.cs : New sample,
* sample/GtkDemo/DemoPixbuf.cs : New sample, Needs clean up
* sample/GtkDemo/DemoSizeGroup.cs : New sample,
* sample/GtkDemo/DemoStockBrowser.cs : New sample, Unfinished, 20% Done
* sample/GtkDemo/DemoTextView.cs : New sample, Unfinished, 99% Done
* sample/GtkDemo/DemoTreeStore.cs : New sample, Unfinished, 95% Done
* sample/GtkDemo/images : Several Images for the samples
* sample/GtkDemo/Makefile : Very simple Makefile
* sample/GtkDemo/README : Mentions explicitely unfinished state of port
svn path=/trunk/gtk-sharp/; revision=19489
2003-10-30 23:57:41 +00:00
|
|
|
frame.Add (image);
|
|
|
|
|
|
|
|
// Progressive
|
|
|
|
label = new Gtk.Label ("<u>Progressive image loading</u>");
|
|
|
|
label.UseMarkup = true;
|
|
|
|
vbox.PackStart (label);
|
|
|
|
|
|
|
|
frame = new Gtk.Frame ();
|
|
|
|
frame.ShadowType = ShadowType.In;
|
|
|
|
|
|
|
|
alignment = new Alignment (0.5f, 0.5f, 0f, 0f);
|
|
|
|
alignment.Add (frame);
|
|
|
|
vbox.PackStart (alignment, false, false, 0);
|
|
|
|
|
|
|
|
// Create an empty image for now; the progressive loader
|
|
|
|
// will create the pixbuf and fill it in.
|
|
|
|
//
|
|
|
|
|
|
|
|
progressiveImage = new Gtk.Image ();
|
|
|
|
frame.Add (progressiveImage);
|
|
|
|
|
|
|
|
StartProgressiveLoading ();
|
|
|
|
|
|
|
|
// Sensitivity control
|
|
|
|
Gtk.ToggleButton button = new Gtk.ToggleButton ("_Insensitive");
|
|
|
|
vbox.PackStart (button, false, false, 0);
|
|
|
|
button.Toggled += new EventHandler (ToggleSensitivity);
|
|
|
|
|
2004-08-07 17:06:29 +00:00
|
|
|
this.ShowAll ();
|
2003-10-30 Daniel Kornhauser Eisenberg <dkor@alum.mit.edu>
* sample/GtkDemo/DemoApplicationWindow.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoButtonBox.cs : New sample,
* sample/GtkDemo/DemoColorSelection.cs : New sample,
* sample/GtkDemo/DemoDialog.cs : New sample,
* sample/GtkDemo/DemoDrawingArea.cs : New sample,
* sample/GtkDemo/DemoEditableCells.cs : New sample, Needs clean up
* sample/GtkDemo/DemoImages.cs : New sample, Unfinished, 75% Done
* sample/GtkDemo/DemoItemFactory.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoListStore.cs : New sample,
* sample/GtkDemo/DemoMain.cs : New sample, Unifnished, 60% Done
* sample/GtkDemo/DemoMenus.cs : New sample,
* sample/GtkDemo/DemoPanes.cs : New sample,
* sample/GtkDemo/DemoPixbuf.cs : New sample, Needs clean up
* sample/GtkDemo/DemoSizeGroup.cs : New sample,
* sample/GtkDemo/DemoStockBrowser.cs : New sample, Unfinished, 20% Done
* sample/GtkDemo/DemoTextView.cs : New sample, Unfinished, 99% Done
* sample/GtkDemo/DemoTreeStore.cs : New sample, Unfinished, 95% Done
* sample/GtkDemo/images : Several Images for the samples
* sample/GtkDemo/Makefile : Very simple Makefile
* sample/GtkDemo/README : Mentions explicitely unfinished state of port
svn path=/trunk/gtk-sharp/; revision=19489
2003-10-30 23:57:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private void WindowDelete (object o, DeleteEventArgs args)
|
|
|
|
{
|
2004-08-07 17:06:29 +00:00
|
|
|
this.Hide ();
|
|
|
|
this.Destroy ();
|
|
|
|
args.RetVal = true;
|
2003-10-30 Daniel Kornhauser Eisenberg <dkor@alum.mit.edu>
* sample/GtkDemo/DemoApplicationWindow.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoButtonBox.cs : New sample,
* sample/GtkDemo/DemoColorSelection.cs : New sample,
* sample/GtkDemo/DemoDialog.cs : New sample,
* sample/GtkDemo/DemoDrawingArea.cs : New sample,
* sample/GtkDemo/DemoEditableCells.cs : New sample, Needs clean up
* sample/GtkDemo/DemoImages.cs : New sample, Unfinished, 75% Done
* sample/GtkDemo/DemoItemFactory.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoListStore.cs : New sample,
* sample/GtkDemo/DemoMain.cs : New sample, Unifnished, 60% Done
* sample/GtkDemo/DemoMenus.cs : New sample,
* sample/GtkDemo/DemoPanes.cs : New sample,
* sample/GtkDemo/DemoPixbuf.cs : New sample, Needs clean up
* sample/GtkDemo/DemoSizeGroup.cs : New sample,
* sample/GtkDemo/DemoStockBrowser.cs : New sample, Unfinished, 20% Done
* sample/GtkDemo/DemoTextView.cs : New sample, Unfinished, 99% Done
* sample/GtkDemo/DemoTreeStore.cs : New sample, Unfinished, 95% Done
* sample/GtkDemo/images : Several Images for the samples
* sample/GtkDemo/Makefile : Very simple Makefile
* sample/GtkDemo/README : Mentions explicitely unfinished state of port
svn path=/trunk/gtk-sharp/; revision=19489
2003-10-30 23:57:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private void ToggleSensitivity (object o, EventArgs args)
|
|
|
|
{
|
2004-02-12 03:56:13 +00:00
|
|
|
Widget[] children = vbox.Children;
|
2003-10-30 Daniel Kornhauser Eisenberg <dkor@alum.mit.edu>
* sample/GtkDemo/DemoApplicationWindow.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoButtonBox.cs : New sample,
* sample/GtkDemo/DemoColorSelection.cs : New sample,
* sample/GtkDemo/DemoDialog.cs : New sample,
* sample/GtkDemo/DemoDrawingArea.cs : New sample,
* sample/GtkDemo/DemoEditableCells.cs : New sample, Needs clean up
* sample/GtkDemo/DemoImages.cs : New sample, Unfinished, 75% Done
* sample/GtkDemo/DemoItemFactory.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoListStore.cs : New sample,
* sample/GtkDemo/DemoMain.cs : New sample, Unifnished, 60% Done
* sample/GtkDemo/DemoMenus.cs : New sample,
* sample/GtkDemo/DemoPanes.cs : New sample,
* sample/GtkDemo/DemoPixbuf.cs : New sample, Needs clean up
* sample/GtkDemo/DemoSizeGroup.cs : New sample,
* sample/GtkDemo/DemoStockBrowser.cs : New sample, Unfinished, 20% Done
* sample/GtkDemo/DemoTextView.cs : New sample, Unfinished, 99% Done
* sample/GtkDemo/DemoTreeStore.cs : New sample, Unfinished, 95% Done
* sample/GtkDemo/images : Several Images for the samples
* sample/GtkDemo/Makefile : Very simple Makefile
* sample/GtkDemo/README : Mentions explicitely unfinished state of port
svn path=/trunk/gtk-sharp/; revision=19489
2003-10-30 23:57:41 +00:00
|
|
|
foreach (Widget widget in children)
|
|
|
|
/* don't disable our toggle */
|
|
|
|
if (widget.GetType () != o.GetType () )
|
|
|
|
widget.Sensitive = !widget.Sensitive;
|
|
|
|
}
|
|
|
|
|
|
|
|
private uint timeout_id;
|
|
|
|
private void StartProgressiveLoading ()
|
|
|
|
{
|
|
|
|
/* This is obviously totally contrived (we slow down loading
|
|
|
|
* on purpose to show how incremental loading works).
|
|
|
|
* The real purpose of incremental loading is the case where
|
|
|
|
* you are reading data from a slow source such as the network.
|
|
|
|
* The timeout simply simulates a slow data source by inserting
|
|
|
|
* pauses in the reading process.
|
|
|
|
*/
|
2004-08-08 18:30:25 +00:00
|
|
|
timeout_id = GLib.Timeout.Add (150, new GLib.TimeoutHandler (ProgressiveTimeout));
|
2003-10-30 Daniel Kornhauser Eisenberg <dkor@alum.mit.edu>
* sample/GtkDemo/DemoApplicationWindow.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoButtonBox.cs : New sample,
* sample/GtkDemo/DemoColorSelection.cs : New sample,
* sample/GtkDemo/DemoDialog.cs : New sample,
* sample/GtkDemo/DemoDrawingArea.cs : New sample,
* sample/GtkDemo/DemoEditableCells.cs : New sample, Needs clean up
* sample/GtkDemo/DemoImages.cs : New sample, Unfinished, 75% Done
* sample/GtkDemo/DemoItemFactory.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoListStore.cs : New sample,
* sample/GtkDemo/DemoMain.cs : New sample, Unifnished, 60% Done
* sample/GtkDemo/DemoMenus.cs : New sample,
* sample/GtkDemo/DemoPanes.cs : New sample,
* sample/GtkDemo/DemoPixbuf.cs : New sample, Needs clean up
* sample/GtkDemo/DemoSizeGroup.cs : New sample,
* sample/GtkDemo/DemoStockBrowser.cs : New sample, Unfinished, 20% Done
* sample/GtkDemo/DemoTextView.cs : New sample, Unfinished, 99% Done
* sample/GtkDemo/DemoTreeStore.cs : New sample, Unfinished, 95% Done
* sample/GtkDemo/images : Several Images for the samples
* sample/GtkDemo/Makefile : Very simple Makefile
* sample/GtkDemo/README : Mentions explicitely unfinished state of port
svn path=/trunk/gtk-sharp/; revision=19489
2003-10-30 23:57:41 +00:00
|
|
|
}
|
|
|
|
|
2004-11-30 21:13:42 +00:00
|
|
|
Gdk.PixbufLoader pixbufLoader;
|
2003-10-30 Daniel Kornhauser Eisenberg <dkor@alum.mit.edu>
* sample/GtkDemo/DemoApplicationWindow.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoButtonBox.cs : New sample,
* sample/GtkDemo/DemoColorSelection.cs : New sample,
* sample/GtkDemo/DemoDialog.cs : New sample,
* sample/GtkDemo/DemoDrawingArea.cs : New sample,
* sample/GtkDemo/DemoEditableCells.cs : New sample, Needs clean up
* sample/GtkDemo/DemoImages.cs : New sample, Unfinished, 75% Done
* sample/GtkDemo/DemoItemFactory.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoListStore.cs : New sample,
* sample/GtkDemo/DemoMain.cs : New sample, Unifnished, 60% Done
* sample/GtkDemo/DemoMenus.cs : New sample,
* sample/GtkDemo/DemoPanes.cs : New sample,
* sample/GtkDemo/DemoPixbuf.cs : New sample, Needs clean up
* sample/GtkDemo/DemoSizeGroup.cs : New sample,
* sample/GtkDemo/DemoStockBrowser.cs : New sample, Unfinished, 20% Done
* sample/GtkDemo/DemoTextView.cs : New sample, Unfinished, 99% Done
* sample/GtkDemo/DemoTreeStore.cs : New sample, Unfinished, 95% Done
* sample/GtkDemo/images : Several Images for the samples
* sample/GtkDemo/Makefile : Very simple Makefile
* sample/GtkDemo/README : Mentions explicitely unfinished state of port
svn path=/trunk/gtk-sharp/; revision=19489
2003-10-30 23:57:41 +00:00
|
|
|
|
2004-08-08 18:30:25 +00:00
|
|
|
// TODO: Decide if we want to perform crazy error handling
|
|
|
|
private bool ProgressiveTimeout ()
|
2003-10-30 Daniel Kornhauser Eisenberg <dkor@alum.mit.edu>
* sample/GtkDemo/DemoApplicationWindow.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoButtonBox.cs : New sample,
* sample/GtkDemo/DemoColorSelection.cs : New sample,
* sample/GtkDemo/DemoDialog.cs : New sample,
* sample/GtkDemo/DemoDrawingArea.cs : New sample,
* sample/GtkDemo/DemoEditableCells.cs : New sample, Needs clean up
* sample/GtkDemo/DemoImages.cs : New sample, Unfinished, 75% Done
* sample/GtkDemo/DemoItemFactory.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoListStore.cs : New sample,
* sample/GtkDemo/DemoMain.cs : New sample, Unifnished, 60% Done
* sample/GtkDemo/DemoMenus.cs : New sample,
* sample/GtkDemo/DemoPanes.cs : New sample,
* sample/GtkDemo/DemoPixbuf.cs : New sample, Needs clean up
* sample/GtkDemo/DemoSizeGroup.cs : New sample,
* sample/GtkDemo/DemoStockBrowser.cs : New sample, Unfinished, 20% Done
* sample/GtkDemo/DemoTextView.cs : New sample, Unfinished, 99% Done
* sample/GtkDemo/DemoTreeStore.cs : New sample, Unfinished, 95% Done
* sample/GtkDemo/images : Several Images for the samples
* sample/GtkDemo/Makefile : Very simple Makefile
* sample/GtkDemo/README : Mentions explicitely unfinished state of port
svn path=/trunk/gtk-sharp/; revision=19489
2003-10-30 23:57:41 +00:00
|
|
|
{
|
2004-08-08 18:30:25 +00:00
|
|
|
if (imageStream == null) {
|
2004-08-27 19:16:13 +00:00
|
|
|
Stream stream = Assembly.GetExecutingAssembly ().GetManifestResourceStream ("alphatest.png");
|
|
|
|
imageStream = new BinaryReader (stream);
|
2004-08-08 18:30:25 +00:00
|
|
|
pixbufLoader = new Gdk.PixbufLoader ();
|
|
|
|
pixbufLoader.AreaPrepared += new EventHandler (ProgressivePreparedCallback);
|
|
|
|
pixbufLoader.AreaUpdated += new AreaUpdatedHandler (ProgressiveUpdatedCallback);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (imageStream.PeekChar () != -1) {
|
|
|
|
byte[] bytes = imageStream.ReadBytes (256);
|
|
|
|
pixbufLoader.Write (bytes, (uint) bytes.Length);
|
|
|
|
return true; // leave the timeout active
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
imageStream.Close ();
|
|
|
|
return false; // removes the timeout
|
|
|
|
}
|
2003-10-30 Daniel Kornhauser Eisenberg <dkor@alum.mit.edu>
* sample/GtkDemo/DemoApplicationWindow.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoButtonBox.cs : New sample,
* sample/GtkDemo/DemoColorSelection.cs : New sample,
* sample/GtkDemo/DemoDialog.cs : New sample,
* sample/GtkDemo/DemoDrawingArea.cs : New sample,
* sample/GtkDemo/DemoEditableCells.cs : New sample, Needs clean up
* sample/GtkDemo/DemoImages.cs : New sample, Unfinished, 75% Done
* sample/GtkDemo/DemoItemFactory.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoListStore.cs : New sample,
* sample/GtkDemo/DemoMain.cs : New sample, Unifnished, 60% Done
* sample/GtkDemo/DemoMenus.cs : New sample,
* sample/GtkDemo/DemoPanes.cs : New sample,
* sample/GtkDemo/DemoPixbuf.cs : New sample, Needs clean up
* sample/GtkDemo/DemoSizeGroup.cs : New sample,
* sample/GtkDemo/DemoStockBrowser.cs : New sample, Unfinished, 20% Done
* sample/GtkDemo/DemoTextView.cs : New sample, Unfinished, 99% Done
* sample/GtkDemo/DemoTreeStore.cs : New sample, Unfinished, 95% Done
* sample/GtkDemo/images : Several Images for the samples
* sample/GtkDemo/Makefile : Very simple Makefile
* sample/GtkDemo/README : Mentions explicitely unfinished state of port
svn path=/trunk/gtk-sharp/; revision=19489
2003-10-30 23:57:41 +00:00
|
|
|
}
|
|
|
|
|
2004-11-30 21:13:42 +00:00
|
|
|
void ProgressivePreparedCallback (object obj, EventArgs args)
|
2003-10-30 Daniel Kornhauser Eisenberg <dkor@alum.mit.edu>
* sample/GtkDemo/DemoApplicationWindow.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoButtonBox.cs : New sample,
* sample/GtkDemo/DemoColorSelection.cs : New sample,
* sample/GtkDemo/DemoDialog.cs : New sample,
* sample/GtkDemo/DemoDrawingArea.cs : New sample,
* sample/GtkDemo/DemoEditableCells.cs : New sample, Needs clean up
* sample/GtkDemo/DemoImages.cs : New sample, Unfinished, 75% Done
* sample/GtkDemo/DemoItemFactory.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoListStore.cs : New sample,
* sample/GtkDemo/DemoMain.cs : New sample, Unifnished, 60% Done
* sample/GtkDemo/DemoMenus.cs : New sample,
* sample/GtkDemo/DemoPanes.cs : New sample,
* sample/GtkDemo/DemoPixbuf.cs : New sample, Needs clean up
* sample/GtkDemo/DemoSizeGroup.cs : New sample,
* sample/GtkDemo/DemoStockBrowser.cs : New sample, Unfinished, 20% Done
* sample/GtkDemo/DemoTextView.cs : New sample, Unfinished, 99% Done
* sample/GtkDemo/DemoTreeStore.cs : New sample, Unfinished, 95% Done
* sample/GtkDemo/images : Several Images for the samples
* sample/GtkDemo/Makefile : Very simple Makefile
* sample/GtkDemo/README : Mentions explicitely unfinished state of port
svn path=/trunk/gtk-sharp/; revision=19489
2003-10-30 23:57:41 +00:00
|
|
|
{
|
|
|
|
Gdk.Pixbuf pixbuf = pixbufLoader.Pixbuf;
|
|
|
|
pixbuf.Fill (0xaaaaaaff);
|
|
|
|
progressiveImage.FromPixbuf = pixbuf;
|
|
|
|
}
|
|
|
|
|
2004-11-30 21:13:42 +00:00
|
|
|
void ProgressiveUpdatedCallback (object obj, AreaUpdatedArgs args)
|
2003-10-30 Daniel Kornhauser Eisenberg <dkor@alum.mit.edu>
* sample/GtkDemo/DemoApplicationWindow.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoButtonBox.cs : New sample,
* sample/GtkDemo/DemoColorSelection.cs : New sample,
* sample/GtkDemo/DemoDialog.cs : New sample,
* sample/GtkDemo/DemoDrawingArea.cs : New sample,
* sample/GtkDemo/DemoEditableCells.cs : New sample, Needs clean up
* sample/GtkDemo/DemoImages.cs : New sample, Unfinished, 75% Done
* sample/GtkDemo/DemoItemFactory.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoListStore.cs : New sample,
* sample/GtkDemo/DemoMain.cs : New sample, Unifnished, 60% Done
* sample/GtkDemo/DemoMenus.cs : New sample,
* sample/GtkDemo/DemoPanes.cs : New sample,
* sample/GtkDemo/DemoPixbuf.cs : New sample, Needs clean up
* sample/GtkDemo/DemoSizeGroup.cs : New sample,
* sample/GtkDemo/DemoStockBrowser.cs : New sample, Unfinished, 20% Done
* sample/GtkDemo/DemoTextView.cs : New sample, Unfinished, 99% Done
* sample/GtkDemo/DemoTreeStore.cs : New sample, Unfinished, 95% Done
* sample/GtkDemo/images : Several Images for the samples
* sample/GtkDemo/Makefile : Very simple Makefile
* sample/GtkDemo/README : Mentions explicitely unfinished state of port
svn path=/trunk/gtk-sharp/; revision=19489
2003-10-30 23:57:41 +00:00
|
|
|
{
|
2004-08-08 18:30:25 +00:00
|
|
|
progressiveImage.QueueDraw ();
|
2003-10-30 Daniel Kornhauser Eisenberg <dkor@alum.mit.edu>
* sample/GtkDemo/DemoApplicationWindow.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoButtonBox.cs : New sample,
* sample/GtkDemo/DemoColorSelection.cs : New sample,
* sample/GtkDemo/DemoDialog.cs : New sample,
* sample/GtkDemo/DemoDrawingArea.cs : New sample,
* sample/GtkDemo/DemoEditableCells.cs : New sample, Needs clean up
* sample/GtkDemo/DemoImages.cs : New sample, Unfinished, 75% Done
* sample/GtkDemo/DemoItemFactory.cs : New sample, Unfinished, 5% Done
* sample/GtkDemo/DemoListStore.cs : New sample,
* sample/GtkDemo/DemoMain.cs : New sample, Unifnished, 60% Done
* sample/GtkDemo/DemoMenus.cs : New sample,
* sample/GtkDemo/DemoPanes.cs : New sample,
* sample/GtkDemo/DemoPixbuf.cs : New sample, Needs clean up
* sample/GtkDemo/DemoSizeGroup.cs : New sample,
* sample/GtkDemo/DemoStockBrowser.cs : New sample, Unfinished, 20% Done
* sample/GtkDemo/DemoTextView.cs : New sample, Unfinished, 99% Done
* sample/GtkDemo/DemoTreeStore.cs : New sample, Unfinished, 95% Done
* sample/GtkDemo/images : Several Images for the samples
* sample/GtkDemo/Makefile : Very simple Makefile
* sample/GtkDemo/README : Mentions explicitely unfinished state of port
svn path=/trunk/gtk-sharp/; revision=19489
2003-10-30 23:57:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|