2003-02-12 02:00:12 +00:00
<Type Name= "Bin" FullName= "Gtk.Bin" >
2003-07-17 06:38:40 +00:00
<TypeSignature Language= "C#" Value= "public class Bin :
 Gtk.Container, Implementor, IWrapper, IWrapper, IDisposable" Maintainer= "Lee Mallabone, Miguel de Icaza" />
2003-02-12 02:00:12 +00:00
<AssemblyInfo >
<AssemblyName > gtk-sharp</AssemblyName>
2003-12-24 01:35:30 +00:00
<AssemblyPublicKey >
</AssemblyPublicKey>
2003-02-12 02:00:12 +00:00
<AssemblyVersion > 0.0.0.0</AssemblyVersion>
2003-10-28 00:48:23 +00:00
<AssemblyCulture > neutral</AssemblyCulture>
2003-02-12 02:00:12 +00:00
<Attributes />
</AssemblyInfo>
2003-02-23 07:26:30 +00:00
<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>
2003-02-12 02:00:12 +00:00
<Docs >
2003-03-15 10:41:15 +00:00
<summary > A container with just one child.</summary>
2003-03-15 22:50:24 +00:00
<remarks >
2003-07-15 02:34:04 +00:00
<para >
A Bin widget is a <see cref= "T:Gtk.Container" /> with just one
child. It is used to create subclasses, since it provides
2003-07-17 06:38:40 +00:00
common code needed for handling a single child <see cref= "T:Gtk.Widget" /> .
2003-07-15 02:34:04 +00:00
</para>
<para >
2003-07-17 06:38:40 +00:00
Many GTK+ widgets are subclasses of Bin, including <see cref= "T:Gtk.Window" /> , <see cref= "T:Gtk.Button" /> , <see cref= "T:Gtk.Frame" /> , <see cref= "T:Gtk.HandleBox" /> , and
2003-07-15 02:34:04 +00:00
<see cref= "T:Gtk.ScrolledWindow" /> .</para>
<para >
To place a child widget inside this container, use the
standard <see cref= "M:Gtk.Container.Add" /> method.</para>
<para >
For the widget to be useful, it should participate in size
2003-07-17 06:38:40 +00:00
negotiation and size allocation using the events <see cref= "E:Gtk.Widget.SizeAllocated" /> and <see cref= "E:Gtk.Widget.SizeRequested" /> .</para>
2003-07-15 02:34:04 +00:00
<para >
2004-06-19 18:25:02 +00:00
Sample follows.
2003-07-15 02:34:04 +00:00
</para>
<example >
<code lang= "C#" >
using System;
using Gtk;
//
// A simple Bin class: a simple container that adds padding.
//
class MyPadder : Bin {
int pad = 50;
Widget child;
2004-06-19 18:25:02 +00:00
public MyPadder ()
2003-07-15 02:34:04 +00:00
{
// To track our child widget.
Added += new AddedHandler (MyAdded);
// Participate in size negotiation
SizeRequested += new SizeRequestedHandler (OnSizeRequested);
SizeAllocated += new SizeAllocatedHandler (OnSizeAllocated);
}
//
// Invoked to query our size
//
void OnSizeRequested (object o, SizeRequestedArgs args)
{
if (child != null){
2004-06-19 18:25:02 +00:00
int width = args.Requisition.Width;
int height = args.Requisition.Height;
2003-07-15 02:34:04 +00:00
child.GetSizeRequest (out width, out height);
if (width == -1 || height == -1)
width = height = 80;
SetSizeRequest (width + pad * 2, height + pad * 2);
}
}
//
// Invoked to propagate our size
//
void OnSizeAllocated (object o, SizeAllocatedArgs args)
{
if (child != null){
Gdk.Rectangle mine = args.Allocation;
Gdk.Rectangle his = mine;
2004-06-19 18:25:02 +00:00
his.X += pad;
his.Y += pad;
his.Width -= pad * 2;
his.Height -= pad * 2;
2003-07-15 02:34:04 +00:00
child.SizeAllocate (his);
}
}
//
// Public property of the Padding widget
//
public int Pad {
get {
return pad;
}
set {
pad = value;
QueueResize ();
}
}
void MyAdded (object o, AddedArgs args)
{
child = args.Widget;
}
}
class Y {
static void Main ()
{
Application.Init ();
Window w = new Window ("Hello");
MyPadder x = new MyPadder ();
x.Pad = 100;
Button b = new Button ("Hola");
w.Add (x);
x.Add (b);
w.ShowAll ();
Application.Run ();
}
}
2003-07-17 06:38:40 +00:00
</code>
2003-07-15 02:34:04 +00:00
</example>
2003-03-15 22:50:24 +00:00
</remarks>
2003-02-12 02:00:12 +00:00
</Docs>
<Base >
<BaseTypeName > Gtk.Container</BaseTypeName>
</Base>
<Interfaces >
<Interface >
<InterfaceName > Atk.Implementor</InterfaceName>
</Interface>
<Interface >
<InterfaceName > GLib.IWrapper</InterfaceName>
</Interface>
<Interface >
<InterfaceName > GLib.IWrapper</InterfaceName>
</Interface>
<Interface >
<InterfaceName > System.IDisposable</InterfaceName>
</Interface>
</Interfaces>
<Attributes />
<Members >
<Member MemberName= "Finalize" >
2003-10-13 22:55:58 +00:00
<MemberSignature Language= "C#" Value= "protected override void Finalize ();" />
2003-02-12 02:00:12 +00:00
<MemberType > Method</MemberType>
<ReturnValue >
<ReturnType > System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs >
2003-02-23 07:26:30 +00:00
<summary > Disposes the resources associated with the object.</summary>
<remarks />
2003-02-12 02:00:12 +00:00
</Docs>
</Member>
<Member MemberName= ".ctor" >
<MemberSignature Language= "C#" Value= "public Bin (IntPtr raw);" />
<MemberType > Constructor</MemberType>
<ReturnValue />
<Parameters >
2003-09-17 21:56:59 +00:00
<Parameter Name= "raw" Type= "System.IntPtr" />
</Parameters>
2003-02-12 02:00:12 +00:00
<Docs >
2003-02-23 07:26:30 +00:00
<summary > Internal constructor</summary>
<param name= "raw" > Pointer to the C object.</param>
<returns > An instance of Bin, wrapping the C object.</returns>
<remarks >
<para > This is an internal constructor, and should not be used by user code.</para>
</remarks>
2003-02-12 02:00:12 +00:00
</Docs>
</Member>
2003-10-12 09:06:39 +00:00
<Member MemberName= "Child" >
<MemberSignature Language= "C#" Value= "public Gtk.Widget Child { get; };" />
<MemberType > Property</MemberType>
<ReturnValue >
<ReturnType > Gtk.Widget</ReturnType>
</ReturnValue>
<Parameters />
<Docs >
2004-08-04 17:10:22 +00:00
<summary > Gets the one and only child widget of this Bin object.</summary>
2003-10-12 09:06:39 +00:00
<returns > a <see cref= "T:Gtk.Widget" /> </returns>
2004-08-04 17:10:22 +00:00
<remarks />
2003-10-12 09:06:39 +00:00
</Docs>
</Member>
2003-12-24 01:35:30 +00:00
<Member MemberName= "GType" >
<MemberSignature Language= "C#" Value= "public static GLib.GType GType { get; };" />
<MemberType > Property</MemberType>
<ReturnValue >
<ReturnType > GLib.GType</ReturnType>
</ReturnValue>
<Parameters />
<Docs >
2004-06-21 20:14:42 +00:00
<summary > GType Property.</summary>
2003-12-24 01:35:30 +00:00
<returns > a <see cref= "T:GLib.GType" /> </returns>
2004-06-21 20:14:42 +00:00
<remarks > Returns the native <see cref= "T:GLib.GType" /> value for <see cref= "T:Gtk.Bin" /> .</remarks>
2003-12-24 01:35:30 +00:00
</Docs>
</Member>
<Member MemberName= ".ctor" >
<MemberSignature Language= "C#" Value= "protected Bin (GLib.GType gtype);" />
<MemberType > Constructor</MemberType>
<ReturnValue />
<Parameters >
<Parameter Name= "gtype" Type= "GLib.GType" />
</Parameters>
<Docs >
2004-06-21 20:33:11 +00:00
<summary > Protected Constructor.</summary>
2003-12-24 01:35:30 +00:00
<param name= "gtype" > a <see cref= "T:GLib.GType" /> </param>
<returns > a <see cref= "T:Gtk.Bin" /> </returns>
2004-06-21 20:33:11 +00:00
<remarks > Chain to this constructor if you have manually registered a native <see cref= "T:GLib.GType" /> value for your subclass.</remarks>
2003-12-24 01:35:30 +00:00
</Docs>
</Member>
2004-06-01 18:05:26 +00:00
<Member MemberName= ".ctor" >
<MemberSignature Language= "C#" Value= "protected Bin ();" />
<MemberType > Constructor</MemberType>
<ReturnValue />
<Parameters />
<Docs >
2004-08-04 17:10:22 +00:00
<summary > Protected constructor.</summary>
2004-06-01 18:05:26 +00:00
<returns > a <see cref= "T:Gtk.Bin" /> </returns>
2004-08-04 17:10:22 +00:00
<remarks > Chain to this constructor if you have not manually registered a native <see cref= "T:GLib.GType" /> value for your subclass.</remarks>
2004-06-01 18:05:26 +00:00
</Docs>
</Member>
2003-02-12 02:00:12 +00:00
</Members>
2004-08-17 20:43:49 +00:00
</Type>