a PixbufLoader example

and some small random things I forgot about

svn path=/trunk/gtk-sharp/; revision=32104
This commit is contained in:
John Luke 2004-08-09 20:54:25 +00:00
parent 8e7348d260
commit 189b8b47c6
10 changed files with 170 additions and 59 deletions

View file

@ -10,8 +10,8 @@
</AssemblyInfo>
<ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details.</ThreadSafetyStatement>
<Docs>
<summary>To be added</summary>
<remarks>To be added</remarks>
<summary>Global API elements for <see cref="N:Art" /></summary>
<remarks />
</Docs>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
@ -77,9 +77,9 @@
<ReturnValue />
<Parameters />
<Docs>
<summary>To be added</summary>
<summary>Default constructor</summary>
<returns>a <see cref="T:Art.Global" /></returns>
<remarks>To be added</remarks>
<remarks />
</Docs>
</Member>
<Member MemberName="RectListFromUta">

View file

@ -10,8 +10,8 @@
</AssemblyInfo>
<ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details.</ThreadSafetyStatement>
<Docs>
<summary>To be added</summary>
<remarks>To be added</remarks>
<summary>Global API elements for <see cref="N:Gda" /></summary>
<remarks />
</Docs>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
@ -59,9 +59,9 @@
<ReturnValue />
<Parameters />
<Docs>
<summary>To be added</summary>
<summary>Default constructor</summary>
<returns>a <see cref="T:Gda.Global" /></returns>
<remarks>To be added</remarks>
<remarks />
</Docs>
</Member>
</Members>

View file

@ -10,8 +10,8 @@
</AssemblyInfo>
<ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details.</ThreadSafetyStatement>
<Docs>
<summary>To be added</summary>
<remarks>To be added</remarks>
<summary>Global API elements for <see cref="N:Gdk" /></summary>
<remarks />
</Docs>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
@ -164,9 +164,9 @@
<ReturnValue />
<Parameters />
<Docs>
<summary>To be added</summary>
<summary>Defaul constructor</summary>
<returns>a <see cref="T:Gdk.Global" /></returns>
<remarks>To be added</remarks>
<remarks />
</Docs>
</Member>
<Member MemberName="DoubleClickTime">

View file

