Ryujinx-GtkSharp/sample/GtkDemo/DemoPixbuf.cs

168 lines
3.8 KiB
C#
Raw Normal View History

/* Pixbufs
*
* A Pixbuf represents an image, normally in RGB or RGBA format.
* Pixbufs are normally used to load files from disk and perform
* image scaling.
*
* This demo is not all that educational, but looks cool. It was written
* by Extreme Pixbuf Hacker Federico Mena Quintero. It also shows
* off how to use DrawingArea to do a simple animation.
*
* Look at the Image demo for additional pixbuf usage examples.
*
*/
using Gdk;
using Gtk;
using System;
* samples/GtkDemo/*.cs: General fixup and cleanup; Remove some gratuitous differences from the C version. Make comment and indent style consistent. Don't use "this." where not needed. Override OnDeleteEvent rather than connecting one's own DeleteEvent signal. * sample/GtkDemo/DemoApplicationWindow.cs (static DemoApplicationWindow): register the Gtk logo icon with StockManager so it shows up correctly in the toolbar. (AddActions): Register the radio items as radio items so they work right. * sample/GtkDemo/DemoHyperText.cs (EventAfter): handle link-clicking from Widget.WidgetEventAfter (as in the C version), rather than ButtonRelease, now that WidgetEventAfter is wrapped. * sample/GtkDemo/DemoImages.cs (DemoImages): use Gtk.Image.LoadFromResource (particularly to make the animation work right). (OnDestroyed): handle clean up (remove the timeout, etc) * sample/GtkDemo/DemoMain.cs (LoadStream): Fix handling of blank lines and whitespace to match the C version. * sample/GtkDemo/DemoPixbuf.cs (Expose): Use System.Runtime.InteropServices.Marshal.Copy() to copy pixbuf.Pixels to pass to DrawRgbImageDithalign, to make this more like the C version (and probably faster?) (timeout): Remove the FIXME since it seems to work now * sample/GtkDemo/DemoStockBrowser.cs: Simplify a bunch. Use reflection to get the C# names of the stock icons rather than trying to correctly re-mangle the ids. Display the Label with the accelerator underlined. * sample/GtkDemo/DemoTextView.cs (AttachWidgets): use Gtk.Image.LoadFromResource, so the image is properly loaded as an animation, not a static image. Don't set the combobox's "Active" property (for consistency with the C version). (InsertText): Fix miscellaneous differences with the C version. Remove some leftover cruft from earlier workarounds for gtk# bugs. * sample/GtkDemo/DemoTreeStore.cs (AddColumns): Make this more like the C version so the checkboxes are sensitized and hidden correctly on a per-row basis. * sample/GtkDemo/DemoUIManager.cs: Make the radio menu items work. * sample/GtkDemo/README: * sample/GtkDemo/TODO: update svn path=/trunk/gtk-sharp/; revision=42481
2005-04-01 23:08:14 +02:00
using System.Runtime.InteropServices; // for Marshal.Copy
* samples/GtkDemo/*.cs: General fixup and cleanup; Remove some gratuitous differences from the C version. Make comment and indent style consistent. Don't use "this." where not needed. Override OnDeleteEvent rather than connecting one's own DeleteEvent signal. * sample/GtkDemo/DemoApplicationWindow.cs (static DemoApplicationWindow): register the Gtk logo icon with StockManager so it shows up correctly in the toolbar. (AddActions): Register the radio items as radio items so they work right. * sample/GtkDemo/DemoHyperText.cs (EventAfter): handle link-clicking from Widget.WidgetEventAfter (as in the C version), rather than ButtonRelease, now that WidgetEventAfter is wrapped. * sample/GtkDemo/DemoImages.cs (DemoImages): use Gtk.Image.LoadFromResource (particularly to make the animation work right). (OnDestroyed): handle clean up (remove the timeout, etc) * sample/GtkDemo/DemoMain.cs (LoadStream): Fix handling of blank lines and whitespace to match the C version. * sample/GtkDemo/DemoPixbuf.cs (Expose): Use System.Runtime.InteropServices.Marshal.Copy() to copy pixbuf.Pixels to pass to DrawRgbImageDithalign, to make this more like the C version (and probably faster?) (timeout): Remove the FIXME since it seems to work now * sample/GtkDemo/DemoStockBrowser.cs: Simplify a bunch. Use reflection to get the C# names of the stock icons rather than trying to correctly re-mangle the ids. Display the Label with the accelerator underlined. * sample/GtkDemo/DemoTextView.cs (AttachWidgets): use Gtk.Image.LoadFromResource, so the image is properly loaded as an animation, not a static image. Don't set the combobox's "Active" property (for consistency with the C version). (InsertText): Fix miscellaneous differences with the C version. Remove some leftover cruft from earlier workarounds for gtk# bugs. * sample/GtkDemo/DemoTreeStore.cs (AddColumns): Make this more like the C version so the checkboxes are sensitized and hidden correctly on a per-row basis. * sample/GtkDemo/DemoUIManager.cs: Make the radio menu items work. * sample/GtkDemo/README: * sample/GtkDemo/TODO: update svn path=/trunk/gtk-sharp/; revision=42481
2005-04-01 23:08:14 +02:00
namespace GtkDemo
{
[Demo ("Pixbuf", "DemoPixbuf.cs")]
public class DemoPixbuf : Gtk.Window
{
const int FrameDelay = 50;
const int CycleLen = 60;
const string BackgroundName = "background.jpg";
* samples/GtkDemo/*.cs: General fixup and cleanup; Remove some gratuitous differences from the C version. Make comment and indent style consistent. Don't use "this." where not needed. Override OnDeleteEvent rather than connecting one's own DeleteEvent signal. * sample/GtkDemo/DemoApplicationWindow.cs (static DemoApplicationWindow): register the Gtk logo icon with StockManager so it shows up correctly in the toolbar. (AddActions): Register the radio items as radio items so they work right. * sample/GtkDemo/DemoHyperText.cs (EventAfter): handle link-clicking from Widget.WidgetEventAfter (as in the C version), rather than ButtonRelease, now that WidgetEventAfter is wrapped. * sample/GtkDemo/DemoImages.cs (DemoImages): use Gtk.Image.LoadFromResource (particularly to make the animation work right). (OnDestroyed): handle clean up (remove the timeout, etc) * sample/GtkDemo/DemoMain.cs (LoadStream): Fix handling of blank lines and whitespace to match the C version. * sample/GtkDemo/DemoPixbuf.cs (Expose): Use System.Runtime.InteropServices.Marshal.Copy() to copy pixbuf.Pixels to pass to DrawRgbImageDithalign, to make this more like the C version (and probably faster?) (timeout): Remove the FIXME since it seems to work now * sample/GtkDemo/DemoStockBrowser.cs: Simplify a bunch. Use reflection to get the C# names of the stock icons rather than trying to correctly re-mangle the ids. Display the Label with the accelerator underlined. * sample/GtkDemo/DemoTextView.cs (AttachWidgets): use Gtk.Image.LoadFromResource, so the image is properly loaded as an animation, not a static image. Don't set the combobox's "Active" property (for consistency with the C version). (InsertText): Fix miscellaneous differences with the C version. Remove some leftover cruft from earlier workarounds for gtk# bugs. * sample/GtkDemo/DemoTreeStore.cs (AddColumns): Make this more like the C version so the checkboxes are sensitized and hidden correctly on a per-row basis. * sample/GtkDemo/DemoUIManager.cs: Make the radio menu items work. * sample/GtkDemo/README: * sample/GtkDemo/TODO: update svn path=/trunk/gtk-sharp/; revision=42481
2005-04-01 23:08:14 +02:00
static string[] ImageNames = {
"apple-red.png",
"gnome-applets.png",
"gnome-calendar.png",
"gnome-foot.png",
"gnome-gmush.png",
"gnome-gimp.png",
"gnome-gsame.png",
"gnu-keys.png"
};
* samples/GtkDemo/*.cs: General fixup and cleanup; Remove some gratuitous differences from the C version. Make comment and indent style consistent. Don't use "this." where not needed. Override OnDeleteEvent rather than connecting one's own DeleteEvent signal. * sample/GtkDemo/DemoApplicationWindow.cs (static DemoApplicationWindow): register the Gtk logo icon with StockManager so it shows up correctly in the toolbar. (AddActions): Register the radio items as radio items so they work right. * sample/GtkDemo/DemoHyperText.cs (EventAfter): handle link-clicking from Widget.WidgetEventAfter (as in the C version), rather than ButtonRelease, now that WidgetEventAfter is wrapped. * sample/GtkDemo/DemoImages.cs (DemoImages): use Gtk.Image.LoadFromResource (particularly to make the animation work right). (OnDestroyed): handle clean up (remove the timeout, etc) * sample/GtkDemo/DemoMain.cs (LoadStream): Fix handling of blank lines and whitespace to match the C version. * sample/GtkDemo/DemoPixbuf.cs (Expose): Use System.Runtime.InteropServices.Marshal.Copy() to copy pixbuf.Pixels to pass to DrawRgbImageDithalign, to make this more like the C version (and probably faster?) (timeout): Remove the FIXME since it seems to work now * sample/GtkDemo/DemoStockBrowser.cs: Simplify a bunch. Use reflection to get the C# names of the stock icons rather than trying to correctly re-mangle the ids. Display the Label with the accelerator underlined. * sample/GtkDemo/DemoTextView.cs (AttachWidgets): use Gtk.Image.LoadFromResource, so the image is properly loaded as an animation, not a static image. Don't set the combobox's "Active" property (for consistency with the C version). (InsertText): Fix miscellaneous differences with the C version. Remove some leftover cruft from earlier workarounds for gtk# bugs. * sample/GtkDemo/DemoTreeStore.cs (AddColumns): Make this more like the C version so the checkboxes are sensitized and hidden correctly on a per-row basis. * sample/GtkDemo/DemoUIManager.cs: Make the radio menu items work. * sample/GtkDemo/README: * sample/GtkDemo/TODO: update svn path=/trunk/gtk-sharp/; revision=42481
2005-04-01 23:08:14 +02:00
// background image
* samples/GtkDemo/*.cs: General fixup and cleanup; Remove some gratuitous differences from the C version. Make comment and indent style consistent. Don't use "this." where not needed. Override OnDeleteEvent rather than connecting one's own DeleteEvent signal. * sample/GtkDemo/DemoApplicationWindow.cs (static DemoApplicationWindow): register the Gtk logo icon with StockManager so it shows up correctly in the toolbar. (AddActions): Register the radio items as radio items so they work right. * sample/GtkDemo/DemoHyperText.cs (EventAfter): handle link-clicking from Widget.WidgetEventAfter (as in the C version), rather than ButtonRelease, now that WidgetEventAfter is wrapped. * sample/GtkDemo/DemoImages.cs (DemoImages): use Gtk.Image.LoadFromResource (particularly to make the animation work right). (OnDestroyed): handle clean up (remove the timeout, etc) * sample/GtkDemo/DemoMain.cs (LoadStream): Fix handling of blank lines and whitespace to match the C version. * sample/GtkDemo/DemoPixbuf.cs (Expose): Use System.Runtime.InteropServices.Marshal.Copy() to copy pixbuf.Pixels to pass to DrawRgbImageDithalign, to make this more like the C version (and probably faster?) (timeout): Remove the FIXME since it seems to work now * sample/GtkDemo/DemoStockBrowser.cs: Simplify a bunch. Use reflection to get the C# names of the stock icons rather than trying to correctly re-mangle the ids. Display the Label with the accelerator underlined. * sample/GtkDemo/DemoTextView.cs (AttachWidgets): use Gtk.Image.LoadFromResource, so the image is properly loaded as an animation, not a static image. Don't set the combobox's "Active" property (for consistency with the C version). (InsertText): Fix miscellaneous differences with the C version. Remove some leftover cruft from earlier workarounds for gtk# bugs. * sample/GtkDemo/DemoTreeStore.cs (AddColumns): Make this more like the C version so the checkboxes are sensitized and hidden correctly on a per-row basis. * sample/GtkDemo/DemoUIManager.cs: Make the radio menu items work. * sample/GtkDemo/README: * sample/GtkDemo/TODO: update svn path=/trunk/gtk-sharp/; revision=42481
2005-04-01 23:08:14 +02:00
static Pixbuf background;
static int backWidth, backHeight;
// images
* samples/GtkDemo/*.cs: General fixup and cleanup; Remove some gratuitous differences from the C version. Make comment and indent style consistent. Don't use "this." where not needed. Override OnDeleteEvent rather than connecting one's own DeleteEvent signal. * sample/GtkDemo/DemoApplicationWindow.cs (static DemoApplicationWindow): register the Gtk logo icon with StockManager so it shows up correctly in the toolbar. (AddActions): Register the radio items as radio items so they work right. * sample/GtkDemo/DemoHyperText.cs (EventAfter): handle link-clicking from Widget.WidgetEventAfter (as in the C version), rather than ButtonRelease, now that WidgetEventAfter is wrapped. * sample/GtkDemo/DemoImages.cs (DemoImages): use Gtk.Image.LoadFromResource (particularly to make the animation work right). (OnDestroyed): handle clean up (remove the timeout, etc) * sample/GtkDemo/DemoMain.cs (LoadStream): Fix handling of blank lines and whitespace to match the C version. * sample/GtkDemo/DemoPixbuf.cs (Expose): Use System.Runtime.InteropServices.Marshal.Copy() to copy pixbuf.Pixels to pass to DrawRgbImageDithalign, to make this more like the C version (and probably faster?) (timeout): Remove the FIXME since it seems to work now * sample/GtkDemo/DemoStockBrowser.cs: Simplify a bunch. Use reflection to get the C# names of the stock icons rather than trying to correctly re-mangle the ids. Display the Label with the accelerator underlined. * sample/GtkDemo/DemoTextView.cs (AttachWidgets): use Gtk.Image.LoadFromResource, so the image is properly loaded as an animation, not a static image. Don't set the combobox's "Active" property (for consistency with the C version). (InsertText): Fix miscellaneous differences with the C version. Remove some leftover cruft from earlier workarounds for gtk# bugs. * sample/GtkDemo/DemoTreeStore.cs (AddColumns): Make this more like the C version so the checkboxes are sensitized and hidden correctly on a per-row basis. * sample/GtkDemo/DemoUIManager.cs: Make the radio menu items work. * sample/GtkDemo/README: * sample/GtkDemo/TODO: update svn path=/trunk/gtk-sharp/; revision=42481
2005-04-01 23:08:14 +02:00
static Pixbuf[] images;
// current frame
Pixbuf frame;
int frameNum;
// drawing area
DrawingArea drawingArea;
* samples/GtkDemo/*.cs: General fixup and cleanup; Remove some gratuitous differences from the C version. Make comment and indent style consistent. Don't use "this." where not needed. Override OnDeleteEvent rather than connecting one's own DeleteEvent signal. * sample/GtkDemo/DemoApplicationWindow.cs (static DemoApplicationWindow): register the Gtk logo icon with StockManager so it shows up correctly in the toolbar. (AddActions): Register the radio items as radio items so they work right. * sample/GtkDemo/DemoHyperText.cs (EventAfter): handle link-clicking from Widget.WidgetEventAfter (as in the C version), rather than ButtonRelease, now that WidgetEventAfter is wrapped. * sample/GtkDemo/DemoImages.cs (DemoImages): use Gtk.Image.LoadFromResource (particularly to make the animation work right). (OnDestroyed): handle clean up (remove the timeout, etc) * sample/GtkDemo/DemoMain.cs (LoadStream): Fix handling of blank lines and whitespace to match the C version. * sample/GtkDemo/DemoPixbuf.cs (Expose): Use System.Runtime.InteropServices.Marshal.Copy() to copy pixbuf.Pixels to pass to DrawRgbImageDithalign, to make this more like the C version (and probably faster?) (timeout): Remove the FIXME since it seems to work now * sample/GtkDemo/DemoStockBrowser.cs: Simplify a bunch. Use reflection to get the C# names of the stock icons rather than trying to correctly re-mangle the ids. Display the Label with the accelerator underlined. * sample/GtkDemo/DemoTextView.cs (AttachWidgets): use Gtk.Image.LoadFromResource, so the image is properly loaded as an animation, not a static image. Don't set the combobox's "Active" property (for consistency with the C version). (InsertText): Fix miscellaneous differences with the C version. Remove some leftover cruft from earlier workarounds for gtk# bugs. * sample/GtkDemo/DemoTreeStore.cs (AddColumns): Make this more like the C version so the checkboxes are sensitized and hidden correctly on a per-row basis. * sample/GtkDemo/DemoUIManager.cs: Make the radio menu items work. * sample/GtkDemo/README: * sample/GtkDemo/TODO: update svn path=/trunk/gtk-sharp/; revision=42481
2005-04-01 23:08:14 +02:00
uint timeoutId;
static DemoPixbuf ()
{
* samples/GtkDemo/*.cs: General fixup and cleanup; Remove some gratuitous differences from the C version. Make comment and indent style consistent. Don't use "this." where not needed. Override OnDeleteEvent rather than connecting one's own DeleteEvent signal. * sample/GtkDemo/DemoApplicationWindow.cs (static DemoApplicationWindow): register the Gtk logo icon with StockManager so it shows up correctly in the toolbar. (AddActions): Register the radio items as radio items so they work right. * sample/GtkDemo/DemoHyperText.cs (EventAfter): handle link-clicking from Widget.WidgetEventAfter (as in the C version), rather than ButtonRelease, now that WidgetEventAfter is wrapped. * sample/GtkDemo/DemoImages.cs (DemoImages): use Gtk.Image.LoadFromResource (particularly to make the animation work right). (OnDestroyed): handle clean up (remove the timeout, etc) * sample/GtkDemo/DemoMain.cs (LoadStream): Fix handling of blank lines and whitespace to match the C version. * sample/GtkDemo/DemoPixbuf.cs (Expose): Use System.Runtime.InteropServices.Marshal.Copy() to copy pixbuf.Pixels to pass to DrawRgbImageDithalign, to make this more like the C version (and probably faster?) (timeout): Remove the FIXME since it seems to work now * sample/GtkDemo/DemoStockBrowser.cs: Simplify a bunch. Use reflection to get the C# names of the stock icons rather than trying to correctly re-mangle the ids. Display the Label with the accelerator underlined. * sample/GtkDemo/DemoTextView.cs (AttachWidgets): use Gtk.Image.LoadFromResource, so the image is properly loaded as an animation, not a static image. Don't set the combobox's "Active" property (for consistency with the C version). (InsertText): Fix miscellaneous differences with the C version. Remove some leftover cruft from earlier workarounds for gtk# bugs. * sample/GtkDemo/DemoTreeStore.cs (AddColumns): Make this more like the C version so the checkboxes are sensitized and hidden correctly on a per-row basis. * sample/GtkDemo/DemoUIManager.cs: Make the radio menu items work. * sample/GtkDemo/README: * sample/GtkDemo/TODO: update svn path=/trunk/gtk-sharp/; revision=42481
2005-04-01 23:08:14 +02:00
// Load the images for the demo
background = Gdk.Pixbuf.LoadFromResource (BackgroundName);
backWidth = background.Width;
backHeight = background.Height;
images = new Pixbuf[ImageNames.Length];
* samples/GtkDemo/*.cs: General fixup and cleanup; Remove some gratuitous differences from the C version. Make comment and indent style consistent. Don't use "this." where not needed. Override OnDeleteEvent rather than connecting one's own DeleteEvent signal. * sample/GtkDemo/DemoApplicationWindow.cs (static DemoApplicationWindow): register the Gtk logo icon with StockManager so it shows up correctly in the toolbar. (AddActions): Register the radio items as radio items so they work right. * sample/GtkDemo/DemoHyperText.cs (EventAfter): handle link-clicking from Widget.WidgetEventAfter (as in the C version), rather than ButtonRelease, now that WidgetEventAfter is wrapped. * sample/GtkDemo/DemoImages.cs (DemoImages): use Gtk.Image.LoadFromResource (particularly to make the animation work right). (OnDestroyed): handle clean up (remove the timeout, etc) * sample/GtkDemo/DemoMain.cs (LoadStream): Fix handling of blank lines and whitespace to match the C version. * sample/GtkDemo/DemoPixbuf.cs (Expose): Use System.Runtime.InteropServices.Marshal.Copy() to copy pixbuf.Pixels to pass to DrawRgbImageDithalign, to make this more like the C version (and probably faster?) (timeout): Remove the FIXME since it seems to work now * sample/GtkDemo/DemoStockBrowser.cs: Simplify a bunch. Use reflection to get the C# names of the stock icons rather than trying to correctly re-mangle the ids. Display the Label with the accelerator underlined. * sample/GtkDemo/DemoTextView.cs (AttachWidgets): use Gtk.Image.LoadFromResource, so the image is properly loaded as an animation, not a static image. Don't set the combobox's "Active" property (for consistency with the C version). (InsertText): Fix miscellaneous differences with the C version. Remove some leftover cruft from earlier workarounds for gtk# bugs. * sample/GtkDemo/DemoTreeStore.cs (AddColumns): Make this more like the C version so the checkboxes are sensitized and hidden correctly on a per-row basis. * sample/GtkDemo/DemoUIManager.cs: Make the radio menu items work. * sample/GtkDemo/README: * sample/GtkDemo/TODO: update svn path=/trunk/gtk-sharp/; revision=42481
2005-04-01 23:08:14 +02:00
int i = 0;
* samples/GtkDemo/*.cs: General fixup and cleanup; Remove some gratuitous differences from the C version. Make comment and indent style consistent. Don't use "this." where not needed. Override OnDeleteEvent rather than connecting one's own DeleteEvent signal. * sample/GtkDemo/DemoApplicationWindow.cs (static DemoApplicationWindow): register the Gtk logo icon with StockManager so it shows up correctly in the toolbar. (AddActions): Register the radio items as radio items so they work right. * sample/GtkDemo/DemoHyperText.cs (EventAfter): handle link-clicking from Widget.WidgetEventAfter (as in the C version), rather than ButtonRelease, now that WidgetEventAfter is wrapped. * sample/GtkDemo/DemoImages.cs (DemoImages): use Gtk.Image.LoadFromResource (particularly to make the animation work right). (OnDestroyed): handle clean up (remove the timeout, etc) * sample/GtkDemo/DemoMain.cs (LoadStream): Fix handling of blank lines and whitespace to match the C version. * sample/GtkDemo/DemoPixbuf.cs (Expose): Use System.Runtime.InteropServices.Marshal.Copy() to copy pixbuf.Pixels to pass to DrawRgbImageDithalign, to make this more like the C version (and probably faster?) (timeout): Remove the FIXME since it seems to work now * sample/GtkDemo/DemoStockBrowser.cs: Simplify a bunch. Use reflection to get the C# names of the stock icons rather than trying to correctly re-mangle the ids. Display the Label with the accelerator underlined. * sample/GtkDemo/DemoTextView.cs (AttachWidgets): use Gtk.Image.LoadFromResource, so the image is properly loaded as an animation, not a static image. Don't set the combobox's "Active" property (for consistency with the C version). (InsertText): Fix miscellaneous differences with the C version. Remove some leftover cruft from earlier workarounds for gtk# bugs. * sample/GtkDemo/DemoTreeStore.cs (AddColumns): Make this more like the C version so the checkboxes are sensitized and hidden correctly on a per-row basis. * sample/GtkDemo/DemoUIManager.cs: Make the radio menu items work. * sample/GtkDemo/README: * sample/GtkDemo/TODO: update svn path=/trunk/gtk-sharp/; revision=42481
2005-04-01 23:08:14 +02:00
foreach (string im in ImageNames)
images[i++] = Gdk.Pixbuf.LoadFromResource (im);
}
// Expose callback for the drawing area
void DrawnCallback (object o, DrawnArgs args)
{
Cairo.Context cr = args.Cr;
Gdk.CairoHelper.SetSourcePixbuf (cr, frame, 0, 0);
cr.Paint ();
* samples/GtkDemo/*.cs: General fixup and cleanup; Remove some gratuitous differences from the C version. Make comment and indent style consistent. Don't use "this." where not needed. Override OnDeleteEvent rather than connecting one's own DeleteEvent signal. * sample/GtkDemo/DemoApplicationWindow.cs (static DemoApplicationWindow): register the Gtk logo icon with StockManager so it shows up correctly in the toolbar. (AddActions): Register the radio items as radio items so they work right. * sample/GtkDemo/DemoHyperText.cs (EventAfter): handle link-clicking from Widget.WidgetEventAfter (as in the C version), rather than ButtonRelease, now that WidgetEventAfter is wrapped. * sample/GtkDemo/DemoImages.cs (DemoImages): use Gtk.Image.LoadFromResource (particularly to make the animation work right). (OnDestroyed): handle clean up (remove the timeout, etc) * sample/GtkDemo/DemoMain.cs (LoadStream): Fix handling of blank lines and whitespace to match the C version. * sample/GtkDemo/DemoPixbuf.cs (Expose): Use System.Runtime.InteropServices.Marshal.Copy() to copy pixbuf.Pixels to pass to DrawRgbImageDithalign, to make this more like the C version (and probably faster?) (timeout): Remove the FIXME since it seems to work now * sample/GtkDemo/DemoStockBrowser.cs: Simplify a bunch. Use reflection to get the C# names of the stock icons rather than trying to correctly re-mangle the ids. Display the Label with the accelerator underlined. * sample/GtkDemo/DemoTextView.cs (AttachWidgets): use Gtk.Image.LoadFromResource, so the image is properly loaded as an animation, not a static image. Don't set the combobox's "Active" property (for consistency with the C version). (InsertText): Fix miscellaneous differences with the C version. Remove some leftover cruft from earlier workarounds for gtk# bugs. * sample/GtkDemo/DemoTreeStore.cs (AddColumns): Make this more like the C version so the checkboxes are sensitized and hidden correctly on a per-row basis. * sample/GtkDemo/DemoUIManager.cs: Make the radio menu items work. * sample/GtkDemo/README: * sample/GtkDemo/TODO: update svn path=/trunk/gtk-sharp/; revision=42481
2005-04-01 23:08:14 +02:00
args.RetVal = true;
}
* samples/GtkDemo/*.cs: General fixup and cleanup; Remove some gratuitous differences from the C version. Make comment and indent style consistent. Don't use "this." where not needed. Override OnDeleteEvent rather than connecting one's own DeleteEvent signal. * sample/GtkDemo/DemoApplicationWindow.cs (static DemoApplicationWindow): register the Gtk logo icon with StockManager so it shows up correctly in the toolbar. (AddActions): Register the radio items as radio items so they work right. * sample/GtkDemo/DemoHyperText.cs (EventAfter): handle link-clicking from Widget.WidgetEventAfter (as in the C version), rather than ButtonRelease, now that WidgetEventAfter is wrapped. * sample/GtkDemo/DemoImages.cs (DemoImages): use Gtk.Image.LoadFromResource (particularly to make the animation work right). (OnDestroyed): handle clean up (remove the timeout, etc) * sample/GtkDemo/DemoMain.cs (LoadStream): Fix handling of blank lines and whitespace to match the C version. * sample/GtkDemo/DemoPixbuf.cs (Expose): Use System.Runtime.InteropServices.Marshal.Copy() to copy pixbuf.Pixels to pass to DrawRgbImageDithalign, to make this more like the C version (and probably faster?) (timeout): Remove the FIXME since it seems to work now * sample/GtkDemo/DemoStockBrowser.cs: Simplify a bunch. Use reflection to get the C# names of the stock icons rather than trying to correctly re-mangle the ids. Display the Label with the accelerator underlined. * sample/GtkDemo/DemoTextView.cs (AttachWidgets): use Gtk.Image.LoadFromResource, so the image is properly loaded as an animation, not a static image. Don't set the combobox's "Active" property (for consistency with the C version). (InsertText): Fix miscellaneous differences with the C version. Remove some leftover cruft from earlier workarounds for gtk# bugs. * sample/GtkDemo/DemoTreeStore.cs (AddColumns): Make this more like the C version so the checkboxes are sensitized and hidden correctly on a per-row basis. * sample/GtkDemo/DemoUIManager.cs: Make the radio menu items work. * sample/GtkDemo/README: * sample/GtkDemo/TODO: update svn path=/trunk/gtk-sharp/; revision=42481
2005-04-01 23:08:14 +02:00
// timeout handler to regenerate the frame
bool timeout ()
{
background.CopyArea (0, 0, backWidth, backHeight, frame, 0, 0);
double f = (double) (frameNum % CycleLen) / CycleLen;
int xmid = backWidth / 2;
int ymid = backHeight / 2;
double radius = Math.Min (xmid, ymid) / 2;
for (int i = 0; i < images.Length; i++) {
* samples/GtkDemo/*.cs: General fixup and cleanup; Remove some gratuitous differences from the C version. Make comment and indent style consistent. Don't use "this." where not needed. Override OnDeleteEvent rather than connecting one's own DeleteEvent signal. * sample/GtkDemo/DemoApplicationWindow.cs (static DemoApplicationWindow): register the Gtk logo icon with StockManager so it shows up correctly in the toolbar. (AddActions): Register the radio items as radio items so they work right. * sample/GtkDemo/DemoHyperText.cs (EventAfter): handle link-clicking from Widget.WidgetEventAfter (as in the C version), rather than ButtonRelease, now that WidgetEventAfter is wrapped. * sample/GtkDemo/DemoImages.cs (DemoImages): use Gtk.Image.LoadFromResource (particularly to make the animation work right). (OnDestroyed): handle clean up (remove the timeout, etc) * sample/GtkDemo/DemoMain.cs (LoadStream): Fix handling of blank lines and whitespace to match the C version. * sample/GtkDemo/DemoPixbuf.cs (Expose): Use System.Runtime.InteropServices.Marshal.Copy() to copy pixbuf.Pixels to pass to DrawRgbImageDithalign, to make this more like the C version (and probably faster?) (timeout): Remove the FIXME since it seems to work now * sample/GtkDemo/DemoStockBrowser.cs: Simplify a bunch. Use reflection to get the C# names of the stock icons rather than trying to correctly re-mangle the ids. Display the Label with the accelerator underlined. * sample/GtkDemo/DemoTextView.cs (AttachWidgets): use Gtk.Image.LoadFromResource, so the image is properly loaded as an animation, not a static image. Don't set the combobox's "Active" property (for consistency with the C version). (InsertText): Fix miscellaneous differences with the C version. Remove some leftover cruft from earlier workarounds for gtk# bugs. * sample/GtkDemo/DemoTreeStore.cs (AddColumns): Make this more like the C version so the checkboxes are sensitized and hidden correctly on a per-row basis. * sample/GtkDemo/DemoUIManager.cs: Make the radio menu items work. * sample/GtkDemo/README: * sample/GtkDemo/TODO: update svn path=/trunk/gtk-sharp/; revision=42481
2005-04-01 23:08:14 +02:00
double ang = 2 * Math.PI * (double) i / images.Length - f * 2 * Math.PI;
int iw = images[i].Width;
int ih = images[i].Height;
* samples/GtkDemo/*.cs: General fixup and cleanup; Remove some gratuitous differences from the C version. Make comment and indent style consistent. Don't use "this." where not needed. Override OnDeleteEvent rather than connecting one's own DeleteEvent signal. * sample/GtkDemo/DemoApplicationWindow.cs (static DemoApplicationWindow): register the Gtk logo icon with StockManager so it shows up correctly in the toolbar. (AddActions): Register the radio items as radio items so they work right. * sample/GtkDemo/DemoHyperText.cs (EventAfter): handle link-clicking from Widget.WidgetEventAfter (as in the C version), rather than ButtonRelease, now that WidgetEventAfter is wrapped. * sample/GtkDemo/DemoImages.cs (DemoImages): use Gtk.Image.LoadFromResource (particularly to make the animation work right). (OnDestroyed): handle clean up (remove the timeout, etc) * sample/GtkDemo/DemoMain.cs (LoadStream): Fix handling of blank lines and whitespace to match the C version. * sample/GtkDemo/DemoPixbuf.cs (Expose): Use System.Runtime.InteropServices.Marshal.Copy() to copy pixbuf.Pixels to pass to DrawRgbImageDithalign, to make this more like the C version (and probably faster?) (timeout): Remove the FIXME since it seems to work now * sample/GtkDemo/DemoStockBrowser.cs: Simplify a bunch. Use reflection to get the C# names of the stock icons rather than trying to correctly re-mangle the ids. Display the Label with the accelerator underlined. * sample/GtkDemo/DemoTextView.cs (AttachWidgets): use Gtk.Image.LoadFromResource, so the image is properly loaded as an animation, not a static image. Don't set the combobox's "Active" property (for consistency with the C version). (InsertText): Fix miscellaneous differences with the C version. Remove some leftover cruft from earlier workarounds for gtk# bugs. * sample/GtkDemo/DemoTreeStore.cs (AddColumns): Make this more like the C version so the checkboxes are sensitized and hidden correctly on a per-row basis. * sample/GtkDemo/DemoUIManager.cs: Make the radio menu items work. * sample/GtkDemo/README: * sample/GtkDemo/TODO: update svn path=/trunk/gtk-sharp/; revision=42481
2005-04-01 23:08:14 +02:00
double r = radius + (radius / 3) * Math.Sin (f * 2 * Math.PI);
int xpos = (int) Math.Floor (xmid + r * Math.Cos (ang) -
* samples/GtkDemo/*.cs: General fixup and cleanup; Remove some gratuitous differences from the C version. Make comment and indent style consistent. Don't use "this." where not needed. Override OnDeleteEvent rather than connecting one's own DeleteEvent signal. * sample/GtkDemo/DemoApplicationWindow.cs (static DemoApplicationWindow): register the Gtk logo icon with StockManager so it shows up correctly in the toolbar. (AddActions): Register the radio items as radio items so they work right. * sample/GtkDemo/DemoHyperText.cs (EventAfter): handle link-clicking from Widget.WidgetEventAfter (as in the C version), rather than ButtonRelease, now that WidgetEventAfter is wrapped. * sample/GtkDemo/DemoImages.cs (DemoImages): use Gtk.Image.LoadFromResource (particularly to make the animation work right). (OnDestroyed): handle clean up (remove the timeout, etc) * sample/GtkDemo/DemoMain.cs (LoadStream): Fix handling of blank lines and whitespace to match the C version. * sample/GtkDemo/DemoPixbuf.cs (Expose): Use System.Runtime.InteropServices.Marshal.Copy() to copy pixbuf.Pixels to pass to DrawRgbImageDithalign, to make this more like the C version (and probably faster?) (timeout): Remove the FIXME since it seems to work now * sample/GtkDemo/DemoStockBrowser.cs: Simplify a bunch. Use reflection to get the C# names of the stock icons rather than trying to correctly re-mangle the ids. Display the Label with the accelerator underlined. * sample/GtkDemo/DemoTextView.cs (AttachWidgets): use Gtk.Image.LoadFromResource, so the image is properly loaded as an animation, not a static image. Don't set the combobox's "Active" property (for consistency with the C version). (InsertText): Fix miscellaneous differences with the C version. Remove some leftover cruft from earlier workarounds for gtk# bugs. * sample/GtkDemo/DemoTreeStore.cs (AddColumns): Make this more like the C version so the checkboxes are sensitized and hidden correctly on a per-row basis. * sample/GtkDemo/DemoUIManager.cs: Make the radio menu items work. * sample/GtkDemo/README: * sample/GtkDemo/TODO: update svn path=/trunk/gtk-sharp/; revision=42481
2005-04-01 23:08:14 +02:00
iw / 2.0 + 0.5);
int ypos = (int) Math.Floor (ymid + r * Math.Sin (ang) -
* samples/GtkDemo/*.cs: General fixup and cleanup; Remove some gratuitous differences from the C version. Make comment and indent style consistent. Don't use "this." where not needed. Override OnDeleteEvent rather than connecting one's own DeleteEvent signal. * sample/GtkDemo/DemoApplicationWindow.cs (static DemoApplicationWindow): register the Gtk logo icon with StockManager so it shows up correctly in the toolbar. (AddActions): Register the radio items as radio items so they work right. * sample/GtkDemo/DemoHyperText.cs (EventAfter): handle link-clicking from Widget.WidgetEventAfter (as in the C version), rather than ButtonRelease, now that WidgetEventAfter is wrapped. * sample/GtkDemo/DemoImages.cs (DemoImages): use Gtk.Image.LoadFromResource (particularly to make the animation work right). (OnDestroyed): handle clean up (remove the timeout, etc) * sample/GtkDemo/DemoMain.cs (LoadStream): Fix handling of blank lines and whitespace to match the C version. * sample/GtkDemo/DemoPixbuf.cs (Expose): Use System.Runtime.InteropServices.Marshal.Copy() to copy pixbuf.Pixels to pass to DrawRgbImageDithalign, to make this more like the C version (and probably faster?) (timeout): Remove the FIXME since it seems to work now * sample/GtkDemo/DemoStockBrowser.cs: Simplify a bunch. Use reflection to get the C# names of the stock icons rather than trying to correctly re-mangle the ids. Display the Label with the accelerator underlined. * sample/GtkDemo/DemoTextView.cs (AttachWidgets): use Gtk.Image.LoadFromResource, so the image is properly loaded as an animation, not a static image. Don't set the combobox's "Active" property (for consistency with the C version). (InsertText): Fix miscellaneous differences with the C version. Remove some leftover cruft from earlier workarounds for gtk# bugs. * sample/GtkDemo/DemoTreeStore.cs (AddColumns): Make this more like the C version so the checkboxes are sensitized and hidden correctly on a per-row basis. * sample/GtkDemo/DemoUIManager.cs: Make the radio menu items work. * sample/GtkDemo/README: * sample/GtkDemo/TODO: update svn path=/trunk/gtk-sharp/; revision=42481
2005-04-01 23:08:14 +02:00
ih / 2.0 + 0.5);
double k = (i % 2 == 1) ? Math.Sin (f * 2 * Math.PI) :
Math.Cos (f * 2 * Math.PI);
k = 2 * k * k;
k = Math.Max (0.25, k);
* samples/GtkDemo/*.cs: General fixup and cleanup; Remove some gratuitous differences from the C version. Make comment and indent style consistent. Don't use "this." where not needed. Override OnDeleteEvent rather than connecting one's own DeleteEvent signal. * sample/GtkDemo/DemoApplicationWindow.cs (static DemoApplicationWindow): register the Gtk logo icon with StockManager so it shows up correctly in the toolbar. (AddActions): Register the radio items as radio items so they work right. * sample/GtkDemo/DemoHyperText.cs (EventAfter): handle link-clicking from Widget.WidgetEventAfter (as in the C version), rather than ButtonRelease, now that WidgetEventAfter is wrapped. * sample/GtkDemo/DemoImages.cs (DemoImages): use Gtk.Image.LoadFromResource (particularly to make the animation work right). (OnDestroyed): handle clean up (remove the timeout, etc) * sample/GtkDemo/DemoMain.cs (LoadStream): Fix handling of blank lines and whitespace to match the C version. * sample/GtkDemo/DemoPixbuf.cs (Expose): Use System.Runtime.InteropServices.Marshal.Copy() to copy pixbuf.Pixels to pass to DrawRgbImageDithalign, to make this more like the C version (and probably faster?) (timeout): Remove the FIXME since it seems to work now * sample/GtkDemo/DemoStockBrowser.cs: Simplify a bunch. Use reflection to get the C# names of the stock icons rather than trying to correctly re-mangle the ids. Display the Label with the accelerator underlined. * sample/GtkDemo/DemoTextView.cs (AttachWidgets): use Gtk.Image.LoadFromResource, so the image is properly loaded as an animation, not a static image. Don't set the combobox's "Active" property (for consistency with the C version). (InsertText): Fix miscellaneous differences with the C version. Remove some leftover cruft from earlier workarounds for gtk# bugs. * sample/GtkDemo/DemoTreeStore.cs (AddColumns): Make this more like the C version so the checkboxes are sensitized and hidden correctly on a per-row basis. * sample/GtkDemo/DemoUIManager.cs: Make the radio menu items work. * sample/GtkDemo/README: * sample/GtkDemo/TODO: update svn path=/trunk/gtk-sharp/; revision=42481
2005-04-01 23:08:14 +02:00
Rectangle r1, r2, dest;
* samples/GtkDemo/*.cs: General fixup and cleanup; Remove some gratuitous differences from the C version. Make comment and indent style consistent. Don't use "this." where not needed. Override OnDeleteEvent rather than connecting one's own DeleteEvent signal. * sample/GtkDemo/DemoApplicationWindow.cs (static DemoApplicationWindow): register the Gtk logo icon with StockManager so it shows up correctly in the toolbar. (AddActions): Register the radio items as radio items so they work right. * sample/GtkDemo/DemoHyperText.cs (EventAfter): handle link-clicking from Widget.WidgetEventAfter (as in the C version), rather than ButtonRelease, now that WidgetEventAfter is wrapped. * sample/GtkDemo/DemoImages.cs (DemoImages): use Gtk.Image.LoadFromResource (particularly to make the animation work right). (OnDestroyed): handle clean up (remove the timeout, etc) * sample/GtkDemo/DemoMain.cs (LoadStream): Fix handling of blank lines and whitespace to match the C version. * sample/GtkDemo/DemoPixbuf.cs (Expose): Use System.Runtime.InteropServices.Marshal.Copy() to copy pixbuf.Pixels to pass to DrawRgbImageDithalign, to make this more like the C version (and probably faster?) (timeout): Remove the FIXME since it seems to work now * sample/GtkDemo/DemoStockBrowser.cs: Simplify a bunch. Use reflection to get the C# names of the stock icons rather than trying to correctly re-mangle the ids. Display the Label with the accelerator underlined. * sample/GtkDemo/DemoTextView.cs (AttachWidgets): use Gtk.Image.LoadFromResource, so the image is properly loaded as an animation, not a static image. Don't set the combobox's "Active" property (for consistency with the C version). (InsertText): Fix miscellaneous differences with the C version. Remove some leftover cruft from earlier workarounds for gtk# bugs. * sample/GtkDemo/DemoTreeStore.cs (AddColumns): Make this more like the C version so the checkboxes are sensitized and hidden correctly on a per-row basis. * sample/GtkDemo/DemoUIManager.cs: Make the radio menu items work. * sample/GtkDemo/README: * sample/GtkDemo/TODO: update svn path=/trunk/gtk-sharp/; revision=42481
2005-04-01 23:08:14 +02:00
r1 = new Rectangle (xpos, ypos, (int) (iw * k), (int) (ih * k));
r2 = new Rectangle (0, 0, backWidth, backHeight);
* samples/GtkDemo/*.cs: General fixup and cleanup; Remove some gratuitous differences from the C version. Make comment and indent style consistent. Don't use "this." where not needed. Override OnDeleteEvent rather than connecting one's own DeleteEvent signal. * sample/GtkDemo/DemoApplicationWindow.cs (static DemoApplicationWindow): register the Gtk logo icon with StockManager so it shows up correctly in the toolbar. (AddActions): Register the radio items as radio items so they work right. * sample/GtkDemo/DemoHyperText.cs (EventAfter): handle link-clicking from Widget.WidgetEventAfter (as in the C version), rather than ButtonRelease, now that WidgetEventAfter is wrapped. * sample/GtkDemo/DemoImages.cs (DemoImages): use Gtk.Image.LoadFromResource (particularly to make the animation work right). (OnDestroyed): handle clean up (remove the timeout, etc) * sample/GtkDemo/DemoMain.cs (LoadStream): Fix handling of blank lines and whitespace to match the C version. * sample/GtkDemo/DemoPixbuf.cs (Expose): Use System.Runtime.InteropServices.Marshal.Copy() to copy pixbuf.Pixels to pass to DrawRgbImageDithalign, to make this more like the C version (and probably faster?) (timeout): Remove the FIXME since it seems to work now * sample/GtkDemo/DemoStockBrowser.cs: Simplify a bunch. Use reflection to get the C# names of the stock icons rather than trying to correctly re-mangle the ids. Display the Label with the accelerator underlined. * sample/GtkDemo/DemoTextView.cs (AttachWidgets): use Gtk.Image.LoadFromResource, so the image is properly loaded as an animation, not a static image. Don't set the combobox's "Active" property (for consistency with the C version). (InsertText): Fix miscellaneous differences with the C version. Remove some leftover cruft from earlier workarounds for gtk# bugs. * sample/GtkDemo/DemoTreeStore.cs (AddColumns): Make this more like the C version so the checkboxes are sensitized and hidden correctly on a per-row basis. * sample/GtkDemo/DemoUIManager.cs: Make the radio menu items work. * sample/GtkDemo/README: * sample/GtkDemo/TODO: update svn path=/trunk/gtk-sharp/; revision=42481
2005-04-01 23:08:14 +02:00
dest = Rectangle.Intersect (r1, r2);
if (!dest.IsEmpty) {
images[i].Composite (frame, dest.X, dest.Y,
dest.Width, dest.Height,
xpos, ypos, k, k,
InterpType.Nearest,
(int) ((i % 2 == 1) ?
Math.Max (127, Math.Abs (255 * Math.Sin (f * 2 * Math.PI))) :
Math.Max (127, Math.Abs (255 * Math.Cos (f * 2 * Math.PI)))));
}
}
drawingArea.QueueDraw ();
frameNum++;
* samples/GtkDemo/*.cs: General fixup and cleanup; Remove some gratuitous differences from the C version. Make comment and indent style consistent. Don't use "this." where not needed. Override OnDeleteEvent rather than connecting one's own DeleteEvent signal. * sample/GtkDemo/DemoApplicationWindow.cs (static DemoApplicationWindow): register the Gtk logo icon with StockManager so it shows up correctly in the toolbar. (AddActions): Register the radio items as radio items so they work right. * sample/GtkDemo/DemoHyperText.cs (EventAfter): handle link-clicking from Widget.WidgetEventAfter (as in the C version), rather than ButtonRelease, now that WidgetEventAfter is wrapped. * sample/GtkDemo/DemoImages.cs (DemoImages): use Gtk.Image.LoadFromResource (particularly to make the animation work right). (OnDestroyed): handle clean up (remove the timeout, etc) * sample/GtkDemo/DemoMain.cs (LoadStream): Fix handling of blank lines and whitespace to match the C version. * sample/GtkDemo/DemoPixbuf.cs (Expose): Use System.Runtime.InteropServices.Marshal.Copy() to copy pixbuf.Pixels to pass to DrawRgbImageDithalign, to make this more like the C version (and probably faster?) (timeout): Remove the FIXME since it seems to work now * sample/GtkDemo/DemoStockBrowser.cs: Simplify a bunch. Use reflection to get the C# names of the stock icons rather than trying to correctly re-mangle the ids. Display the Label with the accelerator underlined. * sample/GtkDemo/DemoTextView.cs (AttachWidgets): use Gtk.Image.LoadFromResource, so the image is properly loaded as an animation, not a static image. Don't set the combobox's "Active" property (for consistency with the C version). (InsertText): Fix miscellaneous differences with the C version. Remove some leftover cruft from earlier workarounds for gtk# bugs. * sample/GtkDemo/DemoTreeStore.cs (AddColumns): Make this more like the C version so the checkboxes are sensitized and hidden correctly on a per-row basis. * sample/GtkDemo/DemoUIManager.cs: Make the radio menu items work. * sample/GtkDemo/README: * sample/GtkDemo/TODO: update svn path=/trunk/gtk-sharp/; revision=42481
2005-04-01 23:08:14 +02:00
return true;
}
* samples/GtkDemo/*.cs: General fixup and cleanup; Remove some gratuitous differences from the C version. Make comment and indent style consistent. Don't use "this." where not needed. Override OnDeleteEvent rather than connecting one's own DeleteEvent signal. * sample/GtkDemo/DemoApplicationWindow.cs (static DemoApplicationWindow): register the Gtk logo icon with StockManager so it shows up correctly in the toolbar. (AddActions): Register the radio items as radio items so they work right. * sample/GtkDemo/DemoHyperText.cs (EventAfter): handle link-clicking from Widget.WidgetEventAfter (as in the C version), rather than ButtonRelease, now that WidgetEventAfter is wrapped. * sample/GtkDemo/DemoImages.cs (DemoImages): use Gtk.Image.LoadFromResource (particularly to make the animation work right). (OnDestroyed): handle clean up (remove the timeout, etc) * sample/GtkDemo/DemoMain.cs (LoadStream): Fix handling of blank lines and whitespace to match the C version. * sample/GtkDemo/DemoPixbuf.cs (Expose): Use System.Runtime.InteropServices.Marshal.Copy() to copy pixbuf.Pixels to pass to DrawRgbImageDithalign, to make this more like the C version (and probably faster?) (timeout): Remove the FIXME since it seems to work now * sample/GtkDemo/DemoStockBrowser.cs: Simplify a bunch. Use reflection to get the C# names of the stock icons rather than trying to correctly re-mangle the ids. Display the Label with the accelerator underlined. * sample/GtkDemo/DemoTextView.cs (AttachWidgets): use Gtk.Image.LoadFromResource, so the image is properly loaded as an animation, not a static image. Don't set the combobox's "Active" property (for consistency with the C version). (InsertText): Fix miscellaneous differences with the C version. Remove some leftover cruft from earlier workarounds for gtk# bugs. * sample/GtkDemo/DemoTreeStore.cs (AddColumns): Make this more like the C version so the checkboxes are sensitized and hidden correctly on a per-row basis. * sample/GtkDemo/DemoUIManager.cs: Make the radio menu items work. * sample/GtkDemo/README: * sample/GtkDemo/TODO: update svn path=/trunk/gtk-sharp/; revision=42481
2005-04-01 23:08:14 +02:00
public DemoPixbuf () : base ("Pixbufs")
{
* samples/GtkDemo/*.cs: General fixup and cleanup; Remove some gratuitous differences from the C version. Make comment and indent style consistent. Don't use "this." where not needed. Override OnDeleteEvent rather than connecting one's own DeleteEvent signal. * sample/GtkDemo/DemoApplicationWindow.cs (static DemoApplicationWindow): register the Gtk logo icon with StockManager so it shows up correctly in the toolbar. (AddActions): Register the radio items as radio items so they work right. * sample/GtkDemo/DemoHyperText.cs (EventAfter): handle link-clicking from Widget.WidgetEventAfter (as in the C version), rather than ButtonRelease, now that WidgetEventAfter is wrapped. * sample/GtkDemo/DemoImages.cs (DemoImages): use Gtk.Image.LoadFromResource (particularly to make the animation work right). (OnDestroyed): handle clean up (remove the timeout, etc) * sample/GtkDemo/DemoMain.cs (LoadStream): Fix handling of blank lines and whitespace to match the C version. * sample/GtkDemo/DemoPixbuf.cs (Expose): Use System.Runtime.InteropServices.Marshal.Copy() to copy pixbuf.Pixels to pass to DrawRgbImageDithalign, to make this more like the C version (and probably faster?) (timeout): Remove the FIXME since it seems to work now * sample/GtkDemo/DemoStockBrowser.cs: Simplify a bunch. Use reflection to get the C# names of the stock icons rather than trying to correctly re-mangle the ids. Display the Label with the accelerator underlined. * sample/GtkDemo/DemoTextView.cs (AttachWidgets): use Gtk.Image.LoadFromResource, so the image is properly loaded as an animation, not a static image. Don't set the combobox's "Active" property (for consistency with the C version). (InsertText): Fix miscellaneous differences with the C version. Remove some leftover cruft from earlier workarounds for gtk# bugs. * sample/GtkDemo/DemoTreeStore.cs (AddColumns): Make this more like the C version so the checkboxes are sensitized and hidden correctly on a per-row basis. * sample/GtkDemo/DemoUIManager.cs: Make the radio menu items work. * sample/GtkDemo/README: * sample/GtkDemo/TODO: update svn path=/trunk/gtk-sharp/; revision=42481
2005-04-01 23:08:14 +02:00
Resizable = false;
SetSizeRequest (backWidth, backHeight);
* samples/GtkDemo/*.cs: General fixup and cleanup; Remove some gratuitous differences from the C version. Make comment and indent style consistent. Don't use "this." where not needed. Override OnDeleteEvent rather than connecting one's own DeleteEvent signal. * sample/GtkDemo/DemoApplicationWindow.cs (static DemoApplicationWindow): register the Gtk logo icon with StockManager so it shows up correctly in the toolbar. (AddActions): Register the radio items as radio items so they work right. * sample/GtkDemo/DemoHyperText.cs (EventAfter): handle link-clicking from Widget.WidgetEventAfter (as in the C version), rather than ButtonRelease, now that WidgetEventAfter is wrapped. * sample/GtkDemo/DemoImages.cs (DemoImages): use Gtk.Image.LoadFromResource (particularly to make the animation work right). (OnDestroyed): handle clean up (remove the timeout, etc) * sample/GtkDemo/DemoMain.cs (LoadStream): Fix handling of blank lines and whitespace to match the C version. * sample/GtkDemo/DemoPixbuf.cs (Expose): Use System.Runtime.InteropServices.Marshal.Copy() to copy pixbuf.Pixels to pass to DrawRgbImageDithalign, to make this more like the C version (and probably faster?) (timeout): Remove the FIXME since it seems to work now * sample/GtkDemo/DemoStockBrowser.cs: Simplify a bunch. Use reflection to get the C# names of the stock icons rather than trying to correctly re-mangle the ids. Display the Label with the accelerator underlined. * sample/GtkDemo/DemoTextView.cs (AttachWidgets): use Gtk.Image.LoadFromResource, so the image is properly loaded as an animation, not a static image. Don't set the combobox's "Active" property (for consistency with the C version). (InsertText): Fix miscellaneous differences with the C version. Remove some leftover cruft from earlier workarounds for gtk# bugs. * sample/GtkDemo/DemoTreeStore.cs (AddColumns): Make this more like the C version so the checkboxes are sensitized and hidden correctly on a per-row basis. * sample/GtkDemo/DemoUIManager.cs: Make the radio menu items work. * sample/GtkDemo/README: * sample/GtkDemo/TODO: update svn path=/trunk/gtk-sharp/; revision=42481
2005-04-01 23:08:14 +02:00
frame = new Pixbuf (Colorspace.Rgb, false, 8, backWidth, backHeight);
drawingArea = new DrawingArea ();
drawingArea.Drawn += new DrawnHandler (DrawnCallback);
Add (drawingArea);
* samples/GtkDemo/*.cs: General fixup and cleanup; Remove some gratuitous differences from the C version. Make comment and indent style consistent. Don't use "this." where not needed. Override OnDeleteEvent rather than connecting one's own DeleteEvent signal. * sample/GtkDemo/DemoApplicationWindow.cs (static DemoApplicationWindow): register the Gtk logo icon with StockManager so it shows up correctly in the toolbar. (AddActions): Register the radio items as radio items so they work right. * sample/GtkDemo/DemoHyperText.cs (EventAfter): handle link-clicking from Widget.WidgetEventAfter (as in the C version), rather than ButtonRelease, now that WidgetEventAfter is wrapped. * sample/GtkDemo/DemoImages.cs (DemoImages): use Gtk.Image.LoadFromResource (particularly to make the animation work right). (OnDestroyed): handle clean up (remove the timeout, etc) * sample/GtkDemo/DemoMain.cs (LoadStream): Fix handling of blank lines and whitespace to match the C version. * sample/GtkDemo/DemoPixbuf.cs (Expose): Use System.Runtime.InteropServices.Marshal.Copy() to copy pixbuf.Pixels to pass to DrawRgbImageDithalign, to make this more like the C version (and probably faster?) (timeout): Remove the FIXME since it seems to work now * sample/GtkDemo/DemoStockBrowser.cs: Simplify a bunch. Use reflection to get the C# names of the stock icons rather than trying to correctly re-mangle the ids. Display the Label with the accelerator underlined. * sample/GtkDemo/DemoTextView.cs (AttachWidgets): use Gtk.Image.LoadFromResource, so the image is properly loaded as an animation, not a static image. Don't set the combobox's "Active" property (for consistency with the C version). (InsertText): Fix miscellaneous differences with the C version. Remove some leftover cruft from earlier workarounds for gtk# bugs. * sample/GtkDemo/DemoTreeStore.cs (AddColumns): Make this more like the C version so the checkboxes are sensitized and hidden correctly on a per-row basis. * sample/GtkDemo/DemoUIManager.cs: Make the radio menu items work. * sample/GtkDemo/README: * sample/GtkDemo/TODO: update svn path=/trunk/gtk-sharp/; revision=42481
2005-04-01 23:08:14 +02:00
timeoutId = GLib.Timeout.Add (FrameDelay, new GLib.TimeoutHandler(timeout));
ShowAll ();
}
* samples/GtkDemo/*.cs: General fixup and cleanup; Remove some gratuitous differences from the C version. Make comment and indent style consistent. Don't use "this." where not needed. Override OnDeleteEvent rather than connecting one's own DeleteEvent signal. * sample/GtkDemo/DemoApplicationWindow.cs (static DemoApplicationWindow): register the Gtk logo icon with StockManager so it shows up correctly in the toolbar. (AddActions): Register the radio items as radio items so they work right. * sample/GtkDemo/DemoHyperText.cs (EventAfter): handle link-clicking from Widget.WidgetEventAfter (as in the C version), rather than ButtonRelease, now that WidgetEventAfter is wrapped. * sample/GtkDemo/DemoImages.cs (DemoImages): use Gtk.Image.LoadFromResource (particularly to make the animation work right). (OnDestroyed): handle clean up (remove the timeout, etc) * sample/GtkDemo/DemoMain.cs (LoadStream): Fix handling of blank lines and whitespace to match the C version. * sample/GtkDemo/DemoPixbuf.cs (Expose): Use System.Runtime.InteropServices.Marshal.Copy() to copy pixbuf.Pixels to pass to DrawRgbImageDithalign, to make this more like the C version (and probably faster?) (timeout): Remove the FIXME since it seems to work now * sample/GtkDemo/DemoStockBrowser.cs: Simplify a bunch. Use reflection to get the C# names of the stock icons rather than trying to correctly re-mangle the ids. Display the Label with the accelerator underlined. * sample/GtkDemo/DemoTextView.cs (AttachWidgets): use Gtk.Image.LoadFromResource, so the image is properly loaded as an animation, not a static image. Don't set the combobox's "Active" property (for consistency with the C version). (InsertText): Fix miscellaneous differences with the C version. Remove some leftover cruft from earlier workarounds for gtk# bugs. * sample/GtkDemo/DemoTreeStore.cs (AddColumns): Make this more like the C version so the checkboxes are sensitized and hidden correctly on a per-row basis. * sample/GtkDemo/DemoUIManager.cs: Make the radio menu items work. * sample/GtkDemo/README: * sample/GtkDemo/TODO: update svn path=/trunk/gtk-sharp/; revision=42481
2005-04-01 23:08:14 +02:00
protected override void OnDestroyed ()
{
* samples/GtkDemo/*.cs: General fixup and cleanup; Remove some gratuitous differences from the C version. Make comment and indent style consistent. Don't use "this." where not needed. Override OnDeleteEvent rather than connecting one's own DeleteEvent signal. * sample/GtkDemo/DemoApplicationWindow.cs (static DemoApplicationWindow): register the Gtk logo icon with StockManager so it shows up correctly in the toolbar. (AddActions): Register the radio items as radio items so they work right. * sample/GtkDemo/DemoHyperText.cs (EventAfter): handle link-clicking from Widget.WidgetEventAfter (as in the C version), rather than ButtonRelease, now that WidgetEventAfter is wrapped. * sample/GtkDemo/DemoImages.cs (DemoImages): use Gtk.Image.LoadFromResource (particularly to make the animation work right). (OnDestroyed): handle clean up (remove the timeout, etc) * sample/GtkDemo/DemoMain.cs (LoadStream): Fix handling of blank lines and whitespace to match the C version. * sample/GtkDemo/DemoPixbuf.cs (Expose): Use System.Runtime.InteropServices.Marshal.Copy() to copy pixbuf.Pixels to pass to DrawRgbImageDithalign, to make this more like the C version (and probably faster?) (timeout): Remove the FIXME since it seems to work now * sample/GtkDemo/DemoStockBrowser.cs: Simplify a bunch. Use reflection to get the C# names of the stock icons rather than trying to correctly re-mangle the ids. Display the Label with the accelerator underlined. * sample/GtkDemo/DemoTextView.cs (AttachWidgets): use Gtk.Image.LoadFromResource, so the image is properly loaded as an animation, not a static image. Don't set the combobox's "Active" property (for consistency with the C version). (InsertText): Fix miscellaneous differences with the C version. Remove some leftover cruft from earlier workarounds for gtk# bugs. * sample/GtkDemo/DemoTreeStore.cs (AddColumns): Make this more like the C version so the checkboxes are sensitized and hidden correctly on a per-row basis. * sample/GtkDemo/DemoUIManager.cs: Make the radio menu items work. * sample/GtkDemo/README: * sample/GtkDemo/TODO: update svn path=/trunk/gtk-sharp/; revision=42481
2005-04-01 23:08:14 +02:00
if (timeoutId != 0) {
GLib.Source.Remove (timeoutId);
timeoutId = 0;
}
}
protected override bool OnDeleteEvent (Gdk.Event evt)
{
Destroy ();
return true;
}
}
}