Add a compilable working sample for 'Viewport'.

svn path=/trunk/gtk-sharp/; revision=13614
This commit is contained in:
Lee Mallabone 2003-04-14 18:35:24 +00:00
parent 90fac8a1ad
commit 1efb61cb1e
3 changed files with 56 additions and 0 deletions

View File

@ -3,6 +3,9 @@
* en/Gtk/Adjustment.xml: Add sane docs to ClampPage, based on the
original C docs and comments from Miguel.
* en/Gtk/Viewport1.cs, en/Gtk/Viewport.xml: Add a full sample, it's
ignored by the browser at the moment.
2003-04-13 Lee Mallabone <mono-docs@fonicmonkey.net>
* en/Gtk/TreeSelection.xml: First draft.

View File

@ -31,6 +31,7 @@ public ScrolledWindow CreateViewport()
return scroller;
}
</code></example></para>
<para>Complete example: <code lang="C#" source="Viewport1.cs"/></para>
</remarks>
</Docs>
<Base>

52
doc/en/Gtk/Viewport1.cs Executable file
View File

@ -0,0 +1,52 @@
// ViewportApp.cs - Gtk.Viewport class Test implementation
//
// Author: Lee Mallabone <gnome@fonicmonkey.net>
//
// (c) 2003 Lee Mallabone
namespace GtkSamples {
using Gtk;
using GtkSharp;
using System;
using System.Drawing;
public class ViewportApp {
public static ScrolledWindow CreateViewport()
{
ScrolledWindow scroller = new ScrolledWindow();
Viewport viewer = new Viewport();
Table widgets = new Table(1, 2, false);
widgets.Attach(new Entry("This is example Entry 1"), 0, 1, 0, 1);
widgets.Attach(new Entry("This is example Entry 2"), 1, 2, 0, 1);
// Place the widgets in a Viewport, and the Viewport in a ScrolledWindow
viewer.Add(widgets);
scroller.Add(viewer);
return scroller;
}
public static int Main (string[] args)
{
Application.Init ();
Window win = new Window ("Viewport Tester");
win.DefaultSize = new Size (180, 50);
win.DeleteEvent += new DeleteEventHandler (Window_Delete);
ScrolledWindow scroller = CreateViewport();
win.Add (scroller);
win.ShowAll ();
Application.Run ();
return 0;
}
static void Window_Delete (object obj, DeleteEventArgs args)
{
Application.Quit ();
args.RetVal = true;
}
}
}