@ -16,7 +16,118 @@
You can see the "Images" section of GtkDemo to learn how to use PixbufLoader.
</para>
</summary>
<remarks>To be added</remarks>
<remarks>
<example>
<code lang="C#">
using System;
using System.IO;
using Gtk;
using Gdk;
namespace GtkDemo
{
public class PixbufLoaderSample : Gtk.Window
{
static Gdk.PixbufLoader pixbufLoader;
private uint timeout_id;
private static Gtk.Image progressiveImage;
private VBox vbox;
BinaryReader imageStream;
static void Main ()
{
Application.Init ();
new PixbufLoaderSample ();
Application.Run ();
}
public PixbufLoaderSample () : base ("images")
{
this.DeleteEvent += new DeleteEventHandler (WindowDelete);
this.BorderWidth = 8;
vbox = new VBox (false, 8);
vbox.BorderWidth = 8;
this.Add (vbox);
Label label = new Gtk.Label ("Progressive image loading");
label.UseMarkup = true;
vbox.PackStart (label);
Gtk.Frame frame = new Gtk.Frame ();
frame.ShadowType = ShadowType.In;
Alignment 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 ();
this.ShowAll ();
}
private void WindowDelete (object o, DeleteEventArgs args)
{
this.Hide ();
this.Destroy ();
args.RetVal = true;
}
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.
*/
timeout_id = GLib.Timeout.Add (150, new GLib.TimeoutHandler (ProgressiveTimeout));
}
private bool ProgressiveTimeout ()
{
if (imageStream == null) {
// note you need to provide your own image
// at that location to run this sample
imageStream = new BinaryReader (new StreamReader ("images/alphatest.png").BaseStream);
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
}
}
static void ProgressivePreparedCallback (object obj, EventArgs args)
{
Gdk.Pixbuf pixbuf = pixbufLoader.Pixbuf;
pixbuf.Fill (0xaaaaaaff);
progressiveImage.FromPixbuf = pixbuf;
}
static void ProgressiveUpdatedCallback (object obj, AreaUpdatedArgs args)
{
progressiveImage.QueueDraw ();
}
}
}
</code>
</example>
</remarks>
</Docs>
<Base>
<BaseTypeName>GLib.Object</BaseTypeName>
@ -98,9 +209,9 @@ You can see the "Images" section of GtkDemo to learn how to use PixbufLoader.
<ReturnValue />
<Parameters />
<Docs>
<summary>To be added</summary>
<returns>To be added: an object of type 'Gdk.PixbufLoader'</returns>
<remarks>To be added</remarks>
<summary>Default constructor</summary>
<returns>an object of type <see cref="T:Gdk.PixbufLoader" /></returns>
<remarks />
</Docs>
</Member>
<Member MemberName=".ctor">
@ -113,7 +224,7 @@ You can see the "Images" section of GtkDemo to learn how to use PixbufLoader.
<Docs>
<summary>To be added</summary>
<param name="image_type">To be added: an object of type 'string'</param>
<returns>To be added: an object of type 'Gdk.PixbufLoader'</returns>
<returns>an object of type <see cref="T:Gdk.PixbufLoader" /></returns>
<remarks>To be added</remarks>
</Docs>
</Member>
@ -124,9 +235,9 @@ You can see the "Images" section of GtkDemo to learn how to use PixbufLoader.
<ReturnType>Gdk.Pixbuf</ReturnType>
</ReturnValue>
<Docs>
<summary>To be added</summary>
<returns>To be added: an object of type 'Gdk.Pixbuf'</returns>
<remarks>To be added</remarks>
<summary>The Pixbuf that is being loaded.</summary>
<returns>an object of type <see cref="T:Gdk.Pixbuf" /></returns>
<remarks />
</Docs>
</Member>
<Member MemberName="Animation">
@ -137,7 +248,7 @@ You can see the "Images" section of GtkDemo to learn how to use PixbufLoader.
</ReturnValue>
<Docs>
<summary>To be added</summary>
<returns>To be added: an object of type 'Gdk.PixbufAnimation'</returns>
<returns>an object of type <see cref="T:Gdk.PixbufAnimation" /></returns>
<remarks>To be added</remarks>
</Docs>
</Member>
@ -149,8 +260,8 @@ You can see the "Images" section of GtkDemo to learn how to use PixbufLoader.
</ReturnValue>
<Parameters />
<Docs>
<summary>To be added</summary>
<remarks>To be added</remarks>
<summary>Emitted when the area of the PixbufLoader is prepared.</summary>
<remarks />
</Docs>
</Member>
<Member MemberName="AreaUpdated">
@ -161,8 +272,8 @@ You can see the "Images" section of GtkDemo to learn how to use PixbufLoader.
</ReturnValue>
<Parameters />
<Docs>
<summary>To be added</summary>
<remarks>To be added</remarks>
<summary>Emitted when the area of the PixbufLoader is updated with data.</summary>
<remarks />
</Docs>
</Member>
<Member MemberName="Closed">
@ -173,8 +284,8 @@ You can see the "Images" section of GtkDemo to learn how to use PixbufLoader.
</ReturnValue>
<Parameters />
<Docs>
<summary>To be added</summary>
<remarks>To be added</remarks>
<summary>Emitted when the PixbufLoader is closed.</summary>
<remarks />
</Docs>
</Member>
<Member MemberName="Format">
@ -197,8 +308,8 @@ You can see the "Images" section of GtkDemo to learn how to use PixbufLoader.
</ReturnValue>
<Parameters />
<Docs>
<summary>To be added</summary>
<remarks>To be added</remarks>
<summary>Emitted when the PixbufLoader has prepared its size.</summary>
<remarks />
</Docs>
</Member>
<Member MemberName="SetSize">
@ -212,10 +323,10 @@ You can see the "Images" section of GtkDemo to learn how to use PixbufLoader.
<Parameter Name="height" Type="System.Int32" />
</Parameters>
<Docs>
<summary>To be added</summary>
<summary>Set the size of the image that will be loaded.</summary>
<param name="width">a <see cref="T:System.Int32" /></param>
<param name="height">a <see cref="T:System.Int32" /></param>
<remarks>To be added</remarks>
<remarks />
</Docs>
</Member>
<Member MemberName="GType">

View file

