<Type Name="Bin" FullName="Gtk.Bin">
  <TypeSignature Language="C#" Maintainer="Lee Mallabone, Miguel de Icaza" Value="public class Bin : Gtk.Container" />
  <AssemblyInfo>
    <AssemblyName>gtk-sharp</AssemblyName>
    <AssemblyPublicKey>
    </AssemblyPublicKey>
    <AssemblyVersion>2.12.0.0</AssemblyVersion>
  </AssemblyInfo>
  <ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details.</ThreadSafetyStatement>
  <Docs>
    <summary>A container with just one child.</summary>
    <remarks>
      <para>
        A Bin widget is a <see cref="T:Gtk.Container" /> with just one
	child. It is used to create subclasses, since it provides
	common code needed for handling a single child <see cref="T:Gtk.Widget" />.
      </para>
      <para>
        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
        <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
        negotiation and size allocation using the events <see cref="E:Gtk.Widget.SizeAllocated" /> and <see cref="E:Gtk.Widget.SizeRequested" />.</para>
      <para>
        Sample follows.
      </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;
	
	public MyPadder ()
	{
		// 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){
			int width = args.Requisition.Width;
			int height = args.Requisition.Height;
			
			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;

			his.X += pad;
			his.Y += pad;
			his.Width -= pad * 2;
			his.Height -= pad * 2;
			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 ();
	}
}
        </code>
      </example>
    </remarks>
  </Docs>
  <Base>
    <BaseTypeName>Gtk.Container</BaseTypeName>
  </Base>
  <Interfaces>
  </Interfaces>
  <Members>
    <Member MemberName=".ctor">
      <MemberSignature Language="C#" Value="public Bin (IntPtr raw);" />
      <MemberType>Constructor</MemberType>
      <ReturnValue />
      <Parameters>
        <Parameter Name="raw" Type="System.IntPtr" />
      </Parameters>
      <Docs>
        <summary>Internal constructor</summary>
        <param name="raw">Pointer to the C object.</param>
        <remarks>
          <para>This is an internal constructor, and should not be used by user code.</para>
        </remarks>
      </Docs>
    </Member>
    <Member MemberName="GType">
      <MemberSignature Language="C#" Value="public static GLib.GType GType { get; };" />
      <MemberType>Property</MemberType>
      <ReturnValue>
        <ReturnType>GLib.GType</ReturnType>
      </ReturnValue>
      <Parameters />
      <Docs>
        <summary>GType Property.</summary>
        <value>a <see cref="T:GLib.GType" /></value>
        <remarks>Returns the native <see cref="T:GLib.GType" /> value for <see cref="T:Gtk.Bin" />.</remarks>
      </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>
        <summary>Protected Constructor.</summary>
        <param name="gtype">a <see cref="T:GLib.GType" /></param>
        <remarks>Chain to this constructor if you have manually registered a native <see cref="T:GLib.GType" /> value for your subclass.</remarks>
      </Docs>
      <Attributes>
        <Attribute>
          <AttributeName>System.Obsolete</AttributeName>
        </Attribute>
      </Attributes>
    </Member>
    <Member MemberName=".ctor">
      <MemberSignature Language="C#" Value="protected Bin ();" />
      <MemberType>Constructor</MemberType>
      <ReturnValue />
      <Parameters />
      <Docs>
        <summary>Protected constructor.</summary>
        <remarks>Chain to this constructor if you have not manually registered a native <see cref="T:GLib.GType" /> value for your subclass.</remarks>
      </Docs>
    </Member>
    <Member MemberName="Child">
      <MemberSignature Language="C#" Value="public Gtk.Widget Child { set; get; };" />
      <MemberType>Property</MemberType>
      <ReturnValue>
        <ReturnType>Gtk.Widget</ReturnType>
      </ReturnValue>
      <Parameters />
      <Docs>
        <summary>Accesses the one and only child widget of this Bin object.</summary>
        <value>a <see cref="T:Gtk.Widget" /></value>
        <remarks>
        </remarks>
      </Docs>
    </Member>
  </Members>
</Type>
