fix the examples in Gtk.*

some other miscellaneous stuff

svn path=/trunk/gtk-sharp/; revision=29954
This commit is contained in:
John Luke 2004-06-19 18:25:02 +00:00
parent bccf57ab07
commit 7e906fec7c
19 changed files with 193 additions and 196 deletions

View file

@ -1,3 +1,9 @@
2004-06-19 John Luke <jluke@cfl.rr.com>
* en/Gtk/*.xml: fix examples so they compile, are children of
<remarks /> so they are editable and spaced right, and some
miscellaneous fixes and updates
2004-06-17 Mike Kestner <mkestner@ximian.com> 2004-06-17 Mike Kestner <mkestner@ximian.com>
* en/Gtk/Window.xml : document remaining TBAs. * en/Gtk/Window.xml : document remaining TBAs.

View file

@ -10,7 +10,8 @@
</AssemblyInfo> </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> <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> <Docs>
<summary>To be added</summary> <summary>Functions for drawing points, lines, arcs, and text.
</summary>
<remarks>To be added</remarks> <remarks>To be added</remarks>
</Docs> </Docs>
<Base> <Base>
@ -129,12 +130,12 @@
<Parameter Name="layout" Type="Pango.Layout" /> <Parameter Name="layout" Type="Pango.Layout" />
</Parameters> </Parameters>
<Docs> <Docs>
<summary>To be added</summary> <summary>Render a <see cref="T:Pango.Layout" /> onto a <see cref="T:Gdk.Drawable" /></summary>
<param name="gc">To be added: an object of type 'Gdk.GC'</param> <param name="gc">To be added: an object of type 'Gdk.GC'</param>
<param name="x">To be added: an object of type 'int'</param> <param name="x">To be added: an object of type 'int'</param>
<param name="y">To be added: an object of type 'int'</param> <param name="y">To be added: an object of type 'int'</param>
<param name="layout">To be added: an object of type 'Pango.Layout'</param> <param name="layout">To be added: an object of type 'Pango.Layout'</param>
<remarks>To be added</remarks> <remarks>If you are using Gtk, the usual way to obtain a <see cref="T:Pango.Layout" /> is <see cref="M:Gtk.Widget.CreatePangoLayout()" />.</remarks>
</Docs> </Docs>
</Member> </Member>
<Member MemberName="GetSize"> <Member MemberName="GetSize">
@ -264,7 +265,7 @@
<Parameter Name="height" Type="System.Int32" /> <Parameter Name="height" Type="System.Int32" />
</Parameters> </Parameters>
<Docs> <Docs>
<summary>To be added</summary> <summary>Draws a <see cref="T:Gdk.Image" /> onto a drawable.</summary>
<param name="gc">To be added: an object of type 'Gdk.GC'</param> <param name="gc">To be added: an object of type 'Gdk.GC'</param>
<param name="image">To be added: an object of type 'Gdk.Image'</param> <param name="image">To be added: an object of type 'Gdk.Image'</param>
<param name="xsrc">To be added: an object of type 'int'</param> <param name="xsrc">To be added: an object of type 'int'</param>
@ -273,7 +274,7 @@
<param name="ydest">To be added: an object of type 'int'</param> <param name="ydest">To be added: an object of type 'int'</param>
<param name="width">To be added: an object of type 'int'</param> <param name="width">To be added: an object of type 'int'</param>
<param name="height">To be added: an object of type 'int'</param> <param name="height">To be added: an object of type 'int'</param>
<remarks>To be added</remarks> <remarks>The depth of the <see cref="T:Gdk.Image" /> must match the depth of the <see cref="T:Gdk.Drawable" />.</remarks>
</Docs> </Docs>
</Member> </Member>
<Member MemberName="DrawPoint"> <Member MemberName="DrawPoint">
@ -458,11 +459,11 @@
<Parameter Name="area" Type="Gdk.Rectangle" /> <Parameter Name="area" Type="Gdk.Rectangle" />
</Parameters> </Parameters>
<Docs> <Docs>
<summary>To be added</summary> <summary>Draws a rectangular outline or filled rectangle, using the foreground color and other attributes of the <see cref="T:Gdk.GC" />.</summary>
<param name="gc">a <see cref="T:Gdk.GC" /></param> <param name="gc">a <see cref="T:Gdk.GC" /></param>
<param name="filled">a <see cref="T:System.Boolean" /></param> <param name="filled">a <see cref="T:System.Boolean" /></param>
<param name="area">a <see cref="T:Gdk.Rectangle" /></param> <param name="area">a <see cref="T:Gdk.Rectangle" /></param>
<remarks>To be added</remarks> <remarks>A rectangle drawn filled is 1 pixel smaller in both dimensions than a rectangle outlined. Calling Gdk.DrawRectangle (window, gc, TRUE, 0, 0, 20, 20) results in a filled rectangle 20 pixels wide and 20 pixels high. Calling Gdk.DrawRectangle (window, gc, FALSE, 0, 0, 20, 20) results in an outlined rectangle with corners at (0, 0), (0, 20), (20, 20), and (20, 0), which makes it 21 pixels wide and 21 pixels high.</remarks>
</Docs> </Docs>
</Member> </Member>
<Member MemberName="DrawLine"> <Member MemberName="DrawLine">
@ -567,14 +568,14 @@
<Parameter Name="height" Type="System.Int32" /> <Parameter Name="height" Type="System.Int32" />
</Parameters> </Parameters>
<Docs> <Docs>
<summary>To be added</summary> <summary>Draws a rectangular outline or filled rectangle, using the foreground color and other attributes of the <see cref="T:Gdk.GC" />.</summary>
<param name="gc">a <see cref="T:Gdk.GC" /></param> <param name="gc">a <see cref="T:Gdk.GC" /></param>
<param name="filled">a <see cref="T:System.Boolean" /></param> <param name="filled">a <see cref="T:System.Boolean" /></param>
<param name="x">a <see cref="T:System.Int32" /></param> <param name="x">a <see cref="T:System.Int32" /></param>
<param name="y">a <see cref="T:System.Int32" /></param> <param name="y">a <see cref="T:System.Int32" /></param>
<param name="width">a <see cref="T:System.Int32" /></param> <param name="width">a <see cref="T:System.Int32" /></param>
<param name="height">a <see cref="T:System.Int32" /></param> <param name="height">a <see cref="T:System.Int32" /></param>
<remarks>To be added</remarks> <remarks>A rectangle drawn filled is 1 pixel smaller in both dimensions than a rectangle outlined. Calling Gdk.DrawRectangle (window, gc, TRUE, 0, 0, 20, 20) results in a filled rectangle 20 pixels wide and 20 pixels high. Calling Gdk.DrawRectangle (window, gc, FALSE, 0, 0, 20, 20) results in an outlined rectangle with corners at (0, 0), (0, 20), (20, 20), and (20, 0), which makes it 21 pixels wide and 21 pixels high.</remarks>
</Docs> </Docs>
</Member> </Member>
<Member MemberName="GType"> <Member MemberName="GType">
@ -610,7 +611,7 @@
<ReturnValue /> <ReturnValue />
<Parameters /> <Parameters />
<Docs> <Docs>
<summary>To be added</summary> <summary>This is a constructor used by derivative types of Drawable. This is not typically used by C# code.</summary>
<returns>a <see cref="T:Gdk.Drawable" /></returns> <returns>a <see cref="T:Gdk.Drawable" /></returns>
<remarks>To be added</remarks> <remarks>To be added</remarks>
</Docs> </Docs>

View file

@ -27,8 +27,7 @@
For the widget to be useful, it should participate in size For the widget to be useful, it should participate in size
negotiation and size allocation using the events <see cref="E:Gtk.Widget.SizeAllocated" /> and <see cref="E:Gtk.Widget.SizeRequested" />.</para> negotiation and size allocation using the events <see cref="E:Gtk.Widget.SizeAllocated" /> and <see cref="E:Gtk.Widget.SizeRequested" />.</para>
<para> <para>
Since Gtk.Bin is an abstract class in C, it is necessary to Sample follows.
register a Type. Sample follows.
</para> </para>
<example> <example>
<code lang="C#"> <code lang="C#">
@ -40,19 +39,9 @@ using Gtk;
// //
class MyPadder : Bin { class MyPadder : Bin {
int pad = 50; int pad = 50;
static GLib.Type type;
Widget child; Widget child;
static MyPadder () public MyPadder ()
{
//
// Register the type on the static constructor, so it is
// available on the instance constructors
//
type = RegisterGType (typeof (MyPadder));
}
public MyPadder () : base (type)
{ {
// To track our child widget. // To track our child widget.
Added += new AddedHandler (MyAdded); Added += new AddedHandler (MyAdded);
@ -68,8 +57,8 @@ class MyPadder : Bin {
void OnSizeRequested (object o, SizeRequestedArgs args) void OnSizeRequested (object o, SizeRequestedArgs args)
{ {
if (child != null){ if (child != null){
int width = args.Requisition.width; int width = args.Requisition.Width;
int height = args.Requisition.height; int height = args.Requisition.Height;
child.GetSizeRequest (out width, out height); child.GetSizeRequest (out width, out height);
if (width == -1 || height == -1) if (width == -1 || height == -1)
@ -88,10 +77,10 @@ class MyPadder : Bin {
Gdk.Rectangle mine = args.Allocation; Gdk.Rectangle mine = args.Allocation;
Gdk.Rectangle his = mine; Gdk.Rectangle his = mine;
his.x += pad; his.X += pad;
his.y += pad; his.Y += pad;
his.width -= pad * 2; his.Width -= pad * 2;
his.height -= pad * 2; his.Height -= pad * 2;
child.SizeAllocate (his); child.SizeAllocate (his);
} }
} }

View file

@ -28,7 +28,7 @@ public class ButtonApp {
{ {
Application.Init (); Application.Init ();
Window win = new Window ("Button Tester"); Window win = new Window ("Button Tester");
win.DefaultSize = new Size (200, 150); win.SetDefaultSize (200, 150);
win.DeleteEvent += new DeleteEventHandler (Window_Delete); win.DeleteEvent += new DeleteEventHandler (Window_Delete);
Button btn = new Button ("Click Me"); Button btn = new Button ("Click Me");
btn.Clicked += new EventHandler (btn_click); btn.Clicked += new EventHandler (btn_click);

View file

@ -14,40 +14,34 @@
<remarks> <remarks>
<para> <para>
A <see cref="T:Gtk.CheckButton" /> places a discrete <see cref="T:Gtk.ToggleButton" /> next to a widget, usually a <see cref="T:Gtk.Label" />. See <see cref="T:Gtk.ToggleButton" /> for more information about toggle/check buttons. A <see cref="T:Gtk.CheckButton" /> places a discrete <see cref="T:Gtk.ToggleButton" /> next to a widget, usually a <see cref="T:Gtk.Label" />. See <see cref="T:Gtk.ToggleButton" /> for more information about toggle/check buttons.
</para> </para>
</remarks> <example>
<example> <code lang="C#">
<code language="C#">
using System; using System;
using Gtk; using Gtk;
class CheckButtonSample class CheckButtonSample
{ {
CheckButton cb; CheckButton cb;
static void Main () static void Main ()
{ {
new CheckButtonSample (); new CheckButtonSample ();
} }
CheckButtonSample () CheckButtonSample ()
{ {
Application.Init (); Application.Init ();
Window win = new Window ("CheckButtonSample"); Window win = new Window ("CheckButtonSample");
win.DeleteEvent += new DeleteEventHandler (OnWinDelete); win.DeleteEvent += new DeleteEventHandler (OnWinDelete);
VBox vbox = new VBox (true, 1); VBox vbox = new VBox (true, 1);
win.Add (vbox); win.Add (vbox);
cb = new CheckButton ("Checked"); cb = new CheckButton ("Checked");
cb.Toggled += new EventHandler (OnCheckToggled); cb.Toggled += new EventHandler (OnCheckToggled);
vbox.Add (cb); vbox.Add (cb);
win.ShowAll (); win.ShowAll ();
Application.Run (); Application.Run ();
} }
void OnCheckToggled (object obj, EventArgs args) void OnCheckToggled (object obj, EventArgs args)
{ {
if (cb.Label == "Checked") if (cb.Label == "Checked")
@ -59,14 +53,15 @@ class CheckButtonSample
cb.Label = "Checked"; cb.Label = "Checked";
} }
} }
void OnWinDelete (object obj, DeleteEventArgs args) void OnWinDelete (object obj, DeleteEventArgs args)
{ {
Application.Quit (); Application.Quit ();
} }
} }
</code> </code>
</example> </example>
</remarks>
</Docs> </Docs>
<Base> <Base>
<BaseTypeName>Gtk.ToggleButton</BaseTypeName> <BaseTypeName>Gtk.ToggleButton</BaseTypeName>

View file

@ -35,9 +35,7 @@
</para> </para>
<code lang="c#"> <code lang="c#">
using System; using System;
using System.Runtime.InteropServices;
using Gtk; using Gtk;
using GLib;
class ComboSample class ComboSample
{ {
@ -55,15 +53,10 @@ class ComboSample
Window win = new Window ("ComboSample"); Window win = new Window ("ComboSample");
win.DeleteEvent += new DeleteEventHandler (OnWinDelete); win.DeleteEvent += new DeleteEventHandler (OnWinDelete);
GLib.List l = new GLib.List (IntPtr.Zero, typeof (string)); string[] list = new string[] {"one", "two", "three"};
for (int i =0; i &lt; 5; i++)
{
l.Append ("String " + i);
}
combo = new Combo (); combo = new Combo ();
combo.PopdownStrings = l; combo.PopdownStrings = list;
combo.DisableActivate (); combo.DisableActivate ();
combo.Entry.Activated += new EventHandler (OnEntryActivated); combo.Entry.Activated += new EventHandler (OnEntryActivated);
@ -84,9 +77,6 @@ class ComboSample
} }
} }
</code> </code>
<para>
See <see cref="T:GLib.List" /> for more about GLib.List.
</para>
</example> </example>
</remarks> </remarks>
</Docs> </Docs>

View file

@ -55,7 +55,7 @@ namespace GtkDialogSample
dialog = new Dialog dialog = new Dialog
("Sample", win, Gtk.DialogFlags.DestroyWithParent); ("Sample", win, Gtk.DialogFlags.DestroyWithParent);
dialog.Modal = true; dialog.Modal = true;
dialog.AddButton ("Close", 5); dialog.AddButton ("Close", ResponseType.Close);
dialog.Response += new ResponseHandler (on_dialog_response); dialog.Response += new ResponseHandler (on_dialog_response);
dialog.Run (); dialog.Run ();
dialog.Destroy (); dialog.Destroy ();

View file

@ -13,7 +13,7 @@
<summary>Methods for controlling drag and drop handling.</summary> <summary>Methods for controlling drag and drop handling.</summary>
<remarks> <remarks>
<para> <para>
GTK# has a rich set of methods for doing inter-process communication via the drag-and-drop metaphor. GTK# can do drag-and-drop (DND) via multiple protocols. The currently supported protocols are the Xdnd and Motif protocols. As well as the methods listed here, applications may need to use some facilities provided for <see cref="T:Gtk.Selection" />. Also, the Drag and Drop API makes use of events in the <see cref="T:Gtk.Widget" /> class. Gtk# has a rich set of methods for doing inter-process communication via the drag-and-drop metaphor. Gtk# can do drag-and-drop (DND) via multiple protocols. The currently supported protocols are the Xdnd and Motif protocols. As well as the methods listed here, applications may need to use some facilities provided for <see cref="T:Gtk.Selection" />. Also, the Drag and Drop API makes use of events in the <see cref="T:Gtk.Widget" /> class.
</para> </para>
</remarks> </remarks>
</Docs> </Docs>

View file

@ -16,68 +16,62 @@
<para> <para>
See also the <see cref="T:Gtk.TextView" /> widget for displaying and editing large amounts of text. See also the <see cref="T:Gtk.TextView" /> widget for displaying and editing large amounts of text.
</para> </para>
</remarks> <example>
<example> <code lang="C#">
<code language="C#">
using System; using System;
using Gtk; using Gtk;
class EntrySample class EntrySample
{ {
Entry entry; Entry entry;
static void Main () static void Main ()
{ {
new EntrySample (); new EntrySample ();
} }
EntrySample () EntrySample ()
{ {
Application.Init (); Application.Init ();
Window win = new Window ("EntrySample"); Window win = new Window ("EntrySample");
win.SetDefaultSize (200, 150); win.SetDefaultSize (200, 150);
win.DeleteEvent += new DeleteEventHandler (OnWinDelete); win.DeleteEvent += new DeleteEventHandler (OnWinDelete);
VBox vbox = new VBox (false, 1); VBox vbox = new VBox (false, 1);
win.Add (vbox); win.Add (vbox);
entry = new Entry ("hello world"); entry = new Entry ("hello world");
entry.Editable = true; entry.Editable = true;
entry.Visibility = true; entry.Visibility = true;
vbox.Add (entry); vbox.Add (entry);
CheckButton editable = new CheckButton ("Editable"); CheckButton editable = new CheckButton ("Editable");
editable.Toggled += new EventHandler (OnEditableToggled); editable.Toggled += new EventHandler (OnEditableToggled);
editable.Active = true; editable.Active = true;
vbox.Add (editable); vbox.Add (editable);
CheckButton visibility = new CheckButton ("Visibility"); CheckButton visibility = new CheckButton ("Visibility");
visibility.Toggled += new EventHandler (OnVisibilityToggled); visibility.Toggled += new EventHandler (OnVisibilityToggled);
visibility.Active = true; visibility.Active = true;
vbox.Add (visibility); vbox.Add (visibility);
win.ShowAll (); win.ShowAll ();
Application.Run (); Application.Run ();
} }
void OnEditableToggled (object obj, EventArgs args) void OnEditableToggled (object obj, EventArgs args)
{ {
entry.Editable = !entry.Editable; entry.Editable = !entry.Editable;
} }
void OnVisibilityToggled (object obj, EventArgs args) void OnVisibilityToggled (object obj, EventArgs args)
{ {
entry.Visibility = !entry.Visibility; entry.Visibility = !entry.Visibility;
} }
void OnWinDelete (object obj, DeleteEventArgs args) void OnWinDelete (object obj, DeleteEventArgs args)
{ {
Application.Quit (); Application.Quit ();
} }
} }
</code> </code>
</example> </example>
</remarks>
</Docs> </Docs>
<Base> <Base>
<BaseTypeName>Gtk.Widget</BaseTypeName> <BaseTypeName>Gtk.Widget</BaseTypeName>

View file

@ -22,43 +22,37 @@
<para> <para>
The functionality of the <see cref="T:Gtk.FileSelection" /> can be extended by using the available accessors to the buttons and drop downs. The functionality of the <see cref="T:Gtk.FileSelection" /> can be extended by using the available accessors to the buttons and drop downs.
</para> </para>
</remarks> <example>
<example> <code lang="C#">
<code language="C#">
using System; using System;
using Gtk; using Gtk;
class FileSelectionSample class FileSelectionSample
{ {
Label lbl; Label lbl;
static void Main () static void Main ()
{ {
new FileSelectionSample (); new FileSelectionSample ();
} }
FileSelectionSample () FileSelectionSample ()
{ {
Application.Init (); Application.Init ();
Window win = new Window ("FileSelectionSample"); Window win = new Window ("FileSelectionSample");
win.SetDefaultSize (250,200); win.SetDefaultSize (250,200);
win.DeleteEvent += new DeleteEventHandler (OnWinDelete); win.DeleteEvent += new DeleteEventHandler (OnWinDelete);
VBox vbox = new VBox (true, 1); VBox vbox = new VBox (true, 1);
win.Add (vbox); win.Add (vbox);
Button btn = new Button ("Select a file."); Button btn = new Button ("Select a file.");
btn.Clicked += new EventHandler (OnButtonClicked); btn.Clicked += new EventHandler (OnButtonClicked);
vbox.Add (btn); vbox.Add (btn);
lbl = new Label ("Selected: "); lbl = new Label ("Selected: ");
vbox.Add (lbl); vbox.Add (lbl);
win.ShowAll (); win.ShowAll ();
Application.Run (); Application.Run ();
} }
void OnButtonClicked (object o, EventArgs args) void OnButtonClicked (object o, EventArgs args)
{ {
FileSelection fs = new FileSelection ("Choose a file"); FileSelection fs = new FileSelection ("Choose a file");
@ -66,14 +60,15 @@ class FileSelectionSample
lbl.Text = "Selected: " + fs.SelectionEntry.Text; lbl.Text = "Selected: " + fs.SelectionEntry.Text;
fs.Hide (); fs.Hide ();
} }
void OnWinDelete (object o, DeleteEventArgs args) void OnWinDelete (object o, DeleteEventArgs args)
{ {
Application.Quit (); Application.Quit ();
} }
} }
</code> </code>
</example> </example>
</remarks>
</Docs> </Docs>
<Base> <Base>
<BaseTypeName>Gtk.Dialog</BaseTypeName> <BaseTypeName>Gtk.Dialog</BaseTypeName>

View file

@ -21,7 +21,7 @@
</summary> </summary>
<remarks> <remarks>
<para> <para>
A GtkIconSource contains a <see cref="T:Gdk.Pixbuf" /> (or image A <see cref="T:Gtk.IconSource" /> contains a <see cref="T:Gdk.Pixbuf" /> (or image
filename) that serves as the base image for one or more of the filename) that serves as the base image for one or more of the
icons in a <see cref="T:Gtk.IconSet" />, along with a icons in a <see cref="T:Gtk.IconSet" />, along with a
specification for which icons in the icon set will be based on specification for which icons in the icon set will be based on

View file

@ -18,39 +18,38 @@
<para> <para>
It is commonly dropped down by activating a <see cref="T:Gtk.MenuItem" /> in a <see cref="T:Gtk.MenuBar" /> or in another <see cref="T:Gtk.Menu" />, it can also be popped up by activating a <see cref="T:Gtk.OptionMenu" />. Other composite widgets such as the <see cref="T:Gtk.Notebook" /> can pop up a <see cref="T:Gtk.Menu" /> as well. It is commonly dropped down by activating a <see cref="T:Gtk.MenuItem" /> in a <see cref="T:Gtk.MenuBar" /> or in another <see cref="T:Gtk.Menu" />, it can also be popped up by activating a <see cref="T:Gtk.OptionMenu" />. Other composite widgets such as the <see cref="T:Gtk.Notebook" /> can pop up a <see cref="T:Gtk.Menu" /> as well.
</para> </para>
</remarks> <example>
<example> <code lang="C#">
<code language="C#">
using System; using System;
using Gtk; using Gtk;
public class MenuApp { public class MenuApp
{
public static void Main (string[] args) public static void Main (string[] args)
{ {
Application.Init(); Application.Init();
Window win = new Window ("Menu Sample App"); Window win = new Window ("Menu Sample App");
win.DeleteEvent += new DeleteEventHandler (delete_cb); win.DeleteEvent += new DeleteEventHandler (delete_cb);
win.SetDefaultSize (200, 150); win.SetDefaultSize (200, 150);
VBox box = new VBox (false, 2); VBox box = new VBox (false, 2);
MenuBar mb = new MenuBar (); MenuBar mb = new MenuBar ();
Menu file_menu = new Menu (); Menu file_menu = new Menu ();
MenuItem exit_item = new MenuItem("Exit"); MenuItem exit_item = new MenuItem("Exit");
exit_item.Activated += new EventHandler (exit_cb); exit_item.Activated += new EventHandler (exit_cb);
file_menu.Append (exit_item); file_menu.Append (exit_item);
MenuItem file_item = new MenuItem("File"); MenuItem file_item = new MenuItem("File");
file_item.Submenu = file_menu; file_item.Submenu = file_menu;
mb.Append (file_item); mb.Append (file_item);
box.PackStart(mb, false, false, 0);
box.PackStart(mb, false, false, 0);
Button btn = new Button ("Yep, that's a menu"); Button btn = new Button ("Yep, that's a menu");
box.PackStart(btn, true, true, 0); box.PackStart(btn, true, true, 0);
win.Add (box); win.Add (box);
win.ShowAll (); win.ShowAll ();
Application.Run (); Application.Run ();
} }
@ -63,9 +62,10 @@ public class MenuApp {
{ {
Application.Quit (); Application.Quit ();
} }
} }
</code> </code>
</example> </example>
</remarks>
</Docs> </Docs>
<Base> <Base>
<BaseTypeName>Gtk.MenuShell</BaseTypeName> <BaseTypeName>Gtk.MenuShell</BaseTypeName>

View file

@ -32,9 +32,8 @@
switch between different groups of information to reduce switch between different groups of information to reduce
any flicker caused by widget relayout by the application. any flicker caused by widget relayout by the application.
</para> </para>
</remarks> <example>
<example> <code lang="C#">
<code language="C#">
using System; using System;
using Gtk; using Gtk;
@ -42,13 +41,12 @@ class NotebookSample
{ {
static void Main () static void Main ()
{ {
new NotebookSample (); new NotebookSample ();
} }
NotebookSample () NotebookSample ()
{ {
Application.Init (); Application.Init ();
Window win = new Window ("NotebookSample"); Window win = new Window ("NotebookSample");
win.DeleteEvent += new DeleteEventHandler (OnWinDelete); win.DeleteEvent += new DeleteEventHandler (OnWinDelete);
win.SetDefaultSize (400, 400); win.SetDefaultSize (400, 400);
@ -59,19 +57,20 @@ class NotebookSample
string label = String.Format ("Page {0}", i+1); string label = String.Format ("Page {0}", i+1);
nb.AppendPage (new Button (label), new Label (label)); nb.AppendPage (new Button (label), new Label (label));
} }
win.Add (nb); win.Add (nb);
win.ShowAll (); win.ShowAll ();
Application.Run (); Application.Run ();
} }
void OnWinDelete (object obj, DeleteEventArgs args) void OnWinDelete (object obj, DeleteEventArgs args)
{ {
Application.Quit (); Application.Quit ();
} }
} }
</code> </code>
</example> </example>
</remarks>
</Docs> </Docs>
<Base> <Base>
<BaseTypeName>Gtk.Container</BaseTypeName> <BaseTypeName>Gtk.Container</BaseTypeName>

View file

@ -18,9 +18,8 @@
<para>Status bars in Gtk maintain a stack of messages. The message at the top of the each bar's stack is the one that will currently be displayed.</para> <para>Status bars in Gtk maintain a stack of messages. The message at the top of the each bar's stack is the one that will currently be displayed.</para>
<para>Any messages added to a statusbar's stack must specify a <paramref name="context_id" /> that is used to uniquely identify the source of a message. This <paramref name="context_id" /> can be generated with <see cref="M:Gtk.Statusbar.GetContextId" />, given a message. Note that messages are stored in a stack, and when choosing which message to display, the stack structure is adhered to, regardless of the context identifier of a message.</para> <para>Any messages added to a statusbar's stack must specify a <paramref name="context_id" /> that is used to uniquely identify the source of a message. This <paramref name="context_id" /> can be generated with <see cref="M:Gtk.Statusbar.GetContextId" />, given a message. Note that messages are stored in a stack, and when choosing which message to display, the stack structure is adhered to, regardless of the context identifier of a message.</para>
<para>Messages are added to the bar's stack with <see cref="M:Gtk.Statusbar.Push" />, and the message at the top of the stack can be removed using <see cref="M:Gtk.Statusbar.Pop" />. A message can be removed from anywhere in the stack if it's <paramref name="message_id" /> was recorded at the time it was added. This is done using <see cref="M:Gtk.Statusbar.Remove" />.</para> <para>Messages are added to the bar's stack with <see cref="M:Gtk.Statusbar.Push" />, and the message at the top of the stack can be removed using <see cref="M:Gtk.Statusbar.Pop" />. A message can be removed from anywhere in the stack if it's <paramref name="message_id" /> was recorded at the time it was added. This is done using <see cref="M:Gtk.Statusbar.Remove" />.</para>
</remarks> <example>
<example> <code lang="C#">
<code language="C#">
using System; using System;
using Gtk; using Gtk;
@ -29,38 +28,36 @@ class StatusbarSample
Statusbar sb; Statusbar sb;
const int id = 1; const int id = 1;
int count; int count;
static void Main () static void Main ()
{ {
new StatusbarSample (); new StatusbarSample ();
} }
StatusbarSample () StatusbarSample ()
{ {
Application.Init (); Application.Init ();
count = 0; count = 0;
Window win = new Window ("StatusbarSample"); Window win = new Window ("StatusbarSample");
win.DeleteEvent += new DeleteEventHandler (OnWinDelete); win.DeleteEvent += new DeleteEventHandler (OnWinDelete);
win.SetDefaultSize (150, 100); win.SetDefaultSize (150, 100);
VBox vbox = new VBox (false, 1); VBox vbox = new VBox (false, 1);
win.Add (vbox); win.Add (vbox);
Button btn = new Button ("Add to counter"); Button btn = new Button ("Add to counter");
btn.Clicked += new EventHandler (OnButtonClicked); btn.Clicked += new EventHandler (OnButtonClicked);
vbox.Add (btn); vbox.Add (btn);
sb = new Statusbar (); sb = new Statusbar ();
sb.Push (id, "Welcome!"); sb.Push (id, "Welcome!");
sb.HasResizeGrip = false; sb.HasResizeGrip = false;
vbox.Add (sb); vbox.Add (sb);
win.ShowAll (); win.ShowAll ();
Application.Run (); Application.Run ();
} }
void OnButtonClicked (object obj, EventArgs args) void OnButtonClicked (object obj, EventArgs args)
{ {
count ++; count ++;
@ -68,14 +65,15 @@ class StatusbarSample
sb.Pop (id); sb.Pop (id);
sb.Push (id, message); sb.Push (id, message);
} }
void OnWinDelete (object obj, DeleteEventArgs args) void OnWinDelete (object obj, DeleteEventArgs args)
{ {
Application.Quit (); Application.Quit ();
} }
} }
</code> </code>
</example> </example>
</remarks>
</Docs> </Docs>
<Base> <Base>
<BaseTypeName>Gtk.HBox</BaseTypeName> <BaseTypeName>Gtk.HBox</BaseTypeName>

View file

@ -19,6 +19,9 @@
using Gtk; using Gtk;
class Demo { class Demo {
static ThreadNotify notify;
static void Main () static void Main ()
{ {
Application.Init (); Application.Init ();
@ -36,6 +39,11 @@ class Demo {
LargeComputation (); LargeComputation ();
notify.WakeupMain (); notify.WakeupMain ();
} }
static void LargeComputation ()
{
// lots of processing here
}
} }
</code> </code>
</example> </example>

View file

@ -17,26 +17,56 @@
<para>The appearance of the Viewport can be adjusted using the <see cref="P:Gtk.Viewport.ShadowType" /> property.</para> <para>The appearance of the Viewport can be adjusted using the <see cref="P:Gtk.Viewport.ShadowType" /> property.</para>
<para>The following example creates a <see cref="T:Gtk.Table" /> in a Viewport. When placed in a small <see cref="T:Gtk.Window" />, the widgets can be scrolled. <para>The following example creates a <see cref="T:Gtk.Table" /> in a Viewport. When placed in a small <see cref="T:Gtk.Window" />, the widgets can be scrolled.
</para>
<example> <example>
<code lang="C#"> <code lang="C#">
public ScrolledWindow CreateViewport() namespace GtkSamples {
{
ScrolledWindow scroller = new ScrolledWindow(); using Gtk;
Viewport viewer = new Viewport(); using System;
// Create a table with text entries in it public class ViewportApp {
Table widgets = new Table(1, 2, false);
widgets.Attach(new Entry("This is example Entry 1"), 0, 1, 0, 1); public static ScrolledWindow CreateViewport()
widgets.Attach(new Entry("This is example Entry 2"), 1, 2, 0, 1); {
ScrolledWindow scroller = new ScrolledWindow();
// Place the widgets in a Viewport, and the Viewport in a ScrolledWindow Viewport viewer = new Viewport();
viewer.Add(widgets);
scroller.Add(viewer); Table widgets = new Table(1, 2, false);
return scroller;
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.SetDefaultSize (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;
}
}
} }
</code>
</example></para> </code>
<para>Complete example: <code lang="C#" source="Viewport1.cs" /></para> </example>
</remarks> </remarks>
</Docs> </Docs>
<Base> <Base>

View file

@ -7,9 +7,7 @@
namespace GtkSamples { namespace GtkSamples {
using Gtk; using Gtk;
using GtkSharp;
using System; using System;
using System.Drawing;
public class ViewportApp { public class ViewportApp {
@ -33,7 +31,7 @@ namespace GtkSamples {
{ {
Application.Init (); Application.Init ();
Window win = new Window ("Viewport Tester"); Window win = new Window ("Viewport Tester");
win.DefaultSize = new Size (180, 50); win.SetDefaultSize (180, 50);
win.DeleteEvent += new DeleteEventHandler (Window_Delete); win.DeleteEvent += new DeleteEventHandler (Window_Delete);
ScrolledWindow scroller = CreateViewport(); ScrolledWindow scroller = CreateViewport();
win.Add (scroller); win.Add (scroller);

View file

@ -11,51 +11,44 @@
<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> <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> <Docs>
<summary>To be added</summary> <summary>To be added</summary>
<remarks>To be added</remarks> <remarks>
<example> <example>
<code language="C#"> <code lang="C#">
using System;
using Gtk;
class SvgHelloWorld class SvgHelloWorld
{ {
static void Main(string[] args) static void Main (string[] args)
{ {
Gnome.Program program = Application.Init ();
new Gnome.Program("Hello World", "1.0", Gnome.Modules.UI, args); MyMainWindow app = new MyMainWindow ();
app.ShowAll ();
MyMainWindow app = new MyMainWindow(program); Application.Run ();
app.Show();
program.Run();
} }
} }
class MyMainWindow class MyMainWindow : Gtk.Window
: Gnome.App
{ {
Gnome.Program program; public MyMainWindow () : base ("SVG Hello World")
public MyMainWindow(Gnome.Program gnome_program)
: base("SVG Hello World", "SVG Hello World")
{ {
this.program = gnome_program; this.DeleteEvent += new DeleteEventHandler (delete_event);
this.DeleteEvent += new GtkSharp.DeleteEventHandler(delete_event);
string svg_file_name = "sample.svg"; string svg_file_name = "sample.svg";
Gdk.Pixbuf pixbuf = Rsvg.Tool.PixbufFromFile(svg_file_name); Gdk.Pixbuf pixbuf = Rsvg.Tool.PixbufFromFile (svg_file_name);
Image image = new Image ();
Gtk.Image image = new Gtk.Image();
image.Pixbuf = pixbuf; image.Pixbuf = pixbuf;
this.Add (image);
this.Contents = image;
} }
private void delete_event(object obj, GtkSharp.DeleteEventArgs args) private void delete_event (object obj, DeleteEventArgs args)
{ {
this.program.Quit(); Application.Quit ();
} }
} }
</code>
</example> </code>
</example>
</remarks>
</Docs> </Docs>
<Base> <Base>
<BaseTypeName>System.Object</BaseTypeName> <BaseTypeName>System.Object</BaseTypeName>

View file

@ -10,8 +10,9 @@
</AssemblyInfo> </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> <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> <Docs>
<summary>To be added</summary> <summary>A terminal widget implementation.
<remarks>To be added</remarks> </summary>
<remarks>A <see cref="T:Vte.Terminal" /> is a terminal emulator implemented as a <see cref="T:Gtk.Widget" /></remarks>
</Docs> </Docs>
<Base> <Base>
<BaseTypeName>Gtk.Widget</BaseTypeName> <BaseTypeName>Gtk.Widget</BaseTypeName>
@ -735,10 +736,10 @@
<Parameter Name="gtype" Type="GLib.GType" /> <Parameter Name="gtype" Type="GLib.GType" />
</Parameters> </Parameters>
<Docs> <Docs>
<summary>To be added</summary> <summary>Internal Constructor.</summary>
<param name="gtype">a <see cref="T:GLib.GType" /></param> <param name="gtype">a <see cref="T:GLib.GType" /></param>
<returns>a <see cref="T:Vte.Terminal" /></returns> <returns>a <see cref="T:Vte.Terminal" /></returns>
<remarks>To be added</remarks> <remarks>This should not be called by normal applications.</remarks>
</Docs> </Docs>
</Member> </Member>
<Member MemberName=".ctor"> <Member MemberName=".ctor">
@ -749,10 +750,10 @@
<Parameter Name="raw" Type="System.IntPtr" /> <Parameter Name="raw" Type="System.IntPtr" />
</Parameters> </Parameters>
<Docs> <Docs>
<summary>To be added</summary> <summary>Internal Constructor.</summary>
<param name="raw">a <see cref="T:System.IntPtr" /></param> <param name="raw">a <see cref="T:System.IntPtr" /></param>
<returns>a <see cref="T:Vte.Terminal" /></returns> <returns>a <see cref="T:Vte.Terminal" /></returns>
<remarks>To be added</remarks> <remarks>This should not be called by normal user code.</remarks>
</Docs> </Docs>
</Member> </Member>
<Member MemberName=".ctor"> <Member MemberName=".ctor">
@ -761,9 +762,9 @@
<ReturnValue /> <ReturnValue />
<Parameters /> <Parameters />
<Docs> <Docs>
<summary>To be added</summary> <summary>Default Constructor</summary>
<returns>a <see cref="T:Vte.Terminal" /></returns> <returns>a <see cref="T:Vte.Terminal" /></returns>
<remarks>To be added</remarks> <remarks />
</Docs> </Docs>
</Member> </Member>
<Member MemberName="GType"> <Member MemberName="GType">