@ -29,10 +29,10 @@
<Parameter Name="widget" Type="Gtk.Widget" />
</Parameters>
<Docs>
<summary>To be added</summary>
<summary>Used to get the name of a widget that was generated by a <see cref="T:Glade.XML" /> object.</summary>
<param name="widget">a <see cref="T:Gtk.Widget" /></param>
<returns>a <see cref="T:System.String" /></returns>
<remarks>To be added</remarks>
<remarks />
</Docs>
</Member>
<Member MemberName="GetWidgetTree">
@ -45,10 +45,10 @@
<Parameter Name="widget" Type="Gtk.Widget" />
</Parameters>
<Docs>
<summary>To be added</summary>
<summary>This function is used to get the <see cref="T:Glade.XML" /> object that built this widget.</summary>
<param name="widget">a <see cref="T:Gtk.Widget" /></param>
<returns>a <see cref="T:Glade.XML" /></returns>
<remarks>To be added</remarks>
<remarks />
</Docs>
</Member>
<Member MemberName="ModuleCheckVersion">
@ -61,7 +61,7 @@
<Parameter Name="version" Type="System.Int32" />
</Parameters>
<Docs>
<summary>To be added</summary>
<summary>Checks the version of a module.</summary>
<param name="version">a <see cref="T:System.Int32" /></param>
<returns>a <see cref="T:System.String" /></returns>
<remarks />
@ -109,7 +109,7 @@
<param name="type">the <see cref="T:GLib.GType" /> of the widget.</param>
<param name="prop_name">the name of the custom property</param>
<param name="apply_prop">the <see cref="T:Glade.ApplyCustomPropFunc" /> to call when the property is found.</param>
<remarks>To be added</remarks>
<remarks>Some properties are not (yet) handled through the GObject property code, so can not be handled by the generic code. This function provides a way to register handlers for these properties. Such handlers will apply for the GType type and all its descendants.</remarks>
</Docs>
</Member>
<Member MemberName="FlagsFromString">
@ -123,11 +123,11 @@
<Parameter Name="str1ng" Type="System.String" />
</Parameters>
<Docs>
<summary>To be added</summary>
<summary>This helper routine is designed to be used by widget build routines to convert the string representations of flags values found in the XML descriptions to the integer values that can be used to configure the widget.</summary>
<param name="type">a <see cref="T:GLib.GType" /></param>
<param name="str1ng">a <see cref="T:System.String" /></param>
<returns>a <see cref="T:System.UInt32" /></returns>
<remarks>To be added</remarks>
<remarks>The string is composed of string names or nicknames for various flags separated by '|'.</remarks>
</Docs>
</Member>
<Member MemberName="EnumFromString">
@ -141,11 +141,11 @@
<Parameter Name="str1ng" Type="System.String" />
</Parameters>
<Docs>
<summary>To be added</summary>
<summary>This helper routine is designed to be used by widget build routines to convert the string representations of enumeration values found in the XML descriptions to the integer values that can be used to configure the widget.</summary>
<param name="type">a <see cref="T:GLib.GType" /></param>
<param name="str1ng">a <see cref="T:System.String" /></param>
<returns>a <see cref="T:System.Int32" /></returns>
<remarks>To be added</remarks>
<remarks />
</Docs>
</Member>
<Member MemberName="RegisterWidget">

View file

@ -10,8 +10,8 @@
</AssemblyInfo>
<ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details.</ThreadSafetyStatement>
<Docs>
<summary>To be added</summary>
<remarks>To be added</remarks>
<summary>Global API elements for <see cref="N:Gnome" /></summary>
<remarks />
</Docs>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
@ -91,9 +91,9 @@
<ReturnValue />
<Parameters />
<Docs>
<summary>To be added</summary>
<summary>Default constructor</summary>
<returns>a <see cref="T:Gnome.Global" /></returns>
<remarks>To be added</remarks>
<remarks />
</Docs>
</Member>
<Member MemberName="MdiModeGetType">

View file

@ -10,8 +10,8 @@
</AssemblyInfo>
<ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details.</ThreadSafetyStatement>
<Docs>
<summary>To be added</summary>
<remarks>To be added</remarks>
<summary>Global API elements for <see cref="N:GnomeDb" /></summary>
<remarks />
</Docs>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
@ -123,9 +123,9 @@
<ReturnValue />
<Parameters />
<Docs>
<summary>To be added</summary>
<summary>Default constructor</summary>
<returns>a <see cref="T:GnomeDb.Global" /></returns>
<remarks>To be added</remarks>
<remarks />
</Docs>
</Member>
</Members>

View file

@ -77,7 +77,7 @@ public class HelloWorld {
</ReturnValue>
<Parameters />
<Docs>
<summary />
<summary>Runs a single iteration of the mainloop.</summary>
<remarks>
<para>
Runs a single iteration of the mainloop. If no events are
@ -241,7 +241,7 @@ void LongComputation ()
<Parameter Name="blocking" Type="System.Boolean" />
</Parameters>
<Docs>
<summary />
<summary>Runs a single iteration of the mainloop.</summary>
<param name="block">A boolean value, whether the iteration should block or not</param>
<remarks>
<para>
@ -266,4 +266,4 @@ void LongComputation ()
</Docs>
</Member>
</Members>
</Type>
</Type>

View file

@ -40,9 +40,9 @@
<ReturnValue />
<Parameters />
<Docs>
<summary>To be added</summary>
<summary>Default constructor</summary>
<returns>a <see cref="T:Gtk.Init" /></returns>
<remarks>To be added</remarks>
<remarks />
</Docs>
</Member>
<Member MemberName="Check">
@ -115,4 +115,4 @@
</Docs>
</Member>
</Members>
</Type>
</Type>

View file

@ -10,8 +10,8 @@
</AssemblyInfo>
<ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details.</ThreadSafetyStatement>
<Docs>
<summary>To be added</summary>
<remarks>To be added</remarks>
<summary>Global API elements <see cref="N:Rsvg" /></summary>
<remarks />
</Docs>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
@ -54,9 +54,9 @@
<ReturnValue />
<Parameters />
<Docs>
<summary>To be added</summary>
<summary>Default constructor</summary>
<returns>a <see cref="T:Rsvg.Global" /></returns>
<remarks>To be added</remarks>
<remarks />
</Docs>
</Member>
<Member MemberName="DefaultDpi">